3
* Purpose: General Purpose Image Class
6
--------------------------------------------------------------------------------
8
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
10
CxImage version 5.99c 17/Oct/2004
12
CxImage : Copyright (C) 2001 - 2004, Davide Pizzolato
14
Original CImage and CImageIterator implementation are:
15
Copyright (C) 1995, Alejandro Aguilar Sierra (asierra(at)servidor(dot)unam(dot)mx)
17
Covered code is provided under this license on an "as is" basis, without warranty
18
of any kind, either expressed or implied, including, without limitation, warranties
19
that the covered code is free of defects, merchantable, fit for a particular purpose
20
or non-infringing. The entire risk as to the quality and performance of the covered
21
code is with you. Should any covered code prove defective in any respect, you (not
22
the initial developer or any other contributor) assume the cost of any necessary
23
servicing, repair or correction. This disclaimer of warranty constitutes an essential
24
part of this license. No use of any covered code is authorized hereunder except under
27
Permission is hereby granted to use, copy, modify, and distribute this
28
source code, or portions hereof, for any purpose, including commercial applications,
29
freely and without fee, subject to the following restrictions:
31
1. The origin of this software must not be misrepresented; you must not
32
claim that you wrote the original software. If you use this software
33
in a product, an acknowledgment in the product documentation would be
34
appreciated but is not required.
36
2. Altered source versions must be plainly marked as such, and must not be
37
misrepresented as being the original software.
39
3. This notice may not be removed or altered from any source distribution.
41
--------------------------------------------------------------------------------
43
Other information: about CxImage, and the latest version, can be found at the
44
CxImage home page: http://www.xdp.it
46
--------------------------------------------------------------------------------
48
#if !defined(__CXIMAGE_H)
55
/////////////////////////////////////////////////////////////////////////////
59
#include "ximadef.h" //<vho> adjust some #define
61
/* see "ximacfg.h" for CxImage configuration options */
63
/////////////////////////////////////////////////////////////////////////////
64
// CxImage formats enumerator
65
enum ENUM_CXIMAGE_FORMATS{
66
CXIMAGE_FORMAT_UNKNOWN,
67
#if CXIMAGE_SUPPORT_BMP
70
#if CXIMAGE_SUPPORT_GIF
73
#if CXIMAGE_SUPPORT_JPG
76
#if CXIMAGE_SUPPORT_PNG
79
#if CXIMAGE_SUPPORT_MNG
82
#if CXIMAGE_SUPPORT_ICO
85
#if CXIMAGE_SUPPORT_TIF
88
#if CXIMAGE_SUPPORT_TGA
91
#if CXIMAGE_SUPPORT_PCX
94
#if CXIMAGE_SUPPORT_WBMP
97
#if CXIMAGE_SUPPORT_WMF
100
#if CXIMAGE_SUPPORT_J2K
103
#if CXIMAGE_SUPPORT_JBG
106
#if CXIMAGE_SUPPORT_JP2
109
#if CXIMAGE_SUPPORT_JPC
112
#if CXIMAGE_SUPPORT_PGX
115
#if CXIMAGE_SUPPORT_PNM
118
#if CXIMAGE_SUPPORT_RAS
124
/////////////////////////////////////////////////////////////////////////////
126
/////////////////////////////////////////////////////////////////////////////
127
class DLL_EXP CxImage
129
//extensible information collector
130
typedef struct tagCxImageInfo {
131
DWORD dwEffWidth; ///< DWORD aligned scan line width
132
BYTE* pImage; ///< THE IMAGE BITS
133
CxImage* pGhost; ///< if this is a ghost, pGhost points to the body
134
CxImage* pParent; ///< if this is a layer, pParent points to the body
135
DWORD dwType; ///< original image format
136
char szLastError[256]; ///< debugging
137
long nProgress; ///< monitor
138
long nEscape; ///< escape
139
long nBkgndIndex; ///< used for GIF, PNG, MNG
140
RGBQUAD nBkgndColor; ///< used for RGB transparency
141
int m_dispmeth; ///< used for GIF
142
BYTE nQuality; ///< used for JPEG
143
BYTE nJpegScale; ///< used for JPEG [ignacio]
144
long nFrame; ///< used for TIF, GIF, MNG : actual frame
145
long nNumFrames; ///< used for TIF, GIF, MNG : total number of frames
146
DWORD dwFrameDelay; ///< used for GIF, MNG
147
long xDPI; ///< horizontal resolution
148
long yDPI; ///< vertical resolution
149
RECT rSelectionBox; ///< bounding rectangle
150
BYTE nAlphaMax; ///< max opacity (fade)
151
bool bAlphaPaletteEnabled; ///< true if alpha values in the palette are enabled.
152
bool bEnabled; ///< enables the painting functions
155
DWORD dwCodecOpt[CMAX_IMAGE_FORMATS]; ///< for GIF, TIF : 0=def.1=unc,2=fax3,3=fax4,4=pack,5=jpg
156
RGBQUAD last_c; ///< for GetNearestIndex optimization
160
DWORD dwFlags; ///< 0x??00000 = reserved, 0x00??0000 = blend mode, 0x0000???? = layer id - user flags
162
CxImage ** GifFrames;
168
struct rgb_color { BYTE r,g,b; };
170
#if CXIMAGE_SUPPORT_WINDOWS
171
// <VATI> text placement data
172
// members must be initialized with the InitTextInfo(&this) function.
173
typedef struct tagCxTextInfo
175
TCHAR text[4096]; ///< text (char -> TCHAR for UNICODE [Cesar M])
176
LOGFONT lfont; ///< font and codepage data
177
COLORREF fcolor; ///< foreground color
178
long align; ///< DT_CENTER, DT_RIGHT, DT_LEFT aligment for multiline text
179
BYTE opaque; ///< text has background or hasn't. Default is true.
180
///< data for background (ignored if .opaque==FALSE)
181
COLORREF bcolor; ///< background color
182
float b_opacity; ///< opacity value for background between 0.0-1.0 Default is 0. (opaque)
183
BYTE b_outline; ///< outline width for background (zero: no outline)
184
BYTE b_round; ///< rounding radius for background rectangle. % of the height, between 0-50. Default is 10.
185
///< (backgr. always has a frame: width = 3 pixel + 10% of height by default.)
190
/** \addtogroup Constructors */ //@{
191
CxImage(DWORD imagetype = 0);
192
CxImage(DWORD dwWidth, DWORD dwHeight, DWORD wBpp, DWORD imagetype = 0);
193
CxImage(const CxImage &src, bool copypixels = true, bool copyselection = true, bool copyalpha = true);
194
CxImage(const TCHAR * filename, DWORD imagetype); // For UNICODE support: char -> TCHAR
195
CxImage(FILE * stream, DWORD imagetype);
196
CxImage(CxFile * stream, DWORD imagetype);
197
CxImage(BYTE * buffer, DWORD size, DWORD imagetype);
198
virtual ~CxImage() { Destroy(); DestroyGifFrames();};
199
CxImage& operator = (const CxImage&);
202
/** \addtogroup Initialization */ //@{
203
void* Create(DWORD dwWidth, DWORD dwHeight, DWORD wBpp, DWORD imagetype = 0);
205
bool DestroyGifFrames();
206
void Clear(BYTE bval=0);
207
void Copy(const CxImage &src, bool copypixels = true, bool copyselection = true, bool copyalpha = true);
208
bool Transfer(CxImage &from);
209
bool CreateFromArray(BYTE* pArray,DWORD dwWidth,DWORD dwHeight,DWORD dwBitsperpixel, DWORD dwBytesperline, bool bFlipImage);
210
bool CreateFromMatrix(BYTE** ppMatrix,DWORD dwWidth,DWORD dwHeight,DWORD dwBitsperpixel, DWORD dwBytesperline, bool bFlipImage);
211
void FreeMemory(void* memblock);
214
/** \addtogroup Attributes */ //@{
216
BYTE* GetBits(DWORD row = 0);
218
void* GetDIB() const;
219
DWORD GetHeight() const;
220
DWORD GetWidth() const;
221
DWORD GetEffWidth() const;
222
DWORD GetNumColors() const;
224
DWORD GetType() const;
225
const char* GetLastError();
226
const TCHAR* GetVersion();
227
const float GetVersionNumber();
229
DWORD GetFrameDelay() const;
230
void SetFrameDelay(DWORD d);
232
void GetOffset(long *x,long *y);
233
void SetOffset(long x,long y);
235
BYTE GetJpegQuality() const;
236
void SetJpegQuality(BYTE q);
238
BYTE GetJpegScale() const;
239
void SetJpegScale(BYTE q);
241
long GetXDPI() const;
242
long GetYDPI() const;
243
void SetXDPI(long dpi);
244
void SetYDPI(long dpi);
246
DWORD GetClrImportant() const;
247
void SetClrImportant(DWORD ncolors = 0);
249
long GetProgress() const;
250
long GetEscape() const;
251
void SetProgress(long p);
252
void SetEscape(long i);
254
long GetTransIndex() const;
255
RGBQUAD GetTransColor();
256
void SetTransIndex(long idx);
257
void SetTransColor(RGBQUAD rgb);
258
bool IsTransparent() const;
259
void SetDisposalMethod(int dm);
260
long GetDisposalMethod();
262
DWORD GetCodecOption(DWORD imagetype = 0);
263
bool SetCodecOption(DWORD opt, DWORD imagetype = 0);
265
DWORD GetFlags() const;
266
void SetFlags(DWORD flags, bool bLockReservedFlags = true);
268
//void* GetUserData() const {return info.pUserData;}
269
//void SetUserData(void* pUserData) {info.pUserData = pUserData;}
272
/** \addtogroup Palette
273
* These functions have no effects on RGB images and in this case the returned value is always 0.
276
bool IsIndexed() const;
277
bool IsSamePalette(CxImage &img, bool bCheckAlpha = true);
278
DWORD GetPaletteSize();
279
RGBQUAD* GetPalette() const;
280
RGBQUAD GetPaletteColor(BYTE idx);
281
bool GetPaletteColor(BYTE i, BYTE* r, BYTE* g, BYTE* b);
282
BYTE GetNearestIndex(RGBQUAD c);
283
void BlendPalette(COLORREF cr,long perc);
284
void SetGrayPalette();
285
void SetPalette(DWORD n, BYTE *r, BYTE *g, BYTE *b);
286
void SetPalette(RGBQUAD* pPal,DWORD nColors=256);
287
void SetPalette(rgb_color *rgb,DWORD nColors=256);
288
void SetPaletteColor(BYTE idx, BYTE r, BYTE g, BYTE b, BYTE alpha=0);
289
void SetPaletteColor(BYTE idx, RGBQUAD c);
290
void SetPaletteColor(BYTE idx, COLORREF cr);
291
void SwapIndex(BYTE idx1, BYTE idx2);
292
void SetStdPalette();
295
/** \addtogroup Pixel */ //@{
296
bool IsInside(long x, long y);
297
bool IsTransparent(long x,long y);
298
RGBQUAD GetPixelColor(long x,long y, bool bGetAlpha = true);
299
BYTE GetPixelIndex(long x,long y);
300
BYTE GetPixelGray(long x, long y);
301
void SetPixelColor(long x,long y,RGBQUAD c, bool bSetAlpha = false);
302
void SetPixelColor(long x,long y,COLORREF cr);
303
void SetPixelIndex(long x,long y,BYTE i);
304
void DrawLine(int StartX, int EndX, int StartY, int EndY, RGBQUAD color, bool bSetAlpha=false);
305
void DrawLine(int StartX, int EndX, int StartY, int EndY, COLORREF cr);
306
void BlendPixelColor(long x,long y,RGBQUAD c, float blend, bool bSetAlpha = false);
310
/** \addtogroup Protected */ //@{
311
BYTE BlindGetPixelIndex(const long x,const long y);
312
RGBQUAD BlindGetPixelColor(const long x,const long y);
313
void *BlindGetPixelPointer(const long x,const long y);
318
#if CXIMAGE_SUPPORT_INTERPOLATION
319
/** \addtogroup Interpolation */ //@{
321
enum OverflowMethod {
329
void OverflowCoordinates(float &x, float &y, OverflowMethod const ofMethod);
330
void OverflowCoordinates(long &x, long &y, OverflowMethod const ofMethod);
331
RGBQUAD GetPixelColorWithOverflow(long x, long y, OverflowMethod const ofMethod=OM_BACKGROUND, RGBQUAD* const rplColor=0);
332
//interpolation methods:
333
enum InterpolationMethod {
334
IM_NEAREST_NEIGHBOUR=1,
351
RGBQUAD GetPixelColorInterpolated(float x,float y, InterpolationMethod const inMethod=IM_BILINEAR, OverflowMethod const ofMethod=OM_BACKGROUND, RGBQUAD* const rplColor=0);
352
RGBQUAD GetAreaColorInterpolated(float const xc, float const yc, float const w, float const h, InterpolationMethod const inMethod, OverflowMethod const ofMethod=OM_BACKGROUND, RGBQUAD* const rplColor=0);
356
/** \addtogroup Protected */ //@{
357
void AddAveragingCont(RGBQUAD const &color, float const surf, float &rr, float &gg, float &bb, float &aa);
360
/** \addtogroup Kernels */ //@{
362
static float KernelBSpline(const float x);
363
static float KernelLinear(const float t);
364
static float KernelCubic(const float t);
365
static float KernelGeneralizedCubic(const float t, const float a=-1);
366
static float KernelLanczosSinc(const float t, const float r = 3);
367
static float KernelBox(const float x);
368
static float KernelHermite(const float x);
369
static float KernelHamming(const float x);
370
static float KernelSinc(const float x);
371
static float KernelBlackman(const float x);
372
static float KernelBessel_J1(const float x);
373
static float KernelBessel_P1(const float x);
374
static float KernelBessel_Q1(const float x);
375
static float KernelBessel_Order1(float x);
376
static float KernelBessel(const float x);
377
static float KernelGaussian(const float x);
378
static float KernelQuadratic(const float x);
379
static float KernelMitchell(const float x);
380
static float KernelCatrom(const float x);
382
#endif //CXIMAGE_SUPPORT_INTERPOLATION
384
/** \addtogroup Painting */ //@{
385
#if CXIMAGE_SUPPORT_WINCE
386
long Blt(HDC pDC, long x=0, long y=0);
388
#if CXIMAGE_SUPPORT_WINDOWS
389
HBITMAP MakeBitmap(HDC hdc = NULL);
390
HANDLE CopyToHandle();
391
bool CreateFromHANDLE(HANDLE hMem); //Windows objects (clipboard)
392
bool CreateFromHBITMAP(HBITMAP hbmp, HPALETTE hpal=0); //Windows resource
393
bool CreateFromHICON(HICON hico);
394
long Draw(HDC hdc, long x=0, long y=0, long cx = -1, long cy = -1, RECT* pClipRect = 0, bool bSmooth = false);
395
long Draw(HDC hdc, const RECT& rect, RECT* pClipRect=NULL, bool bSmooth = false);
396
long Stretch(HDC hdc, long xoffset, long yoffset, long xsize, long ysize, DWORD dwRop = SRCCOPY);
397
long Stretch(HDC hdc, const RECT& rect, DWORD dwRop = SRCCOPY);
398
long Tile(HDC hdc, RECT *rc);
399
long Draw2(HDC hdc, long x=0, long y=0, long cx = -1, long cy = -1);
400
long Draw2(HDC hdc, const RECT& rect);
401
//long DrawString(HDC hdc, long x, long y, const char* text, RGBQUAD color, const char* font, long lSize=0, long lWeight=400, BYTE bItalic=0, BYTE bUnderline=0, bool bSetAlpha=false);
402
long DrawString(HDC hdc, long x, long y, const TCHAR* text, RGBQUAD color, const TCHAR* font, long lSize=0, long lWeight=400, BYTE bItalic=0, BYTE bUnderline=0, bool bSetAlpha=false);
404
long DrawStringEx(HDC hdc, long x, long y, CXTEXTINFO *pTextType, bool bSetAlpha=false );
405
void InitTextInfo( CXTEXTINFO *txt );
406
#endif //CXIMAGE_SUPPORT_WINDOWS
410
#if CXIMAGE_SUPPORT_DECODE
411
/** \addtogroup Decode */ //@{
413
//bool Load(LPCWSTR filename, DWORD imagetype=0);
414
bool LoadResource(HRSRC hRes, DWORD imagetype, HMODULE hModule=NULL);
416
// For UNICODE support: char -> TCHAR
417
bool Load(const TCHAR* filename, DWORD imagetype=0);
418
//bool Load(const char * filename, DWORD imagetype=0);
419
bool Decode(FILE * hFile, DWORD imagetype);
420
bool Decode(CxFile * hFile, DWORD imagetype);
421
bool Decode(BYTE * buffer, DWORD size, DWORD imagetype);
423
#endif //CXIMAGE_SUPPORT_DECODE
425
#if CXIMAGE_SUPPORT_ENCODE
427
/** \addtogroup Protected */ //@{
428
bool EncodeSafeCheck(CxFile *hFile);
432
/** \addtogroup Encode */ //@{
434
//bool Save(LPCWSTR filename, DWORD imagetype=0);
436
// For UNICODE support: char -> TCHAR
437
bool Save(const TCHAR* filename, DWORD imagetype);
438
//bool Save(const char * filename, DWORD imagetype=0);
439
bool Encode(FILE * hFile, DWORD imagetype);
440
bool Encode(CxFile * hFile, DWORD imagetype);
441
bool Encode(CxFile * hFile, CxImage ** pImages, int pagecount, DWORD imagetype);
442
bool Encode(FILE *hFile, CxImage ** pImages, int pagecount, DWORD imagetype);
443
bool Encode(BYTE * &buffer, long &size, DWORD imagetype);
445
bool Encode2RGBA(CxFile *hFile);
446
bool Encode2RGBA(BYTE * &buffer, long &size);
448
#endif //CXIMAGE_SUPPORT_ENCODE
450
/** \addtogroup Attributes */ //@{
452
bool IsValid() const;
453
bool IsEnabled() const;
454
void Enable(bool enable=true);
457
long GetNumFrames() const;
458
long GetFrame() const;
459
void SetFrame(long nFrame);
461
CxImage * GetFrameNo(long nFrame) const;
462
void RetreiveAllFrame();
463
void RetreiveSingleFrame();
466
#if CXIMAGE_SUPPORT_BASICTRANSFORMATIONS
467
/** \addtogroup BasicTransformations */ //@{
472
bool RotateLeft(CxImage* iDst = NULL);
473
bool RotateRight(CxImage* iDst = NULL);
475
#endif //CXIMAGE_SUPPORT_BASICTRANSFORMATIONS
477
#if CXIMAGE_SUPPORT_TRANSFORMATION
478
/** \addtogroup Transformations */ //@{
480
bool Rotate(float angle, CxImage* iDst = NULL);
481
bool Rotate2(float angle, CxImage *iDst = NULL, InterpolationMethod inMethod=IM_BILINEAR,
482
OverflowMethod ofMethod=OM_BACKGROUND, RGBQUAD *replColor=0,
483
bool const optimizeRightAngles=true, bool const bKeepOriginalSize=false);
484
bool Rotate180(CxImage* iDst = NULL);
485
bool Resample(long newx, long newy, int mode = 1, CxImage* iDst = NULL);
486
bool Resample2(long newx, long newy, InterpolationMethod const inMethod=IM_BICUBIC2,
487
OverflowMethod const ofMethod=OM_REPEAT, CxImage* const iDst = NULL,
488
bool const disableAveraging=false);
489
bool DecreaseBpp(DWORD nbit, bool errordiffusion, RGBQUAD* ppal = 0, DWORD clrimportant = 0);
490
bool IncreaseBpp(DWORD nbit);
491
bool Dither(long method = 0);
492
bool Crop(long left, long top, long right, long bottom, CxImage* iDst = NULL);
493
bool Crop(const RECT& rect, CxImage* iDst = NULL);
494
bool CropRotatedRectangle( long topx, long topy, long width, long height, float angle, CxImage* iDst = NULL);
495
bool Skew(float xgain, float ygain, long xpivot=0, long ypivot=0, bool bEnableInterpolation = false);
496
bool Expand(long left, long top, long right, long bottom, RGBQUAD canvascolor, CxImage* iDst = 0);
497
bool Expand(long newx, long newy, RGBQUAD canvascolor, CxImage* iDst = 0);
498
bool Thumbnail(long newx, long newy, RGBQUAD canvascolor, CxImage* iDst = 0);
499
bool CircleTransform(int type,long rmax=0,float Koeff=1.0f);
501
bool QIShrink(long newx, long newy, CxImage* const iDst = NULL);
503
#endif //CXIMAGE_SUPPORT_TRANSFORMATION
505
#if CXIMAGE_SUPPORT_DSP
506
/** \addtogroup DSP */ //@{
508
bool HistogramStretch(long method = 0);
509
bool HistogramEqualize();
510
bool HistogramNormalize();
511
bool HistogramRoot();
513
long Histogram(long* red, long* green = 0, long* blue = 0, long* gray = 0, long colorspace = 0);
514
bool Jitter(long radius=2);
515
bool Repair(float radius = 0.25f, long niterations = 1, long colorspace = 0);
516
bool Combine(CxImage* r,CxImage* g,CxImage* b,CxImage* a, long colorspace = 0);
517
bool FFT2(CxImage* srcReal, CxImage* srcImag, CxImage* dstReal, CxImage* dstImag, long direction = 1, bool bForceFFT = true, bool bMagnitude = true);
518
bool Noise(long level);
519
bool Median(long Ksize=3);
520
bool Gamma(float gamma);
521
bool ShiftRGB(long r, long g, long b);
522
bool Threshold(BYTE level);
523
bool Colorize(BYTE hue, BYTE sat, float blend = 1.0f);
524
bool Light(long brightness, long contrast = 0);
526
bool Filter(long* kernel, long Ksize, long Kfactor, long Koffset);
527
bool Erode(long Ksize=2);
528
bool Dilate(long Ksize=2);
529
bool Edge(long Ksize=2);
530
void HuePalette(float correction=1);
531
enum ImageOpType { OpAdd, OpAnd, OpXor, OpOr, OpMask, OpSrcCopy, OpDstCopy, OpSub, OpSrcBlend, OpScreen };
532
void Mix(CxImage & imgsrc2, ImageOpType op, long lXOffset = 0, long lYOffset = 0, bool bMixAlpha = false);
533
void MixFrom(CxImage & imagesrc2, long lXOffset, long lYOffset);
534
bool UnsharpMask(float radius = 5.0, float amount = 0.5, int threshold = 0);
535
bool Lut(BYTE* pLut);
536
bool Lut(BYTE* pLutR, BYTE* pLutG, BYTE* pLutB, BYTE* pLutA = 0);
540
/** \addtogroup Protected */ //@{
541
bool IsPowerof2(long x);
542
bool FFT(int dir,int m,double *x,double *y);
543
bool DFT(int dir,long m,double *x1,double *y1,double *x2,double *y2);
544
bool RepairChannel(CxImage *ch, float radius);
546
int gen_convolve_matrix (float radius, float **cmatrix_p);
547
float* gen_lookup_table (float *cmatrix, int cmatrix_length);
548
void blur_line (float *ctable, float *cmatrix, int cmatrix_length, BYTE* cur_col, BYTE* dest_col, int y, long bytes);
552
/** \addtogroup ColorSpace */ //@{
553
bool SplitRGB(CxImage* r,CxImage* g,CxImage* b);
554
bool SplitYUV(CxImage* y,CxImage* u,CxImage* v);
555
bool SplitHSL(CxImage* h,CxImage* s,CxImage* l);
556
bool SplitYIQ(CxImage* y,CxImage* i,CxImage* q);
557
bool SplitXYZ(CxImage* x,CxImage* y,CxImage* z);
558
bool SplitCMYK(CxImage* c,CxImage* m,CxImage* y,CxImage* k);
559
static RGBQUAD HSLtoRGB(COLORREF cHSLColor);
560
static RGBQUAD RGBtoHSL(RGBQUAD lRGBColor);
561
static RGBQUAD HSLtoRGB(RGBQUAD lHSLColor);
562
static RGBQUAD YUVtoRGB(RGBQUAD lYUVColor);
563
static RGBQUAD RGBtoYUV(RGBQUAD lRGBColor);
564
static RGBQUAD YIQtoRGB(RGBQUAD lYIQColor);
565
static RGBQUAD RGBtoYIQ(RGBQUAD lRGBColor);
566
static RGBQUAD XYZtoRGB(RGBQUAD lXYZColor);
567
static RGBQUAD RGBtoXYZ(RGBQUAD lRGBColor);
568
#endif //CXIMAGE_SUPPORT_DSP
569
static RGBQUAD RGBtoRGBQUAD(COLORREF cr);
570
static COLORREF RGBQUADtoRGB (RGBQUAD c);
573
#if CXIMAGE_SUPPORT_SELECTION
574
/** \addtogroup Selection */ //@{
575
bool SelectionClear();
576
bool SelectionCreate();
577
bool SelectionDelete();
578
bool SelectionInvert();
579
bool SelectionAddRect(RECT r);
580
bool SelectionAddEllipse(RECT r);
581
bool SelectionAddPolygon(POINT *points, long npoints);
582
bool SelectionAddColor(RGBQUAD c);
583
bool SelectionAddPixel(int x, int y);
584
bool SelectionCopy(CxImage &from);
585
bool SelectionIsInside(long x, long y);
586
bool SelectionIsValid();
587
void SelectionGetBox(RECT& r);
588
bool SelectionToHRGN(HRGN& region);
589
bool SelectionSplit(CxImage *dest);
591
#endif //CXIMAGE_SUPPORT_SELECTION
593
#if CXIMAGE_SUPPORT_ALPHA
594
/** \addtogroup Alpha */ //@{
601
bool AlphaCopy(CxImage &from);
602
bool AlphaSplit(CxImage *dest);
604
void AlphaSet(BYTE level);
605
bool AlphaSet(CxImage &from);
606
void AlphaSet(const long x,const long y,const BYTE level);
607
BYTE AlphaGet(const long x,const long y);
608
BYTE AlphaGetMax() const;
609
void AlphaSetMax(BYTE nAlphaMax);
611
BYTE* AlphaGetPointer(const long x = 0,const long y = 0);
613
void AlphaPaletteClear();
614
void AlphaPaletteEnable(bool enable=true);
615
bool AlphaPaletteIsEnabled();
616
bool AlphaPaletteIsValid();
617
bool AlphaPaletteSplit(CxImage *dest);
621
/** \addtogroup Protected */ //@{
622
BYTE BlindAlphaGet(const long x,const long y);
624
#endif //CXIMAGE_SUPPORT_ALPHA
627
#if CXIMAGE_SUPPORT_LAYERS
628
/** \addtogroup Layers */ //@{
629
bool LayerCreate(long position = -1);
630
bool LayerDelete(long position = -1);
631
void LayerDeleteAll();
632
CxImage* GetLayer(long position);
633
CxImage* GetParent() const;
634
long GetNumLayers() const;
636
#endif //CXIMAGE_SUPPORT_LAYERS
639
/** \addtogroup Protected */ //@{
640
void Startup(DWORD imagetype = 0);
641
void CopyInfo(const CxImage &src);
642
void Ghost(CxImage *src);
643
void RGBtoBGR(BYTE *buffer, int length);
644
static float HueToRGB(float n1,float n2, float hue);
645
void Bitfield2RGB(BYTE *src, WORD redmask, WORD greenmask, WORD bluemask, BYTE bpp);
646
static int CompareColors(const void *elem1, const void *elem2);
648
void* pDib; //contains the header, the palette, the pixels
649
BITMAPINFOHEADER head; //standard header
650
CXIMAGEINFO info; //extended information
651
BYTE* pSelection; //selected region
652
BYTE* pAlpha; //alpha channel
653
CxImage** pLayers; //generic layers
657
////////////////////////////////////////////////////////////////////////////
658
#endif // !defined(__CXIMAGE_H)