|
Clasa CxImage Membri&Operatii
CxImage 5.99c este documentata folosind Doxygen( este un sisten de documentare pentru C++, C, Java, C#), totusi din niste motive istorice, multe caracteristici neobisnuite au ramas nedocumentate. Membrii de referinta a clasei, impreuna cu istoricul clasei si licenta se pot gasi aici http://www.xdp.it/cximage/ .
Formatele suportate si optiuni
Intreaga librarie este destul de mare, in main header ximcfg.h se gasesc optiunele de activare sau dezactivare formate grafice specificce sau caracteristici. Fiecare librarie JPG,TIFF si PNG adauga aproximativ cate 100Kb la aplicatia finala, in timp ce influenta lui CxImage este de aproximativ 50KB. De aceea trebuie de pus doar formatele de care aplicatia intr-adevar are nevoie.
formate
#define
librarii necesare
dimensiune
[Kbyte]
BMP
GIF
ICO
TGA
PCX
WBMP
WMF
CXIMAGE_SUPPORT_BMP
CXIMAGE_SUPPORT_GIF
CXIMAGE_SUPPORT_ICO
CXIMAGE_SUPPORT_TGA
CXIMAGE_SUPPORT_PCX
CXIMAGE_SUPPORT_WBMP
CXIMAGE_SUPPORT_WMF
built in
24
JPEG
CXIMAGE_SUPPORT_JPG
jpeg
88
PNG
CXIMAGE_SUPPORT_PNG
png, zlib
104
MNG
CXIMAGE_SUPPORT_MNG
mng, zlib, jpeg
148
TIFF
CXIMAGE_SUPPORT_TIF
tiff, zlib, jpeg
124
JBIG
CXIMAGE_SUPPORT_JBG
jbig
28
PNM,PPM,PGM
RAS
CXIMAGE_SUPPORT_PNM
CXIMAGE_SUPPORT_RAS
jasper
176
JPEG-2000
CXIMAGE_SUPPORT_JP2
CXIMAGE_SUPPORT_JPC
CXIMAGE_SUPPORT_PGX
jasper
176
Optiuni
#define
dimensiune
[Kbyte]
CxImage core
all switches off
20
geometric transformations
CXIMAGE_SUPPORT_TRANSFORMATION
16
image processing
CXIMAGE_SUPPORT_DSP
24
drawing and windows specific functions
CXIMAGE_SUPPORT_WINDOWS
12
transparency
CXIMAGE_SUPPORT_ALPHA
4
selections
CXIMAGE_SUPPORT_SELECTION
4
multiple layers
CXIMAGE_SUPPORT_LAYERS
< 4
graphic formats conversion
CXIMAGE_SUPPORT_DECODE
CXIMAGE_SUPPORT_ENCODE
< 4
Folosirea CxImage in aplicatii
Pentru a folosi CxImage in aplicatii tre sa facem urmatoarele setari:
Project Settings
|- C/C++
| |- Code Generation
| | |- Use run-time library : Multithreaded DLL (must be the same for
| | | all the linked libraries)
| | |- Struct member alignment : must be the same for all the linked
| | | libraries
| |- Precompiled headers : not using precompiled headers
| |- Preprocessor
| |- Additional Include Directories: ..cximage
|- Link
|- General
|- Object/library modules: ../png/Debug/png.lib
../jpeg/Debug/jpeg.lib
../zlib/Debug/zlib.lib
../tiff/Debug/tiff.lib
../cximage/Debug/cximage.lib
Exemple de utilizare a functiilor CxImage
Incarcarea unei resurse de imagini:
//Load the resource IDR_PNG1 from the PNG resource type
CxImage* newImage = new CxImage();
newImage->LoadResource(FindResource(NULL,MAKEINTRESOURCE(IDR_PNG1),
'PNG'),CXIMAGE_FORMAT_PNG);
//Load a bitmap resource;
HBITMAP bitmap = ::LoadBitmap(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_BITMAP1)));
CxImage *newImage = new CxImage();
newImage->CreateFromHBITMAP(bitmap);
Crearea unui TIFF multipage:
CxImage *pimage[3];
pimage[0]=&image1;
pimage[1]=&image2;
pimage[2]=&image3;
FILE* hFile;
hFile = fopen('multipage.tif','w+b');
CxImageTIF multiimage;
multiimage.Encode(hFile,pimage,3);
fclose(hFile);
Conversia dintr-un format in altul:
CxImage image;
// bmp -> jpg
image.Load('image.bmp', CXIMAGE_FORMAT_BMP);
if (image.IsValid())
// png -> tif
image.Load('image.png', CXIMAGE_FORMAT_PNG);
if (image.IsValid())