| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef _FPDF_DIB_H_ | 7 #ifndef _FPDF_DIB_H_ |
| 8 #define _FPDF_DIB_H_ | 8 #define _FPDF_DIB_H_ |
| 9 #ifndef _FXCRT_EXTENSION_ | 9 #ifndef _FXCRT_EXTENSION_ |
| 10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
| 11 #endif | 11 #endif |
| 12 enum FXDIB_Format { | 12 enum FXDIB_Format { |
| 13 FXDIB_Invalid = 0, | 13 FXDIB_Invalid = 0, |
| 14 FXDIB_1bppMask = 0x101, | 14 FXDIB_1bppMask = 0x101, |
| 15 FXDIB_1bppRgb = 0x001, | 15 FXDIB_1bppRgb = 0x001, |
| 16 FXDIB_1bppCmyk = 0x401, | 16 FXDIB_1bppCmyk = 0x401, |
| 17 FXDIB_8bppMask = 0x108, | 17 FXDIB_8bppMask = 0x108, |
| 18 FXDIB_8bppRgb = 0x008, | 18 FXDIB_8bppRgb = 0x008, |
| 19 FXDIB_8bppRgba = 0x208, | 19 FXDIB_8bppRgba = 0x208, |
| 20 FXDIB_8bppCmyk = 0x408, | 20 FXDIB_8bppCmyk = 0x408, |
| 21 FXDIB_8bppCmyka = 0x608, | 21 FXDIB_8bppCmyka = 0x608, |
| 22 FXDIB_Rgb = 0x018, | 22 FXDIB_Rgb = 0x018, |
| 23 FXDIB_Rgba = 0x218, | 23 FXDIB_Rgba = 0x218, |
| 24 FXDIB_Rgb32 = 0x020, | 24 FXDIB_Rgb32 = 0x020, |
| 25 FXDIB_Argb = 0x220, | 25 FXDIB_Argb = 0x220, |
| 26 FXDIB_Cmyk = 0x420, | 26 FXDIB_Cmyk = 0x420, |
| 27 FXDIB_Cmyka = 0x620, | 27 FXDIB_Cmyka = 0x620, |
| 28 }; | 28 }; |
| 29 enum FXDIB_Channel { | 29 enum FXDIB_Channel { |
| 30 FXDIB_Red = 1, | 30 FXDIB_Red = 1, |
| 31 FXDIB_Green, | 31 FXDIB_Green, |
| 32 FXDIB_Blue, | 32 FXDIB_Blue, |
| 33 FXDIB_Cyan, | 33 FXDIB_Cyan, |
| 34 FXDIB_Magenta, | 34 FXDIB_Magenta, |
| 35 FXDIB_Yellow, | 35 FXDIB_Yellow, |
| 36 FXDIB_Black, | 36 FXDIB_Black, |
| 37 FXDIB_Alpha | 37 FXDIB_Alpha |
| 38 }; | 38 }; |
| 39 #define FXDIB_DOWNSAMPLE» » 0x04 | 39 #define FXDIB_DOWNSAMPLE 0x04 |
| 40 #define FXDIB_INTERPOL» » » 0x20 | 40 #define FXDIB_INTERPOL 0x20 |
| 41 #define FXDIB_BICUBIC_INTERPOL 0x80 | 41 #define FXDIB_BICUBIC_INTERPOL 0x80 |
| 42 #define FXDIB_NOSMOOTH» » » 0x100 | 42 #define FXDIB_NOSMOOTH 0x100 |
| 43 #define FXDIB_PALETTE_LOC» » 0x01 | 43 #define FXDIB_PALETTE_LOC 0x01 |
| 44 #define FXDIB_PALETTE_WIN» » 0x02 | 44 #define FXDIB_PALETTE_WIN 0x02 |
| 45 #define FXDIB_PALETTE_MAC» » 0x04 | 45 #define FXDIB_PALETTE_MAC 0x04 |
| 46 #define FXDIB_BLEND_NORMAL» » » 0 | 46 #define FXDIB_BLEND_NORMAL 0 |
| 47 #define FXDIB_BLEND_MULTIPLY» » 1 | 47 #define FXDIB_BLEND_MULTIPLY 1 |
| 48 #define FXDIB_BLEND_SCREEN» » » 2 | 48 #define FXDIB_BLEND_SCREEN 2 |
| 49 #define FXDIB_BLEND_OVERLAY» » » 3 | 49 #define FXDIB_BLEND_OVERLAY 3 |
| 50 #define FXDIB_BLEND_DARKEN» » » 4 | 50 #define FXDIB_BLEND_DARKEN 4 |
| 51 #define FXDIB_BLEND_LIGHTEN» » » 5 | 51 #define FXDIB_BLEND_LIGHTEN 5 |
| 52 | 52 |
| 53 #define FXDIB_BLEND_COLORDODGE» » 6 | 53 #define FXDIB_BLEND_COLORDODGE 6 |
| 54 #define FXDIB_BLEND_COLORBURN» » 7 | 54 #define FXDIB_BLEND_COLORBURN 7 |
| 55 #define FXDIB_BLEND_HARDLIGHT» » 8 | 55 #define FXDIB_BLEND_HARDLIGHT 8 |
| 56 #define FXDIB_BLEND_SOFTLIGHT» » 9 | 56 #define FXDIB_BLEND_SOFTLIGHT 9 |
| 57 #define FXDIB_BLEND_DIFFERENCE» » 10 | 57 #define FXDIB_BLEND_DIFFERENCE 10 |
| 58 #define FXDIB_BLEND_EXCLUSION» » 11 | 58 #define FXDIB_BLEND_EXCLUSION 11 |
| 59 #define FXDIB_BLEND_NONSEPARABLE» 21 | 59 #define FXDIB_BLEND_NONSEPARABLE 21 |
| 60 #define FXDIB_BLEND_HUE»» » » 21 | 60 #define FXDIB_BLEND_HUE 21 |
| 61 #define FXDIB_BLEND_SATURATION» » 22 | 61 #define FXDIB_BLEND_SATURATION 22 |
| 62 #define FXDIB_BLEND_COLOR» » » 23 | 62 #define FXDIB_BLEND_COLOR 23 |
| 63 #define FXDIB_BLEND_LUMINOSITY» » 24 | 63 #define FXDIB_BLEND_LUMINOSITY 24 |
| 64 #define FXDIB_BLEND_UNSUPPORTED»» -1 | 64 #define FXDIB_BLEND_UNSUPPORTED -1 |
| 65 typedef FX_DWORD» FX_ARGB; | 65 typedef FX_DWORD FX_ARGB; |
| 66 typedef FX_DWORD» FX_COLORREF; | 66 typedef FX_DWORD FX_COLORREF; |
| 67 typedef FX_DWORD» FX_CMYK; | 67 typedef FX_DWORD FX_CMYK; |
| 68 class CFX_ClipRgn; | 68 class CFX_ClipRgn; |
| 69 class CFX_DIBSource; | 69 class CFX_DIBSource; |
| 70 class CFX_DIBitmap; | 70 class CFX_DIBitmap; |
| 71 #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) | 71 #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) |
| 72 #define FXSYS_GetRValue(rgb) ((rgb) & 0xff) | 72 #define FXSYS_GetRValue(rgb) ((rgb)&0xff) |
| 73 #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) | 73 #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) |
| 74 #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) | 74 #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) |
| 75 #define FX_CCOLOR(val) (255-(val)) | 75 #define FX_CCOLOR(val) (255 - (val)) |
| 76 #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) | 76 #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) |
| 77 #define FXSYS_GetCValue(cmyk) ((FX_BYTE)((cmyk) >> 24) & 0xff) | 77 #define FXSYS_GetCValue(cmyk) ((FX_BYTE)((cmyk) >> 24) & 0xff) |
| 78 #define FXSYS_GetMValue(cmyk) ((FX_BYTE)((cmyk) >> 16) & 0xff) | 78 #define FXSYS_GetMValue(cmyk) ((FX_BYTE)((cmyk) >> 16) & 0xff) |
| 79 #define FXSYS_GetYValue(cmyk) ((FX_BYTE)((cmyk) >> 8) & 0xff) | 79 #define FXSYS_GetYValue(cmyk) ((FX_BYTE)((cmyk) >> 8) & 0xff) |
| 80 #define FXSYS_GetKValue(cmyk) ((FX_BYTE)(cmyk) & 0xff) | 80 #define FXSYS_GetKValue(cmyk) ((FX_BYTE)(cmyk) & 0xff) |
| 81 void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); | 81 void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); |
| 82 inline FX_CMYK CmykEncode(int c, int m, int y, int k) | 82 inline FX_CMYK CmykEncode(int c, int m, int y, int k) { |
| 83 { | 83 return (c << 24) | (m << 16) | (y << 8) | k; |
| 84 return (c << 24) | (m << 16) | (y << 8) | k; | |
| 85 } | 84 } |
| 86 void ArgbDecode(FX_ARGB argb, int& a, int& r, int&g, int& b); | 85 void ArgbDecode(FX_ARGB argb, int& a, int& r, int& g, int& b); |
| 87 void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); | 86 void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); |
| 88 inline FX_ARGB ArgbEncode(int a, int r, int g, int b) | 87 inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { |
| 89 { | 88 return (a << 24) | (r << 16) | (g << 8) | b; |
| 90 return (a << 24) | (r << 16) | (g << 8) | b; | |
| 91 } | 89 } |
| 92 FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); | 90 FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); |
| 93 #define FXARGB_A(argb) ((FX_BYTE)((argb) >> 24)) | 91 #define FXARGB_A(argb) ((FX_BYTE)((argb) >> 24)) |
| 94 #define FXARGB_R(argb) ((FX_BYTE)((argb) >> 16)) | 92 #define FXARGB_R(argb) ((FX_BYTE)((argb) >> 16)) |
| 95 #define FXARGB_G(argb) ((FX_BYTE)((argb) >> 8)) | 93 #define FXARGB_G(argb) ((FX_BYTE)((argb) >> 8)) |
| 96 #define FXARGB_B(argb) ((FX_BYTE)(argb)) | 94 #define FXARGB_B(argb) ((FX_BYTE)(argb)) |
| 97 #define FXARGB_MAKE(a,r,g,b) (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) |
(b)) | 95 #define FXARGB_MAKE(a, r, g, b) \ |
| 98 #define FXARGB_MUL_ALPHA(argb, alpha) (((((argb) >> 24) * (alpha) / 255) << 24)
| ((argb) & 0xffffff)) | 96 (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) |
| 99 #define FXRGB2GRAY(r,g,b) (((b) * 11 + (g) * 59 + (r) * 30) / 100) | 97 #define FXARGB_MUL_ALPHA(argb, alpha) \ |
| 100 #define FXCMYK2GRAY(c,m,y,k) (((255-(c)) * (255-(k)) * 30 + (255-(m)) * (255-(k)
) * 59 + (255-(y)) * (255-(k)) * 11) / 25500) | 98 (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) |
| 101 #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) (((backdrop) * (255-(s
ource_alpha)) + (source)*(source_alpha))/255) | 99 #define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) |
| 102 #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest)*(src)/255) | 100 #define FXCMYK2GRAY(c, m, y, k) \ |
| 103 #define FXCMYK_GETDIB(p) ((((FX_LPBYTE)(p))[0] << 24 | (((FX_LPBYTE)(p))[1] << 1
6) | (((FX_LPBYTE)(p))[2] << 8) | ((FX_LPBYTE)(p))[3])) | 101 (((255 - (c)) * (255 - (k)) * 30 + (255 - (m)) * (255 - (k)) * 59 + \ |
| 102 (255 - (y)) * (255 - (k)) * 11) / \ |
| 103 25500) |
| 104 #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) \ |
| 105 (((backdrop) * (255 - (source_alpha)) + (source) * (source_alpha)) / 255) |
| 106 #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) |
| 107 #define FXCMYK_GETDIB(p) \ |
| 108 ((((FX_LPBYTE)(p))[0] << 24 | (((FX_LPBYTE)(p))[1] << 16) | \ |
| 109 (((FX_LPBYTE)(p))[2] << 8) | ((FX_LPBYTE)(p))[3])) |
| 104 #define FXCMYK_SETDIB(p, cmyk) ((FX_LPBYTE)(p))[0] = (FX_BYTE)((cmyk) >> 24), \ | 110 #define FXCMYK_SETDIB(p, cmyk) ((FX_LPBYTE)(p))[0] = (FX_BYTE)((cmyk) >> 24), \ |
| 105 ((FX_LPBYTE)(p))[1] = (FX_BYTE)((cmyk) >> 16), \ | 111 ((FX_LPBYTE)(p))[1] = (FX_BYTE)((cmyk) >> 16), \ |
| 106 ((FX_LPBYTE)(p))[2] = (FX_BYTE)((cmyk) >> 8), \ | 112 ((FX_LPBYTE)(p))[2] = (FX_BYTE)((cmyk) >> 8), \ |
| 107 ((FX_LPBYTE)(p))[3] = (FX_BYTE)(cmyk)) | 113 ((FX_LPBYTE)(p))[3] = (FX_BYTE)(cmyk)) |
| 108 #define FXARGB_GETDIB(p) (((FX_LPBYTE)(p))[0]) | (((FX_LPBYTE)(p))[1] << 8) | ((
(FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[3] << 24) | 114 #define FXARGB_GETDIB(p) \ |
| 109 #define FXARGB_SETDIB(p, argb) ((FX_LPBYTE)(p))[0] = (FX_BYTE)(argb), \ | 115 (((FX_LPBYTE)(p))[0]) | (((FX_LPBYTE)(p))[1] << 8) | \ |
| 110 ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ | 116 (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[3] << 24) |
| 111 ((FX_LPBYTE)(p))[2] = (FX_BYTE)((argb) >> 16), \ | 117 #define FXARGB_SETDIB(p, argb) \ |
| 112 ((FX_LPBYTE)(p))[3] = (FX_BYTE)((argb) >>
24) | 118 ((FX_LPBYTE)(p))[0] = (FX_BYTE)(argb), \ |
| 113 #define FXARGB_COPY(dest, src) *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ | 119 ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ |
| 114 *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ | 120 ((FX_LPBYTE)(p))[2] = (FX_BYTE)((argb) >> 16), \ |
| 115 *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)+2),
\ | 121 ((FX_LPBYTE)(p))[3] = (FX_BYTE)((argb) >> 24) |
| 116 *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(
src)+3) | 122 #define FXARGB_COPY(dest, src) \ |
| 117 #define FXCMYK_COPY(dest, src) *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ | 123 *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ |
| 118 *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ | 124 *((FX_LPBYTE)(dest) + 1) = *((FX_LPBYTE)(src) + 1), \ |
| 119 *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)+2),
\ | 125 *((FX_LPBYTE)(dest) + 2) = *((FX_LPBYTE)(src) + 2), \ |
| 120 *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(
src)+3) | 126 *((FX_LPBYTE)(dest) + 3) = *((FX_LPBYTE)(src) + 3) |
| 121 #define FXARGB_SETRGBORDERDIB(p, argb) ((FX_LPBYTE)(p))[3] = (FX_BYTE)(argb>>24)
, \ | 127 #define FXCMYK_COPY(dest, src) \ |
| 122 ((FX_LPBYTE)(p))[0] = (FX_BYTE)((argb) >> 16), \ | 128 *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ |
| 123 ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ | 129 *((FX_LPBYTE)(dest) + 1) = *((FX_LPBYTE)(src) + 1), \ |
| 124 ((FX_LPBYTE)(p))[2] = (FX_BYTE)(argb) | 130 *((FX_LPBYTE)(dest) + 2) = *((FX_LPBYTE)(src) + 2), \ |
| 125 #define FXARGB_GETRGBORDERDIB(p) (((FX_LPBYTE)(p))[2]) | (((FX_LPBYTE)(p))[1] <<
8) | (((FX_LPBYTE)(p))[0] << 16) | (((FX_LPBYTE)(p))[3] << 24) | 131 *((FX_LPBYTE)(dest) + 3) = *((FX_LPBYTE)(src) + 3) |
| 126 #define FXARGB_RGBORDERCOPY(dest, src) *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(sr
c)+3), \ | 132 #define FXARGB_SETRGBORDERDIB(p, argb) \ |
| 127 *(FX_LPBYTE)(dest) = *((FX_LPBYTE)(src)+2), \ | 133 ((FX_LPBYTE)(p))[3] = (FX_BYTE)(argb >> 24), \ |
| 128 *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ | 134 ((FX_LPBYTE)(p))[0] = (FX_BYTE)((argb) >> 16), \ |
| 129 *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)
) | 135 ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ |
| 136 ((FX_LPBYTE)(p))[2] = (FX_BYTE)(argb) |
| 137 #define FXARGB_GETRGBORDERDIB(p) \ |
| 138 (((FX_LPBYTE)(p))[2]) | (((FX_LPBYTE)(p))[1] << 8) | \ |
| 139 (((FX_LPBYTE)(p))[0] << 16) | (((FX_LPBYTE)(p))[3] << 24) |
| 140 #define FXARGB_RGBORDERCOPY(dest, src) \ |
| 141 *((FX_LPBYTE)(dest) + 3) = *((FX_LPBYTE)(src) + 3), \ |
| 142 *(FX_LPBYTE)(dest) = *((FX_LPBYTE)(src) + 2), \ |
| 143 *((FX_LPBYTE)(dest) + 1) = *((FX_LPBYTE)(src) + 1), \ |
| 144 *((FX_LPBYTE)(dest) + 2) = *((FX_LPBYTE)(src)) |
| 130 #define FXARGB_TODIB(argb) (argb) | 145 #define FXARGB_TODIB(argb) (argb) |
| 131 #define FXCMYK_TODIB(cmyk) ((FX_BYTE)((cmyk) >> 24) | ((FX_BYTE)((cmyk) >> 16))
<< 8 | ((FX_BYTE)((cmyk) >> 8)) << 16 | ((FX_BYTE)(cmyk) << 24)) | 146 #define FXCMYK_TODIB(cmyk) \ |
| 132 #define FXARGB_TOBGRORDERDIB(argb) ((FX_BYTE)(argb>>16) | ((FX_BYTE)(argb>>8)) <
< 8 | ((FX_BYTE)(argb)) << 16 | ((FX_BYTE)(argb>>24) << 24)) | 147 ((FX_BYTE)((cmyk) >> 24) | ((FX_BYTE)((cmyk) >> 16)) << 8 | \ |
| 133 #define FXGETFLAG_COLORTYPE(flag) (FX_BYTE)((flag)>>8) | 148 ((FX_BYTE)((cmyk) >> 8)) << 16 | ((FX_BYTE)(cmyk) << 24)) |
| 134 #define FXGETFLAG_ALPHA_FILL(flag) (FX_BYTE)(flag) | 149 #define FXARGB_TOBGRORDERDIB(argb) \ |
| 135 #define FXGETFLAG_ALPHA_STROKE(flag) (FX_BYTE)((flag)>>16) | 150 ((FX_BYTE)(argb >> 16) | ((FX_BYTE)(argb >> 8)) << 8 | \ |
| 136 #define FXSETFLAG_COLORTYPE(flag, val) flag = (((val)<<8)|(flag&0xffff0
0ff)) | 151 ((FX_BYTE)(argb)) << 16 | ((FX_BYTE)(argb >> 24) << 24)) |
| 137 #define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val)|(flag&0xffffff00)) | 152 #define FXGETFLAG_COLORTYPE(flag) (FX_BYTE)((flag) >> 8) |
| 138 #define FXSETFLAG_ALPHA_STROKE(flag, val) flag = (((val)<<16)|(flag&0xff00
ffff)) | 153 #define FXGETFLAG_ALPHA_FILL(flag) (FX_BYTE)(flag) |
| 139 class CFX_DIBSource : public CFX_Object | 154 #define FXGETFLAG_ALPHA_STROKE(flag) (FX_BYTE)((flag) >> 16) |
| 140 { | 155 #define FXSETFLAG_COLORTYPE(flag, val) \ |
| 141 public: | 156 flag = (((val) << 8) | (flag & 0xffff00ff)) |
| 142 | 157 #define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val) | (flag & 0xffffff00)) |
| 143 virtual ~CFX_DIBSource(); | 158 #define FXSETFLAG_ALPHA_STROKE(flag, val) \ |
| 144 | 159 flag = (((val) << 16) | (flag & 0xff00ffff)) |
| 145 | 160 class CFX_DIBSource : public CFX_Object { |
| 146 | 161 public: |
| 147 int GetWidth() const | 162 virtual ~CFX_DIBSource(); |
| 148 { | 163 |
| 149 return m_Width; | 164 int GetWidth() const { return m_Width; } |
| 150 } | 165 |
| 151 | 166 int GetHeight() const { return m_Height; } |
| 152 int GetHeight() const | 167 |
| 153 { | 168 FXDIB_Format GetFormat() const { |
| 154 return m_Height; | 169 return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); |
| 155 } | 170 } |
| 156 | 171 |
| 157 FXDIB_Format GetFormat() const | 172 FX_DWORD GetPitch() const { return m_Pitch; } |
| 158 { | 173 |
| 159 return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); | 174 FX_DWORD* GetPalette() const { return m_pPalette; } |
| 160 } | 175 |
| 161 | 176 virtual FX_LPBYTE GetBuffer() const { return NULL; } |
| 162 FX_DWORD GetPitch() const | 177 |
| 163 { | 178 virtual FX_LPCBYTE GetScanline(int line) const = 0; |
| 164 return m_Pitch; | 179 |
| 165 } | 180 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const { |
| 166 | 181 return FALSE; |
| 167 FX_DWORD* GetPalette() const | 182 } |
| 168 { | 183 |
| 169 return m_pPalette; | 184 virtual void DownSampleScanline(int line, |
| 170 } | 185 FX_LPBYTE dest_scan, |
| 171 | 186 int dest_bpp, |
| 172 | 187 int dest_width, |
| 173 | 188 FX_BOOL bFlipX, |
| 174 virtual FX_LPBYTE GetBuffer() const | 189 int clip_left, |
| 175 { | 190 int clip_width) const = 0; |
| 176 return NULL; | 191 |
| 177 } | 192 virtual void SetDownSampleSize(int width, int height) const {} |
| 178 | 193 |
| 179 virtual FX_LPCBYTE GetScanline(int line) const = 0; | 194 int GetBPP() const { return m_bpp; } |
| 180 | 195 |
| 181 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) cons
t | 196 FX_BOOL IsAlphaMask() const { return m_AlphaFlag == 1; } |
| 182 { | 197 |
| 183 return FALSE; | 198 FX_BOOL HasAlpha() const { return m_AlphaFlag & 2 ? TRUE : FALSE; } |
| 184 } | 199 |
| 185 | 200 FX_BOOL IsOpaqueImage() const { return !(m_AlphaFlag & 3); } |
| 186 virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan
, int dest_bpp, | 201 |
| 187 int dest_width, FX_BOOL bFlipX, int c
lip_left, int clip_width) const = 0; | 202 FX_BOOL IsCmykImage() const { return m_AlphaFlag & 4 ? TRUE : FALSE; } |
| 188 | 203 |
| 189 virtual void SetDownSampleSize(int width, int height) const {
} | 204 int GetPaletteSize() const { |
| 190 | 205 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); |
| 191 int GetBPP() const | 206 } |
| 192 { | 207 |
| 193 return m_bpp; | 208 FX_DWORD GetPaletteEntry(int index) const; |
| 194 } | 209 |
| 195 | 210 void SetPaletteEntry(int index, FX_DWORD color); |
| 196 FX_BOOL IsAlphaMask() const | 211 FX_DWORD GetPaletteArgb(int index) const { return GetPaletteEntry(index); } |
| 197 { | 212 void SetPaletteArgb(int index, FX_DWORD color) { |
| 198 return m_AlphaFlag == 1; | 213 SetPaletteEntry(index, color); |
| 199 } | 214 } |
| 200 | 215 |
| 201 FX_BOOL HasAlpha() const | 216 void CopyPalette(const FX_DWORD* pSrcPal, FX_DWORD size = 256); |
| 202 { | 217 |
| 203 return m_AlphaFlag & 2 ? TRUE : FALSE; | 218 CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; |
| 204 } | 219 |
| 205 | 220 CFX_DIBitmap* CloneConvert(FXDIB_Format format, |
| 206 FX_BOOL IsOpaqueImage() const | 221 const FX_RECT* pClip = NULL, |
| 207 { | 222 void* pIccTransform = NULL) const; |
| 208 return !(m_AlphaFlag & 3); | 223 |
| 209 } | 224 CFX_DIBitmap* StretchTo(int dest_width, |
| 210 | 225 int dest_height, |
| 211 FX_BOOL IsCmykImage() const | 226 FX_DWORD flags = 0, |
| 212 { | 227 const FX_RECT* pClip = NULL) const; |
| 213 return m_AlphaFlag & 4 ? TRUE : FALSE; | 228 |
| 214 } | 229 CFX_DIBitmap* TransformTo(const CFX_AffineMatrix* pMatrix, |
| 215 | 230 int& left, |
| 216 | 231 int& top, |
| 217 | 232 FX_DWORD flags = 0, |
| 218 int GetPaletteSize() const | 233 const FX_RECT* pClip = NULL) const; |
| 219 { | 234 |
| 220 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); | 235 CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; |
| 221 } | 236 |
| 222 | 237 FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask, |
| 223 FX_DWORD GetPaletteEntry(int index) const; | 238 const FX_RECT* pClip = NULL); |
| 224 | 239 |
| 225 void SetPaletteEntry(int index, FX_DWORD color); | 240 CFX_DIBitmap* SwapXY(FX_BOOL bXFlip, |
| 226 FX_DWORD GetPaletteArgb(int index) const | 241 FX_BOOL bYFlip, |
| 227 { | 242 const FX_RECT* pClip = NULL) const; |
| 228 return GetPaletteEntry(index); | 243 |
| 229 } | 244 CFX_DIBitmap* FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const; |
| 230 void SetPaletteArgb(int index, FX_DWORD color) | 245 |
| 231 { | 246 void GetOverlapRect(int& dest_left, |
| 232 SetPaletteEntry(index, color); | 247 int& dest_top, |
| 233 } | 248 int& width, |
| 234 | 249 int& height, |
| 235 void CopyPalette(const FX_DWORD* pSrcPal, FX_DWORD si
ze = 256); | 250 int src_width, |
| 236 | 251 int src_height, |
| 237 | 252 int& src_left, |
| 238 CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; | 253 int& src_top, |
| 239 | 254 const CFX_ClipRgn* pClipRgn); |
| 240 CFX_DIBitmap* CloneConvert(FXDIB_Format format, const FX_RECT* pClip =
NULL, void* pIccTransform = NULL) const; | 255 |
| 241 | 256 CFX_DIBitmap* m_pAlphaMask; |
| 242 CFX_DIBitmap* StretchTo(int dest_width, int dest_height, FX_DWORD flag
s = 0, const FX_RECT* pClip = NULL) const; | 257 |
| 243 | 258 protected: |
| 244 | 259 CFX_DIBSource(); |
| 245 CFX_DIBitmap* TransformTo(const CFX_AffineMatrix* pMatrix, int& left,
int &top, | 260 |
| 246 FX_DWORD flags = 0, const FX_RECT* pClip = NULL)
const; | 261 int m_Width; |
| 247 | 262 |
| 248 CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; | 263 int m_Height; |
| 249 | 264 |
| 250 FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask, c
onst FX_RECT* pClip = NULL); | 265 int m_bpp; |
| 251 | 266 |
| 252 CFX_DIBitmap* SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_RECT* pC
lip = NULL) const; | 267 FX_DWORD m_AlphaFlag; |
| 253 | 268 |
| 254 CFX_DIBitmap* FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const; | 269 FX_DWORD m_Pitch; |
| 255 | 270 |
| 256 void GetOverlapRect(int& dest_left, int& dest_top, in
t& width, int& height, int src_width, | 271 FX_DWORD* m_pPalette; |
| 257 int src_height, int& src_left, int& src_top,
const CFX_ClipRgn* pClipRgn); | 272 |
| 258 | 273 void BuildPalette(); |
| 259 CFX_DIBitmap* m_pAlphaMask; | 274 |
| 260 protected: | 275 FX_BOOL BuildAlphaMask(); |
| 261 | 276 |
| 262 CFX_DIBSource(); | 277 int FindPalette(FX_DWORD color) const; |
| 263 | 278 |
| 264 int m_Width; | 279 void GetPalette(FX_DWORD* pal, int alpha) const; |
| 265 | 280 }; |
| 266 int m_Height; | 281 class CFX_DIBitmap : public CFX_DIBSource { |
| 267 | 282 public: |
| 268 int m_bpp; | 283 virtual ~CFX_DIBitmap(); |
| 269 | 284 |
| 270 FX_DWORD m_AlphaFlag; | 285 CFX_DIBitmap(); |
| 271 | 286 |
| 272 FX_DWORD m_Pitch; | 287 CFX_DIBitmap(const CFX_DIBitmap& src); |
| 273 | 288 |
| 274 FX_DWORD* m_pPalette; | 289 FX_BOOL Create(int width, |
| 275 | 290 int height, |
| 276 void BuildPalette(); | 291 FXDIB_Format format, |
| 277 | 292 FX_LPBYTE pBuffer = NULL, |
| 278 FX_BOOL BuildAlphaMask(); | 293 int pitch = 0); |
| 279 | 294 |
| 280 int FindPalette(FX_DWORD color) const; | 295 FX_BOOL Copy(const CFX_DIBSource* pSrc); |
| 281 | 296 |
| 282 void GetPalette(FX_DWORD* pal, int alpha) const; | 297 virtual FX_LPBYTE GetBuffer() const { return m_pBuffer; } |
| 283 }; | 298 |
| 284 class CFX_DIBitmap : public CFX_DIBSource | 299 virtual FX_LPCBYTE GetScanline(int line) const { |
| 285 { | 300 return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL; |
| 286 public: | 301 } |
| 287 | 302 |
| 288 virtual ~CFX_DIBitmap(); | 303 virtual void DownSampleScanline(int line, |
| 289 | 304 FX_LPBYTE dest_scan, |
| 290 CFX_DIBitmap(); | 305 int dest_bpp, |
| 291 | 306 int dest_width, |
| 292 CFX_DIBitmap(const CFX_DIBitmap& src); | 307 FX_BOOL bFlipX, |
| 293 | 308 int clip_left, |
| 294 FX_BOOL Create(int width, int height, FXDIB_Format forma
t, FX_LPBYTE pBuffer = NULL, int pitch = 0); | 309 int clip_width) const; |
| 295 | 310 |
| 296 FX_BOOL Copy(const CFX_DIBSource* pSrc); | 311 void TakeOver(CFX_DIBitmap* pSrcBitmap); |
| 297 | 312 |
| 298 virtual FX_LPBYTE GetBuffer() const | 313 FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); |
| 299 { | 314 |
| 300 return m_pBuffer; | 315 void Clear(FX_DWORD color); |
| 301 } | 316 |
| 302 | 317 FX_DWORD GetPixel(int x, int y) const; |
| 303 virtual FX_LPCBYTE GetScanline(int line) const | 318 |
| 304 { | 319 void SetPixel(int x, int y, FX_DWORD color); |
| 305 return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL; | 320 |
| 306 } | 321 FX_BOOL LoadChannel(FXDIB_Channel destChannel, |
| 307 | 322 const CFX_DIBSource* pSrcBitmap, |
| 308 virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int de
st_bpp, | 323 FXDIB_Channel srcChannel); |
| 309 int dest_width, FX_BOOL bFlipX, int clip_
left, int clip_width) const; | 324 |
| 310 | 325 FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value); |
| 311 void TakeOver(CFX_DIBitmap* pSrcBitmap); | 326 |
| 312 | 327 FX_BOOL MultiplyAlpha(int alpha); |
| 313 FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTra
nsform = NULL); | 328 |
| 314 | 329 FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask); |
| 315 void Clear(FX_DWORD color); | 330 |
| 316 | 331 FX_BOOL TransferBitmap(int dest_left, |
| 317 FX_DWORD GetPixel(int x, int y) const; | 332 int dest_top, |
| 318 | 333 int width, |
| 319 void SetPixel(int x, int y, FX_DWORD color); | 334 int height, |
| 320 | 335 const CFX_DIBSource* pSrcBitmap, |
| 321 FX_BOOL LoadChannel(FXDIB_Channel destChannel, const CFX
_DIBSource* pSrcBitmap, FXDIB_Channel srcChannel); | 336 int src_left, |
| 322 | 337 int src_top, |
| 323 FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value
); | 338 void* pIccTransform = NULL); |
| 324 | 339 |
| 325 FX_BOOL MultiplyAlpha(int alpha); | 340 FX_BOOL CompositeBitmap(int dest_left, |
| 326 | 341 int dest_top, |
| 327 FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask); | 342 int width, |
| 328 | 343 int height, |
| 329 FX_BOOL TransferBitmap(int dest_left, int dest_top, int
width, int height, | 344 const CFX_DIBSource* pSrcBitmap, |
| 330 const CFX_DIBSource* pSrcBitmap, int src_left
, int src_top, void* pIccTransform = NULL); | 345 int src_left, |
| 331 | 346 int src_top, |
| 332 FX_BOOL CompositeBitmap(int dest_left, int dest_top, int
width, int height, | 347 int blend_type = FXDIB_BLEND_NORMAL, |
| 333 const CFX_DIBSource* pSrcBitmap, int src_lef
t, int src_top, | 348 const CFX_ClipRgn* pClipRgn = NULL, |
| 334 int blend_type = FXDIB_BLEND_NORMAL, const C
FX_ClipRgn* pClipRgn = NULL, FX_BOOL bRgbByteOrder = FALSE, void* pIccTransform
= NULL); | 349 FX_BOOL bRgbByteOrder = FALSE, |
| 335 | 350 void* pIccTransform = NULL); |
| 336 FX_BOOL TransferMask(int dest_left, int dest_top, int wi
dth, int height, | 351 |
| 337 const CFX_DIBSource* pMask, FX_DWORD color, int
src_left, int src_top, int alpha_flag = 0, void* pIccTransform = NULL); | 352 FX_BOOL TransferMask(int dest_left, |
| 338 | 353 int dest_top, |
| 339 FX_BOOL CompositeMask(int dest_left, int dest_top, int w
idth, int height, | 354 int width, |
| 340 const CFX_DIBSource* pMask, FX_DWORD color, in
t src_left, int src_top, | 355 int height, |
| 341 int blend_type = FXDIB_BLEND_NORMAL, const CFX
_ClipRgn* pClipRgn = NULL, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, vo
id* pIccTransform = NULL); | 356 const CFX_DIBSource* pMask, |
| 342 | 357 FX_DWORD color, |
| 343 FX_BOOL CompositeRect(int dest_left, int dest_top, int w
idth, int height, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL
); | 358 int src_left, |
| 344 | 359 int src_top, |
| 345 FX_BOOL ConvertColorScale(FX_DWORD forecolor, FX_DWORD b
ackcolor); | 360 int alpha_flag = 0, |
| 346 | 361 void* pIccTransform = NULL); |
| 347 FX_BOOL DitherFS(const FX_DWORD* pPalette, int pal_size,
const FX_RECT* pRect = NULL); | 362 |
| 348 protected: | 363 FX_BOOL CompositeMask(int dest_left, |
| 349 | 364 int dest_top, |
| 350 FX_LPBYTE m_pBuffer; | 365 int width, |
| 351 | 366 int height, |
| 352 FX_BOOL m_bExtBuf; | 367 const CFX_DIBSource* pMask, |
| 353 | 368 FX_DWORD color, |
| 354 FX_BOOL GetGrayData(void* pIccTransform = NULL); | 369 int src_left, |
| 355 }; | 370 int src_top, |
| 356 class CFX_DIBExtractor : public CFX_Object | 371 int blend_type = FXDIB_BLEND_NORMAL, |
| 357 { | 372 const CFX_ClipRgn* pClipRgn = NULL, |
| 358 public: | 373 FX_BOOL bRgbByteOrder = FALSE, |
| 359 | 374 int alpha_flag = 0, |
| 360 CFX_DIBExtractor(const CFX_DIBSource* pSrc); | 375 void* pIccTransform = NULL); |
| 361 | 376 |
| 362 ~CFX_DIBExtractor(); | 377 FX_BOOL CompositeRect(int dest_left, |
| 363 | 378 int dest_top, |
| 364 operator CFX_DIBitmap*() | 379 int width, |
| 365 { | 380 int height, |
| 366 return m_pBitmap; | 381 FX_DWORD color, |
| 367 } | 382 int alpha_flag = 0, |
| 368 private: | 383 void* pIccTransform = NULL); |
| 369 | 384 |
| 370 CFX_DIBitmap* m_pBitmap; | 385 FX_BOOL ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor); |
| 386 |
| 387 FX_BOOL DitherFS(const FX_DWORD* pPalette, |
| 388 int pal_size, |
| 389 const FX_RECT* pRect = NULL); |
| 390 |
| 391 protected: |
| 392 FX_LPBYTE m_pBuffer; |
| 393 |
| 394 FX_BOOL m_bExtBuf; |
| 395 |
| 396 FX_BOOL GetGrayData(void* pIccTransform = NULL); |
| 397 }; |
| 398 class CFX_DIBExtractor : public CFX_Object { |
| 399 public: |
| 400 CFX_DIBExtractor(const CFX_DIBSource* pSrc); |
| 401 |
| 402 ~CFX_DIBExtractor(); |
| 403 |
| 404 operator CFX_DIBitmap*() { return m_pBitmap; } |
| 405 |
| 406 private: |
| 407 CFX_DIBitmap* m_pBitmap; |
| 371 }; | 408 }; |
| 372 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; | 409 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; |
| 373 class CFX_FilteredDIB : public CFX_DIBSource | 410 class CFX_FilteredDIB : public CFX_DIBSource { |
| 374 { | 411 public: |
| 375 public: | 412 CFX_FilteredDIB(); |
| 376 | 413 |
| 377 CFX_FilteredDIB(); | 414 ~CFX_FilteredDIB(); |
| 378 | 415 |
| 379 ~CFX_FilteredDIB(); | 416 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); |
| 380 | 417 |
| 381 void LoadSrc(const CFX_DIBSource* pSr
c, FX_BOOL bAutoDropSrc = FALSE); | 418 virtual FXDIB_Format GetDestFormat() = 0; |
| 382 | 419 |
| 383 virtual FXDIB_Format GetDestFormat() = 0; | 420 virtual FX_DWORD* GetDestPalette() = 0; |
| 384 | 421 |
| 385 virtual FX_DWORD* GetDestPalette() = 0; | 422 virtual void TranslateScanline(FX_LPBYTE dest_buf, |
| 386 | 423 FX_LPCBYTE src_buf) const = 0; |
| 387 | 424 |
| 388 virtual void TranslateScanline(FX_LPBYTE dest_buf, FX
_LPCBYTE src_buf) const = 0; | 425 virtual void TranslateDownSamples(FX_LPBYTE dest_buf, |
| 389 | 426 FX_LPCBYTE src_buf, |
| 390 virtual void TranslateDownSamples(FX_LPBYTE dest_buf,
FX_LPCBYTE src_buf, int pixels, int Bpp) const = 0; | 427 int pixels, |
| 391 protected: | 428 int Bpp) const = 0; |
| 392 virtual FX_LPCBYTE GetScanline(int line) const; | 429 |
| 393 virtual void DownSampleScanline(int line, FX_LPBYTE d
est_scan, int dest_bpp, | 430 protected: |
| 394 int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const
; | 431 virtual FX_LPCBYTE GetScanline(int line) const; |
| 395 | 432 virtual void DownSampleScanline(int line, |
| 396 const CFX_DIBSource* m_pSrc; | 433 FX_LPBYTE dest_scan, |
| 397 | 434 int dest_bpp, |
| 398 FX_BOOL m_bAutoDropSrc; | 435 int dest_width, |
| 399 | 436 FX_BOOL bFlipX, |
| 400 FX_LPBYTE m_pScanline; | 437 int clip_left, |
| 401 }; | 438 int clip_width) const; |
| 402 class IFX_ScanlineComposer | 439 |
| 403 { | 440 const CFX_DIBSource* m_pSrc; |
| 404 public: | 441 |
| 405 | 442 FX_BOOL m_bAutoDropSrc; |
| 406 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha = NULL) = 0; | 443 |
| 407 | 444 FX_LPBYTE m_pScanline; |
| 408 | 445 }; |
| 409 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette) = 0; | 446 class IFX_ScanlineComposer { |
| 410 }; | 447 public: |
| 411 class CFX_ScanlineCompositor : public CFX_Object | 448 virtual void ComposeScanline(int line, |
| 412 { | 449 FX_LPCBYTE scanline, |
| 413 public: | 450 FX_LPCBYTE scan_extra_alpha = NULL) = 0; |
| 414 | 451 |
| 415 CFX_ScanlineCompositor(); | 452 virtual FX_BOOL SetInfo(int width, |
| 416 | 453 int height, |
| 417 ~CFX_ScanlineCompositor(); | 454 FXDIB_Format src_format, |
| 418 | 455 FX_DWORD* pSrcPalette) = 0; |
| 419 FX_BOOL Init(FXDIB_Format dest_format, FXDIB_For
mat src_format, FX_INT32 width, FX_DWORD* pSrcPalette, | 456 }; |
| 420 FX_DWORD mask_color, int blend_type, FX_BOOL bClip,
FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); | 457 class CFX_ScanlineCompositor : public CFX_Object { |
| 421 | 458 public: |
| 422 | 459 CFX_ScanlineCompositor(); |
| 423 void CompositeRgbBitmapLine(FX_LPBYTE dest_sc
an, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, | 460 |
| 424 FX_LPCBYTE src_extra_alpha = NULL, FX_LPBYTE dst_extra_alpha = NULL)
; | 461 ~CFX_ScanlineCompositor(); |
| 425 | 462 |
| 426 | 463 FX_BOOL Init(FXDIB_Format dest_format, |
| 427 void CompositePalBitmapLine(FX_LPBYTE dest_sc
an, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, | 464 FXDIB_Format src_format, |
| 428 FX_LPCBYTE src_extra_alpha = NULL, FX_LPBYTE dst_extra_alpha = NULL)
; | 465 FX_INT32 width, |
| 429 | 466 FX_DWORD* pSrcPalette, |
| 430 | 467 FX_DWORD mask_color, |
| 431 void CompositeByteMaskLine(FX_LPBYTE dest_sca
n, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, | 468 int blend_type, |
| 432 FX_LPBYTE dst_extra_alpha = NULL); | 469 FX_BOOL bClip, |
| 433 | 470 FX_BOOL bRgbByteOrder = FALSE, |
| 434 | 471 int alpha_flag = 0, |
| 435 void CompositeBitMaskLine(FX_LPBYTE dest_scan
, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, | 472 void* pIccTransform = NULL); |
| 436 FX_LPBYTE dst_extra_alpha = NULL); | 473 |
| 437 protected: | 474 void CompositeRgbBitmapLine(FX_LPBYTE dest_scan, |
| 438 int m_Transparency; | 475 FX_LPCBYTE src_scan, |
| 439 FXDIB_Format m_SrcFormat, | 476 int width, |
| 440 m_DestFormat; | 477 FX_LPCBYTE clip_scan, |
| 441 FX_DWORD* m_pSrcPalette; | 478 FX_LPCBYTE src_extra_alpha = NULL, |
| 442 | 479 FX_LPBYTE dst_extra_alpha = NULL); |
| 443 int m_MaskAlpha, | 480 |
| 444 m_MaskRed, | 481 void CompositePalBitmapLine(FX_LPBYTE dest_scan, |
| 445 m_MaskGreen, | 482 FX_LPCBYTE src_scan, |
| 446 m_MaskBlue, | 483 int src_left, |
| 447 m_MaskBlack; | 484 int width, |
| 448 int m_BlendType; | 485 FX_LPCBYTE clip_scan, |
| 449 void* m_pIccTransform; | 486 FX_LPCBYTE src_extra_alpha = NULL, |
| 450 FX_LPBYTE m_pCacheScanline; | 487 FX_LPBYTE dst_extra_alpha = NULL); |
| 451 int m_CacheSize; | 488 |
| 452 FX_BOOL m_bRgbByteOrder; | 489 void CompositeByteMaskLine(FX_LPBYTE dest_scan, |
| 453 }; | 490 FX_LPCBYTE src_scan, |
| 454 class CFX_BitmapComposer : public IFX_ScanlineComposer, public CFX_Object | 491 int width, |
| 455 { | 492 FX_LPCBYTE clip_scan, |
| 456 public: | 493 FX_LPBYTE dst_extra_alpha = NULL); |
| 457 | 494 |
| 458 CFX_BitmapComposer(); | 495 void CompositeBitMaskLine(FX_LPBYTE dest_scan, |
| 459 | 496 FX_LPCBYTE src_scan, |
| 460 ~CFX_BitmapComposer(); | 497 int src_left, |
| 461 | 498 int width, |
| 462 | 499 FX_LPCBYTE clip_scan, |
| 463 void Compose(CFX_DIBitmap* pDest, const CFX_C
lipRgn* pClipRgn, int bitmap_alpha, | 500 FX_LPBYTE dst_extra_alpha = NULL); |
| 464 FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOOL
bVertical, | 501 |
| 465 FX_BOOL bFlipX, FX_BOOL bFlipY, FX_BOOL bRgbByte
Order = FALSE, | 502 protected: |
| 466 int alpha_flag = 0, void* pIccTransform = NULL,
int blend_type = FXDIB_BLEND_NORMAL); | 503 int m_Transparency; |
| 467 | 504 FXDIB_Format m_SrcFormat, m_DestFormat; |
| 468 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); | 505 FX_DWORD* m_pSrcPalette; |
| 469 | 506 |
| 470 | 507 int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; |
| 471 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha); | 508 int m_BlendType; |
| 472 protected: | 509 void* m_pIccTransform; |
| 473 | 510 FX_LPBYTE m_pCacheScanline; |
| 474 void DoCompose(FX_LPBYTE dest_scan, FX_LPCBYT
E src_scan, int dest_width, FX_LPCBYTE clip_scan, | 511 int m_CacheSize; |
| 475 FX_LPCBYTE src_extra_alpha = NULL, FX_LPBYTE d
st_extra_alpha = NULL); | 512 FX_BOOL m_bRgbByteOrder; |
| 476 CFX_DIBitmap* m_pBitmap; | 513 }; |
| 477 const CFX_ClipRgn* m_pClipRgn; | 514 class CFX_BitmapComposer : public IFX_ScanlineComposer, public CFX_Object { |
| 478 FXDIB_Format m_SrcFormat; | 515 public: |
| 479 int m_DestLeft, m_DestTop, m_DestWidth, m_De
stHeight, m_BitmapAlpha; | 516 CFX_BitmapComposer(); |
| 480 FX_DWORD m_MaskColor; | 517 |
| 481 const CFX_DIBitmap* m_pClipMask; | 518 ~CFX_BitmapComposer(); |
| 482 CFX_ScanlineCompositor m_Compositor; | 519 |
| 483 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; | 520 void Compose(CFX_DIBitmap* pDest, |
| 484 int m_AlphaFlag; | 521 const CFX_ClipRgn* pClipRgn, |
| 485 void* m_pIccTransform; | 522 int bitmap_alpha, |
| 486 FX_BOOL m_bRgbByteOrder; | 523 FX_DWORD mask_color, |
| 487 int m_BlendType; | 524 FX_RECT& dest_rect, |
| 488 void ComposeScanlineV(int line, FX_LPCBYTE sc
anline, FX_LPCBYTE scan_extra_alpha = NULL); | 525 FX_BOOL bVertical, |
| 489 FX_LPBYTE m_pScanlineV, m_pClipScanV, m_pAddClipScan, m_pS
canlineAlphaV; | 526 FX_BOOL bFlipX, |
| 490 }; | 527 FX_BOOL bFlipY, |
| 491 class CFX_BitmapStorer : public IFX_ScanlineComposer, public CFX_Object | 528 FX_BOOL bRgbByteOrder = FALSE, |
| 492 { | 529 int alpha_flag = 0, |
| 493 public: | 530 void* pIccTransform = NULL, |
| 494 | 531 int blend_type = FXDIB_BLEND_NORMAL); |
| 495 CFX_BitmapStorer(); | 532 |
| 496 | 533 virtual FX_BOOL SetInfo(int width, |
| 497 ~CFX_BitmapStorer(); | 534 int height, |
| 498 | 535 FXDIB_Format src_format, |
| 499 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha); | 536 FX_DWORD* pSrcPalette); |
| 500 | 537 |
| 501 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); | 538 virtual void ComposeScanline(int line, |
| 502 | 539 FX_LPCBYTE scanline, |
| 503 CFX_DIBitmap* GetBitmap() | 540 FX_LPCBYTE scan_extra_alpha); |
| 504 { | 541 |
| 505 return m_pBitmap; | 542 protected: |
| 506 } | 543 void DoCompose(FX_LPBYTE dest_scan, |
| 507 | 544 FX_LPCBYTE src_scan, |
| 508 CFX_DIBitmap* Detach(); | 545 int dest_width, |
| 509 | 546 FX_LPCBYTE clip_scan, |
| 510 void Replace(CFX_DIBitmap* pBitmap); | 547 FX_LPCBYTE src_extra_alpha = NULL, |
| 511 private: | 548 FX_LPBYTE dst_extra_alpha = NULL); |
| 512 CFX_DIBitmap* m_pBitmap; | 549 CFX_DIBitmap* m_pBitmap; |
| 550 const CFX_ClipRgn* m_pClipRgn; |
| 551 FXDIB_Format m_SrcFormat; |
| 552 int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; |
| 553 FX_DWORD m_MaskColor; |
| 554 const CFX_DIBitmap* m_pClipMask; |
| 555 CFX_ScanlineCompositor m_Compositor; |
| 556 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; |
| 557 int m_AlphaFlag; |
| 558 void* m_pIccTransform; |
| 559 FX_BOOL m_bRgbByteOrder; |
| 560 int m_BlendType; |
| 561 void ComposeScanlineV(int line, |
| 562 FX_LPCBYTE scanline, |
| 563 FX_LPCBYTE scan_extra_alpha = NULL); |
| 564 FX_LPBYTE m_pScanlineV, m_pClipScanV, m_pAddClipScan, m_pScanlineAlphaV; |
| 565 }; |
| 566 class CFX_BitmapStorer : public IFX_ScanlineComposer, public CFX_Object { |
| 567 public: |
| 568 CFX_BitmapStorer(); |
| 569 |
| 570 ~CFX_BitmapStorer(); |
| 571 |
| 572 virtual void ComposeScanline(int line, |
| 573 FX_LPCBYTE scanline, |
| 574 FX_LPCBYTE scan_extra_alpha); |
| 575 |
| 576 virtual FX_BOOL SetInfo(int width, |
| 577 int height, |
| 578 FXDIB_Format src_format, |
| 579 FX_DWORD* pSrcPalette); |
| 580 |
| 581 CFX_DIBitmap* GetBitmap() { return m_pBitmap; } |
| 582 |
| 583 CFX_DIBitmap* Detach(); |
| 584 |
| 585 void Replace(CFX_DIBitmap* pBitmap); |
| 586 |
| 587 private: |
| 588 CFX_DIBitmap* m_pBitmap; |
| 513 }; | 589 }; |
| 514 class CStretchEngine; | 590 class CStretchEngine; |
| 515 class CFX_ImageStretcher : public CFX_Object | 591 class CFX_ImageStretcher : public CFX_Object { |
| 516 { | 592 public: |
| 517 public: | 593 CFX_ImageStretcher(); |
| 518 | 594 |
| 519 CFX_ImageStretcher(); | 595 ~CFX_ImageStretcher(); |
| 520 | 596 |
| 521 ~CFX_ImageStretcher(); | 597 FX_INT32 Start(IFX_ScanlineComposer* pDest, |
| 522 | 598 const CFX_DIBSource* pBitmap, |
| 523 FX_INT32» » Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource*
pBitmap, | 599 int dest_width, |
| 524 int dest_width, int dest_height, const FX_RECT& bitmap
_rect, FX_DWORD flags); | 600 int dest_height, |
| 525 | 601 const FX_RECT& bitmap_rect, |
| 526 | 602 FX_DWORD flags); |
| 527 FX_INT32» » Continue(IFX_Pause* pPause); | 603 |
| 528 IFX_ScanlineComposer*» m_pDest; | 604 FX_INT32 Continue(IFX_Pause* pPause); |
| 529 const CFX_DIBSource*» m_pSource; | 605 IFX_ScanlineComposer* m_pDest; |
| 530 CStretchEngine*» » m_pStretchEngine; | 606 const CFX_DIBSource* m_pSource; |
| 531 FX_DWORD» » m_Flags; | 607 CStretchEngine* m_pStretchEngine; |
| 532 FX_BOOL» » » m_bFlipX, | 608 FX_DWORD m_Flags; |
| 533 m_bFlipY; | 609 FX_BOOL m_bFlipX, m_bFlipY; |
| 534 int»» » » m_DestWidth, | 610 int m_DestWidth, m_DestHeight; |
| 535 m_DestHeight; | 611 FX_RECT m_ClipRect; |
| 536 FX_RECT» » » m_ClipRect; | 612 int m_LineIndex; |
| 537 int»» » » m_LineIndex; | 613 int m_DestBPP; |
| 538 int»» » » m_DestBPP; | 614 FX_LPBYTE m_pScanline; |
| 539 FX_LPBYTE» » m_pScanline; | 615 FX_LPBYTE m_pMaskScanline; |
| 540 FX_LPBYTE m_pMaskScanline; | 616 FXDIB_Format m_DestFormat; |
| 541 FXDIB_Format» m_DestFormat; | 617 FX_INT32 m_Status; |
| 542 FX_INT32» » m_Status; | 618 |
| 543 | 619 FX_INT32 StartQuickStretch(); |
| 544 FX_INT32» » StartQuickStretch(); | 620 |
| 545 | 621 FX_INT32 StartStretch(); |
| 546 FX_INT32» » StartStretch(); | 622 |
| 547 | 623 FX_INT32 ContinueQuickStretch(IFX_Pause* pPause); |
| 548 FX_INT32» » ContinueQuickStretch(IFX_Pause* pPause); | 624 |
| 549 | 625 FX_INT32 ContinueStretch(IFX_Pause* pPause); |
| 550 FX_INT32» » ContinueStretch(IFX_Pause* pPause); | 626 }; |
| 551 }; | 627 class CFX_ImageTransformer : public CFX_Object { |
| 552 class CFX_ImageTransformer : public CFX_Object | 628 public: |
| 553 { | 629 CFX_ImageTransformer(); |
| 554 public: | 630 |
| 555 | 631 ~CFX_ImageTransformer(); |
| 556 CFX_ImageTransformer(); | 632 |
| 557 | 633 FX_INT32 Start(const CFX_DIBSource* pSrc, |
| 558 ~CFX_ImageTransformer(); | 634 const CFX_AffineMatrix* pMatrix, |
| 559 | 635 int flags, |
| 560 FX_INT32» Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix
, int flags, const FX_RECT* pClip); | 636 const FX_RECT* pClip); |
| 561 | 637 |
| 562 | 638 FX_INT32 Continue(IFX_Pause* pPause); |
| 563 FX_INT32» Continue(IFX_Pause* pPause); | 639 CFX_AffineMatrix* m_pMatrix; |
| 564 CFX_AffineMatrix* m_pMatrix; | 640 FX_RECT m_StretchClip; |
| 565 FX_RECT» » m_StretchClip; | 641 int m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight; |
| 566 int»» » m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight
; | 642 CFX_AffineMatrix m_dest2stretch; |
| 567 CFX_AffineMatrix» m_dest2stretch; | 643 CFX_ImageStretcher m_Stretcher; |
| 568 CFX_ImageStretcher» m_Stretcher; | 644 CFX_BitmapStorer m_Storer; |
| 569 CFX_BitmapStorer» m_Storer; | 645 FX_DWORD m_Flags; |
| 570 FX_DWORD» m_Flags; | 646 int m_Status; |
| 571 int»» » m_Status; | 647 }; |
| 572 }; | 648 class CFX_ImageRenderer : public CFX_Object { |
| 573 class CFX_ImageRenderer : public CFX_Object | 649 public: |
| 574 { | 650 CFX_ImageRenderer(); |
| 575 public: | 651 |
| 576 | 652 ~CFX_ImageRenderer(); |
| 577 CFX_ImageRenderer(); | 653 |
| 578 | 654 FX_INT32 Start(CFX_DIBitmap* pDevice, |
| 579 ~CFX_ImageRenderer(); | 655 const CFX_ClipRgn* pClipRgn, |
| 580 | 656 const CFX_DIBSource* pSource, |
| 581 FX_INT32» » » Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn*
pClipRgn, | 657 int bitmap_alpha, |
| 582 const CFX_DIBSource* pSource, int bitmap_alpha, | 658 FX_DWORD mask_color, |
| 583 FX_DWORD mask_color, const CFX_AffineMatrix* pMatr
ix, FX_DWORD dib_flags, | 659 const CFX_AffineMatrix* pMatrix, |
| 584 FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0,
void* pIccTransform = NULL, | 660 FX_DWORD dib_flags, |
| 585 int blend_type = FXDIB_BLEND_NORMAL); | 661 FX_BOOL bRgbByteOrder = FALSE, |
| 586 | 662 int alpha_flag = 0, |
| 587 FX_INT32» » » Continue(IFX_Pause* pPause); | 663 void* pIccTransform = NULL, |
| 588 protected: | 664 int blend_type = FXDIB_BLEND_NORMAL); |
| 589 CFX_DIBitmap*» » m_pDevice; | 665 |
| 590 const CFX_ClipRgn*» m_pClipRgn; | 666 FX_INT32 Continue(IFX_Pause* pPause); |
| 591 int»» » » » m_BitmapAlpha; | 667 |
| 592 FX_DWORD» » » m_MaskColor; | 668 protected: |
| 593 CFX_AffineMatrix» m_Matrix; | 669 CFX_DIBitmap* m_pDevice; |
| 594 CFX_ImageTransformer*» m_pTransformer; | 670 const CFX_ClipRgn* m_pClipRgn; |
| 595 CFX_ImageStretcher» m_Stretcher; | 671 int m_BitmapAlpha; |
| 596 CFX_BitmapComposer» m_Composer; | 672 FX_DWORD m_MaskColor; |
| 597 int»» » » » m_Status; | 673 CFX_AffineMatrix m_Matrix; |
| 598 int»» » » » m_DestLeft, m_DestTop; | 674 CFX_ImageTransformer* m_pTransformer; |
| 599 FX_RECT» » » » m_ClipBox; | 675 CFX_ImageStretcher m_Stretcher; |
| 600 FX_DWORD» » » m_Flags; | 676 CFX_BitmapComposer m_Composer; |
| 601 int»» » » » m_AlphaFlag; | 677 int m_Status; |
| 602 void*» » » » m_pIccTransform; | 678 int m_DestLeft, m_DestTop; |
| 603 FX_BOOL» » » » m_bRgbByteOrder; | 679 FX_RECT m_ClipBox; |
| 604 int»» » » » m_BlendType; | 680 FX_DWORD m_Flags; |
| 681 int m_AlphaFlag; |
| 682 void* m_pIccTransform; |
| 683 FX_BOOL m_bRgbByteOrder; |
| 684 int m_BlendType; |
| 605 }; | 685 }; |
| 606 #endif | 686 #endif |
| OLD | NEW |