Componentes.Terceros.DevExp.../official/x.26/ExpressQuantumGrid 6/Demos/CBuilder/EditorsStylesDemo/EditorsStylesDemoUtils.cpp
2007-09-09 11:27:27 +00:00

73 lines
2.1 KiB
C++

//---------------------------------------------------------------------------
#pragma hdrstop
#include "EditorsStylesDemoConvert.h"
#include "EditorsStylesDemoUtils.h"
#include "EditorsStylesDemoPlanets.h"
#include "EditorsStylesDemoNoteBook.h"
#include "EditorsStylesDemoIssues.h"
#include "EditorsStylesDemoRichEdit.h"
#include "EditorsStylesDemoStylesPalette.h"
#include "Jpeg.hpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TEditorsStylesDemoBaseFrame* __fastcall CreateFrameByID(int AID)
{
TEditorsStylesDemoBaseFrame* AFrame;
switch (AID) {
case TextProcessingFrameID: {
AFrame = new TEditorsStylesDemoRichEditFrame(NULL);
break;
}
case ImageProcessingFrameID: {
AFrame = new TEditorsStylesDemoConvertFrame(NULL);
break;
}
case SolarSystemFrameID: {
AFrame = new TEditorsStylesDemoPlanetsFrame(NULL);
break;
}
case NoteBookFrameID: {
AFrame = new TEditorsStylesDemoNoteBookFrame(NULL);
break;
}
case IssuesFrameID: {
AFrame = new TEditorsStylesDemoIssuesFrame(NULL);
break;
}
case StylesPaletteFrameID:
AFrame = new TEditorsStylesDemoStylesPaletteFrame(NULL);
break;
}
return AFrame;
}
//---------------------------------------------------------------------------
void __fastcall AssignJPEGProperties(TJPEGOptions AJPEGOptions, TJPEGImage* AJPEGImage)
{
AJPEGImage->CompressionQuality = AJPEGOptions.CompressionQuality;
AJPEGImage->Grayscale = AJPEGOptions.Grayscale;
AJPEGImage->ProgressiveEncoding = AJPEGOptions.ProgressiveEncoding;
}
//---------------------------------------------------------------------------
void ConvertBitmapToJPEG(Graphics::TBitmap* ABitmap, String AJPGFileName, TJPEGOptions AJPEGOptions)
{
TJPEGImage* J = new TJPEGImage();
try {
AssignJPEGProperties(AJPEGOptions, J);
J->Assign(ABitmap);
J->SaveToFile(AJPGFileName);
}
__finally {
delete J;
}
}
//---------------------------------------------------------------------------