Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: core/include/fxge/fx_dib.h

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

Powered by Google App Engine
This is Rietveld 408576698