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