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