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_GE_H_
8 #define CORE_INCLUDE_FXGE_FX_GE_H_
9
10 #include "fx_dib.h"
11 #include "fx_font.h"
12
13 class CFX_Font;
14 class CFX_FontMgr;
15 class CFX_FontCache;
16 class CFX_FaceCache;
17 class IFX_RenderDeviceDriver;
18 class CCodec_ModuleMgr;
19
20 class CFX_GEModule {
21 public:
22 static void Create(const char** pUserFontPaths);
23
24 static void Use(CFX_GEModule* pMgr);
25
26 static CFX_GEModule* Get();
27
28 static void Destroy();
29
30 public:
31 CFX_FontCache* GetFontCache();
GetFontMgr()32 CFX_FontMgr* GetFontMgr() { return m_pFontMgr; }
33 void SetTextGamma(FX_FLOAT gammaValue);
34 const uint8_t* GetTextGammaTable();
35
SetCodecModule(CCodec_ModuleMgr * pCodecModule)36 void SetCodecModule(CCodec_ModuleMgr* pCodecModule) {
37 m_pCodecModule = pCodecModule;
38 }
GetCodecModule()39 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; }
40 FXFT_Library m_FTLibrary;
GetPlatformData()41 void* GetPlatformData() { return m_pPlatformData; }
42
43 protected:
44 explicit CFX_GEModule(const char** pUserFontPaths);
45
46 ~CFX_GEModule();
47 void InitPlatform();
48 void DestroyPlatform();
49
50 private:
51 uint8_t m_GammaValue[256];
52 CFX_FontCache* m_pFontCache;
53 CFX_FontMgr* m_pFontMgr;
54 CCodec_ModuleMgr* m_pCodecModule;
55 void* m_pPlatformData;
56 const char** m_pUserFontPaths;
57 };
58 typedef struct {
59 FX_FLOAT m_PointX;
60
61 FX_FLOAT m_PointY;
62
63 int m_Flag;
64 } FX_PATHPOINT;
65 #define FXPT_CLOSEFIGURE 0x01
66 #define FXPT_LINETO 0x02
67 #define FXPT_BEZIERTO 0x04
68 #define FXPT_MOVETO 0x06
69 #define FXPT_TYPE 0x06
70 #define FXFILL_ALTERNATE 1
71 #define FXFILL_WINDING 2
72 class CFX_ClipRgn {
73 public:
74 CFX_ClipRgn(int device_width, int device_height);
75
76 CFX_ClipRgn(const FX_RECT& rect);
77
78 CFX_ClipRgn(const CFX_ClipRgn& src);
79
80 ~CFX_ClipRgn();
81
82 typedef enum { RectI, MaskF } ClipType;
83
84 void Reset(const FX_RECT& rect);
85
GetType()86 ClipType GetType() const { return m_Type; }
87
GetBox()88 const FX_RECT& GetBox() const { return m_Box; }
89
GetMask()90 CFX_DIBitmapRef GetMask() const { return m_Mask; }
91
92 void IntersectRect(const FX_RECT& rect);
93
94 void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask);
95
96 protected:
97 ClipType m_Type;
98
99 FX_RECT m_Box;
100
101 CFX_DIBitmapRef m_Mask;
102
103 void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask);
104 };
105 #define FX_GAMMA(value) (value)
106 #define FX_GAMMA_INVERSE(value) (value)
ArgbGamma(FX_ARGB argb)107 inline FX_ARGB ArgbGamma(FX_ARGB argb) {
108 return argb;
109 }
ArgbGammaInverse(FX_ARGB argb)110 inline FX_ARGB ArgbGammaInverse(FX_ARGB argb) {
111 return argb;
112 }
113 class CFX_PathData {
114 public:
115 CFX_PathData();
116
117 CFX_PathData(const CFX_PathData& src);
118
119 ~CFX_PathData();
120
GetPointCount()121 int GetPointCount() const { return m_PointCount; }
122
GetFlag(int index)123 int GetFlag(int index) const { return m_pPoints[index].m_Flag; }
124
GetPointX(int index)125 FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; }
126
GetPointY(int index)127 FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; }
128
GetPoints()129 FX_PATHPOINT* GetPoints() const { return m_pPoints; }
130
131 void SetPointCount(int nPoints);
132 void AllocPointCount(int nPoints);
133 void AddPointCount(int addPoints);
134
135 CFX_FloatRect GetBoundingBox() const;
136
137 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
138
139 void Transform(const CFX_Matrix* pMatrix);
140
141 FX_BOOL IsRect() const;
142
143 FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath,
144 CFX_Matrix* pMatrix,
145 FX_BOOL& bThin,
146 FX_BOOL bAdjust) const;
147
148 FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const;
149
150 void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix);
151 void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top);
152
153 void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag);
154
155 void TrimPoints(int nPoints);
156
157 void Copy(const CFX_PathData& src);
158
159 protected:
160 friend class CPDF_Path;
161
162 int m_PointCount;
163
164 FX_PATHPOINT* m_pPoints;
165
166 int m_AllocCount;
167 };
168 class CFX_GraphStateData {
169 public:
170 CFX_GraphStateData();
171
172 CFX_GraphStateData(const CFX_GraphStateData& src);
173
174 ~CFX_GraphStateData();
175
176 void Copy(const CFX_GraphStateData& src);
177
178 void SetDashCount(int count);
179
180 typedef enum { LineCapButt = 0, LineCapRound = 1, LineCapSquare = 2 } LineCap;
181 LineCap m_LineCap;
182 int m_DashCount;
183 FX_FLOAT* m_DashArray;
184 FX_FLOAT m_DashPhase;
185
186 typedef enum {
187 LineJoinMiter = 0,
188 LineJoinRound = 1,
189 LineJoinBevel = 2,
190 } LineJoin;
191 LineJoin m_LineJoin;
192 FX_FLOAT m_MiterLimit;
193 FX_FLOAT m_LineWidth;
194 };
195 #define FXDC_DEVICE_CLASS 1
196 #define FXDC_PIXEL_WIDTH 2
197 #define FXDC_PIXEL_HEIGHT 3
198 #define FXDC_BITS_PIXEL 4
199 #define FXDC_HORZ_SIZE 5
200 #define FXDC_VERT_SIZE 6
201 #define FXDC_RENDER_CAPS 7
202 #define FXDC_DITHER_BITS 8
203 #define FXDC_DISPLAY 1
204 #define FXDC_PRINTER 2
205 #define FXRC_GET_BITS 0x01
206 #define FXRC_BIT_MASK 0x02
207 #define FXRC_ALPHA_MASK 0x04
208 #define FXRC_ALPHA_PATH 0x10
209 #define FXRC_ALPHA_IMAGE 0x20
210 #define FXRC_ALPHA_OUTPUT 0x40
211 #define FXRC_BLEND_MODE 0x80
212 #define FXRC_SOFT_CLIP 0x100
213 #define FXRC_CMYK_OUTPUT 0x200
214 #define FXRC_BITMASK_OUTPUT 0x400
215 #define FXRC_BYTEMASK_OUTPUT 0x800
216 #define FXRENDER_IMAGE_LOSSY 0x1000
217 #define FXFILL_ALTERNATE 1
218 #define FXFILL_WINDING 2
219 #define FXFILL_FULLCOVER 4
220 #define FXFILL_RECT_AA 8
221 #define FX_FILL_STROKE 16
222 #define FX_STROKE_ADJUST 32
223 #define FX_STROKE_TEXT_MODE 64
224 #define FX_FILL_TEXT_MODE 128
225 #define FX_ZEROAREA_FILL 256
226 #define FXFILL_NOPATHSMOOTH 512
227 #define FXTEXT_CLEARTYPE 0x01
228 #define FXTEXT_BGR_STRIPE 0x02
229 #define FXTEXT_PRINTGRAPHICTEXT 0x04
230 #define FXTEXT_NO_NATIVETEXT 0x08
231 #define FXTEXT_PRINTIMAGETEXT 0x10
232 #define FXTEXT_NOSMOOTH 0x20
233 typedef struct {
234 FX_DWORD m_GlyphIndex;
235 FX_FLOAT m_OriginX, m_OriginY;
236 int m_FontCharWidth;
237 FX_BOOL m_bGlyphAdjust;
238 FX_FLOAT m_AdjustMatrix[4];
239 FX_DWORD m_ExtGID;
240 FX_BOOL m_bFontStyle;
241 } FXTEXT_CHARPOS;
242 class CFX_RenderDevice {
243 public:
244 CFX_RenderDevice();
245
246 virtual ~CFX_RenderDevice();
247
248 void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver);
249
GetDeviceDriver()250 IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; }
251
252 FX_BOOL StartRendering();
253
254 void EndRendering();
255
256 void SaveState();
257
258 void RestoreState(FX_BOOL bKeepSaved = FALSE);
259
GetWidth()260 int GetWidth() const { return m_Width; }
261
GetHeight()262 int GetHeight() const { return m_Height; }
263
GetDeviceClass()264 int GetDeviceClass() const { return m_DeviceClass; }
265
GetBPP()266 int GetBPP() const { return m_bpp; }
267
GetRenderCaps()268 int GetRenderCaps() const { return m_RenderCaps; }
269
270 int GetDeviceCaps(int id) const;
271
272 CFX_Matrix GetCTM() const;
273
GetBitmap()274 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; }
SetBitmap(CFX_DIBitmap * pBitmap)275 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; }
276
277 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
278 int width,
279 int height) const;
280
GetClipBox()281 const FX_RECT& GetClipBox() const { return m_ClipBox; }
282
283 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
284 const CFX_Matrix* pObject2Device,
285 int fill_mode);
286
287 FX_BOOL SetClip_Rect(const FX_RECT* pRect);
288
289 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
290 const CFX_Matrix* pObject2Device,
291 const CFX_GraphStateData* pGraphState);
292
293 FX_BOOL DrawPath(const CFX_PathData* pPathData,
294 const CFX_Matrix* pObject2Device,
295 const CFX_GraphStateData* pGraphState,
296 FX_DWORD fill_color,
297 FX_DWORD stroke_color,
298 int fill_mode,
299 int alpha_flag = 0,
300 void* pIccTransform = NULL,
301 int blend_type = FXDIB_BLEND_NORMAL);
302
303 FX_BOOL SetPixel(int x,
304 int y,
305 FX_DWORD color,
306 int alpha_flag = 0,
307 void* pIccTransform = NULL);
308
309 FX_BOOL FillRect(const FX_RECT* pRect,
310 FX_DWORD color,
311 int alpha_flag = 0,
312 void* pIccTransform = NULL,
313 int blend_type = FXDIB_BLEND_NORMAL);
314
315 FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
316 FX_FLOAT y1,
317 FX_FLOAT x2,
318 FX_FLOAT y2,
319 FX_DWORD color,
320 int fill_mode = 0,
321 int alpha_flag = 0,
322 void* pIccTransform = NULL,
323 int blend_type = FXDIB_BLEND_NORMAL);
324
325 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
326 int left,
327 int top,
328 void* pIccTransform = NULL);
329
330 CFX_DIBitmap* GetBackDrop();
331
332 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
333 int left,
334 int top,
335 int blend_type = FXDIB_BLEND_NORMAL,
336 void* pIccTransform = NULL);
337
338 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
339 int left,
340 int top,
341 int dest_width,
342 int dest_height,
343 FX_DWORD flags = 0,
344 void* pIccTransform = NULL,
345 int blend_type = FXDIB_BLEND_NORMAL);
346
347 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap,
348 int left,
349 int top,
350 FX_DWORD color,
351 int alpha_flag = 0,
352 void* pIccTransform = NULL);
353
354 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap,
355 int left,
356 int top,
357 int dest_width,
358 int dest_height,
359 FX_DWORD color,
360 FX_DWORD flags = 0,
361 int alpha_flag = 0,
362 void* pIccTransform = NULL);
363
364 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
365 int bitmap_alpha,
366 FX_DWORD color,
367 const CFX_Matrix* pMatrix,
368 FX_DWORD flags,
369 void*& handle,
370 int alpha_flag = 0,
371 void* pIccTransform = NULL,
372 int blend_type = FXDIB_BLEND_NORMAL);
373
374 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
375
376 void CancelDIBits(void* handle);
377
378 FX_BOOL DrawNormalText(int nChars,
379 const FXTEXT_CHARPOS* pCharPos,
380 CFX_Font* pFont,
381 CFX_FontCache* pCache,
382 FX_FLOAT font_size,
383 const CFX_Matrix* pText2Device,
384 FX_DWORD fill_color,
385 FX_DWORD text_flags,
386 int alpha_flag = 0,
387 void* pIccTransform = NULL);
388
389 FX_BOOL DrawTextPath(int nChars,
390 const FXTEXT_CHARPOS* pCharPos,
391 CFX_Font* pFont,
392 CFX_FontCache* pCache,
393 FX_FLOAT font_size,
394 const CFX_Matrix* pText2User,
395 const CFX_Matrix* pUser2Device,
396 const CFX_GraphStateData* pGraphState,
397 FX_DWORD fill_color,
398 FX_DWORD stroke_color,
399 CFX_PathData* pClippingPath,
400 int nFlag = 0,
401 int alpha_flag = 0,
402 void* pIccTransform = NULL,
403 int blend_type = FXDIB_BLEND_NORMAL);
Begin()404 virtual void Begin() {}
End()405 virtual void End() {}
406
407 private:
408 CFX_DIBitmap* m_pBitmap;
409
410 int m_Width;
411
412 int m_Height;
413
414 int m_bpp;
415
416 int m_RenderCaps;
417
418 int m_DeviceClass;
419
420 FX_RECT m_ClipBox;
421
422 protected:
423 IFX_RenderDeviceDriver* m_pDeviceDriver;
424
425 private:
426 void InitDeviceInfo();
427
428 void UpdateClipBox();
429 };
430 class CFX_FxgeDevice : public CFX_RenderDevice {
431 public:
432 CFX_FxgeDevice();
433 ~CFX_FxgeDevice() override;
434
435 FX_BOOL Attach(CFX_DIBitmap* pBitmap,
436 int dither_bits = 0,
437 FX_BOOL bRgbByteOrder = FALSE,
438 CFX_DIBitmap* pOriDevice = NULL,
439 FX_BOOL bGroupKnockout = FALSE);
440
441 FX_BOOL Create(int width,
442 int height,
443 FXDIB_Format format,
444 int dither_bits = 0,
445 CFX_DIBitmap* pOriDevice = NULL);
446
447 protected:
448 FX_BOOL m_bOwnedBitmap;
449 };
450 class CFX_SkiaDevice : public CFX_RenderDevice {
451 public:
452 CFX_SkiaDevice();
453 ~CFX_SkiaDevice() override;
454
455 FX_BOOL Attach(CFX_DIBitmap* pBitmap,
456 int dither_bits = 0,
457 FX_BOOL bRgbByteOrder = FALSE,
458 CFX_DIBitmap* pOriDevice = NULL,
459 FX_BOOL bGroupKnockout = FALSE);
460
461 FX_BOOL Create(int width,
462 int height,
463 FXDIB_Format format,
464 int dither_bits = 0,
465 CFX_DIBitmap* pOriDevice = NULL);
466
467 protected:
468 FX_BOOL m_bOwnedBitmap;
469 };
470
471 class IFX_RenderDeviceDriver {
472 public:
473 static IFX_RenderDeviceDriver* CreateFxgeDriver(
474 CFX_DIBitmap* pBitmap,
475 FX_BOOL bRgbByteOrder = FALSE,
476 CFX_DIBitmap* pOriDevice = NULL,
477 FX_BOOL bGroupKnockout = FALSE);
478
~IFX_RenderDeviceDriver()479 virtual ~IFX_RenderDeviceDriver() {}
Begin()480 virtual void Begin() {}
End()481 virtual void End() {}
482
483 virtual int GetDeviceCaps(int caps_id) = 0;
484
GetCTM()485 virtual CFX_Matrix GetCTM() const { return CFX_Matrix(); }
486
IsPSPrintDriver()487 virtual FX_BOOL IsPSPrintDriver() { return FALSE; }
488
StartRendering()489 virtual FX_BOOL StartRendering() { return TRUE; }
490
EndRendering()491 virtual void EndRendering() {}
492
493 virtual void SaveState() = 0;
494
495 virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) = 0;
496
497 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
498 const CFX_Matrix* pObject2Device,
499 int fill_mode) = 0;
500
SetClip_PathStroke(const CFX_PathData * pPathData,const CFX_Matrix * pObject2Device,const CFX_GraphStateData * pGraphState)501 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
502 const CFX_Matrix* pObject2Device,
503 const CFX_GraphStateData* pGraphState) {
504 return FALSE;
505 }
506
507 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData,
508 const CFX_Matrix* pObject2Device,
509 const CFX_GraphStateData* pGraphState,
510 FX_DWORD fill_color,
511 FX_DWORD stroke_color,
512 int fill_mode,
513 int alpha_flag = 0,
514 void* pIccTransform = NULL,
515 int blend_type = FXDIB_BLEND_NORMAL) = 0;
516
517 virtual FX_BOOL SetPixel(int x,
518 int y,
519 FX_DWORD color,
520 int alpha_flag = 0,
521 void* pIccTransform = NULL) {
522 return FALSE;
523 }
524
525 virtual FX_BOOL FillRect(const FX_RECT* pRect,
526 FX_DWORD fill_color,
527 int alpha_flag = 0,
528 void* pIccTransform = NULL,
529 int blend_type = FXDIB_BLEND_NORMAL) {
530 return FALSE;
531 }
532
533 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
534 FX_FLOAT y1,
535 FX_FLOAT x2,
536 FX_FLOAT y2,
537 FX_DWORD color,
538 int alpha_flag = 0,
539 void* pIccTransform = NULL,
540 int blend_type = FXDIB_BLEND_NORMAL) {
541 return FALSE;
542 }
543
544 virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0;
545
546 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
547 int left,
548 int top,
549 void* pIccTransform = NULL,
550 FX_BOOL bDEdge = FALSE) {
551 return FALSE;
552 }
GetBackDrop()553 virtual CFX_DIBitmap* GetBackDrop() { return NULL; }
554
555 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
556 FX_DWORD color,
557 const FX_RECT* pSrcRect,
558 int dest_left,
559 int dest_top,
560 int blend_type,
561 int alpha_flag = 0,
562 void* pIccTransform = NULL) = 0;
563
564 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
565 FX_DWORD color,
566 int dest_left,
567 int dest_top,
568 int dest_width,
569 int dest_height,
570 const FX_RECT* pClipRect,
571 FX_DWORD flags,
572 int alpha_flag = 0,
573 void* pIccTransform = NULL,
574 int blend_type = FXDIB_BLEND_NORMAL) = 0;
575
576 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
577 int bitmap_alpha,
578 FX_DWORD color,
579 const CFX_Matrix* pMatrix,
580 FX_DWORD flags,
581 void*& handle,
582 int alpha_flag = 0,
583 void* pIccTransform = NULL,
584 int blend_type = FXDIB_BLEND_NORMAL) = 0;
585
ContinueDIBits(void * handle,IFX_Pause * pPause)586 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) {
587 return FALSE;
588 }
589
CancelDIBits(void * handle)590 virtual void CancelDIBits(void* handle) {}
591
592 virtual FX_BOOL DrawDeviceText(int nChars,
593 const FXTEXT_CHARPOS* pCharPos,
594 CFX_Font* pFont,
595 CFX_FontCache* pCache,
596 const CFX_Matrix* pObject2Device,
597 FX_FLOAT font_size,
598 FX_DWORD color,
599 int alpha_flag = 0,
600 void* pIccTransform = NULL) {
601 return FALSE;
602 }
603
GetPlatformSurface()604 virtual void* GetPlatformSurface() { return NULL; }
605
GetDriverType()606 virtual int GetDriverType() { return 0; }
607
ClearDriver()608 virtual void ClearDriver() {}
609 };
610
611 class IFX_PSOutput {
612 public:
613 virtual void Release() = 0;
614 virtual void OutputPS(const FX_CHAR* string, int len) = 0;
615
616 protected:
~IFX_PSOutput()617 virtual ~IFX_PSOutput() {}
618 };
619
620 class CPSFont;
621 class CFX_PSRenderer {
622 public:
623 CFX_PSRenderer();
624
625 ~CFX_PSRenderer();
626
627 void Init(IFX_PSOutput* pOutput,
628 int ps_level,
629 int width,
630 int height,
631 FX_BOOL bCmykOutput);
632 FX_BOOL StartRendering();
633 void EndRendering();
634
635 void SaveState();
636
637 void RestoreState(FX_BOOL bKeepSaved = FALSE);
638
639 void SetClip_PathFill(const CFX_PathData* pPathData,
640 const CFX_Matrix* pObject2Device,
641 int fill_mode);
642
643 void SetClip_PathStroke(const CFX_PathData* pPathData,
644 const CFX_Matrix* pObject2Device,
645 const CFX_GraphStateData* pGraphState);
646
GetClipBox()647 FX_RECT GetClipBox() { return m_ClipBox; }
648
649 FX_BOOL DrawPath(const CFX_PathData* pPathData,
650 const CFX_Matrix* pObject2Device,
651 const CFX_GraphStateData* pGraphState,
652 FX_DWORD fill_color,
653 FX_DWORD stroke_color,
654 int fill_mode,
655 int alpha_flag = 0,
656 void* pIccTransform = NULL);
657
658 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
659 FX_DWORD color,
660 int dest_left,
661 int dest_top,
662 int alpha_flag = 0,
663 void* pIccTransform = NULL);
664
665 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
666 FX_DWORD color,
667 int dest_left,
668 int dest_top,
669 int dest_width,
670 int dest_height,
671 FX_DWORD flags,
672 int alpha_flag = 0,
673 void* pIccTransform = NULL);
674
675 FX_BOOL DrawDIBits(const CFX_DIBSource* pBitmap,
676 FX_DWORD color,
677 const CFX_Matrix* pMatrix,
678 FX_DWORD flags,
679 int alpha_flag = 0,
680 void* pIccTransform = NULL);
681
682 FX_BOOL DrawText(int nChars,
683 const FXTEXT_CHARPOS* pCharPos,
684 CFX_Font* pFont,
685 CFX_FontCache* pCache,
686 const CFX_Matrix* pObject2Device,
687 FX_FLOAT font_size,
688 FX_DWORD color,
689 int alpha_flag = 0,
690 void* pIccTransform = NULL);
691
692 private:
693 IFX_PSOutput* m_pOutput;
694
695 int m_PSLevel;
696
697 CFX_GraphStateData m_CurGraphState;
698
699 FX_BOOL m_bGraphStateSet;
700
701 FX_BOOL m_bCmykOutput;
702
703 FX_BOOL m_bColorSet;
704
705 FX_DWORD m_LastColor;
706
707 FX_RECT m_ClipBox;
708
709 CFX_ArrayTemplate<CPSFont*> m_PSFontList;
710
711 CFX_ArrayTemplate<FX_RECT> m_ClipBoxStack;
712 FX_BOOL m_bInited;
713
714 void OutputPath(const CFX_PathData* pPathData,
715 const CFX_Matrix* pObject2Device);
716
717 void SetGraphState(const CFX_GraphStateData* pGraphState);
718
719 void SetColor(FX_DWORD color, int alpha_flag, void* pIccTransform);
720
721 void FindPSFontGlyph(CFX_FaceCache* pFaceCache,
722 CFX_Font* pFont,
723 const FXTEXT_CHARPOS& charpos,
724 int& ps_fontnum,
725 int& ps_glyphindex);
726
727 void WritePSBinary(const uint8_t* data, int len);
728 };
729
730 #endif // CORE_INCLUDE_FXGE_FX_GE_H_
731