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