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 _FDE_FXGEDEVICE_IMP
8#define _FDE_FXGEDEVICE_IMP
9#ifndef _FDEPLUS
10class CFDE_FxgeDevice : public IFDE_RenderDevice, public CFX_Target {
11 public:
12  CFDE_FxgeDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice);
13  ~CFDE_FxgeDevice();
14  virtual void Release() { delete this; }
15
16  virtual int32_t GetWidth() const;
17  virtual int32_t GetHeight() const;
18  virtual FDE_HDEVICESTATE SaveState();
19  virtual void RestoreState(FDE_HDEVICESTATE hState);
20  virtual FX_BOOL SetClipPath(const IFDE_Path* pClip);
21  virtual IFDE_Path* GetClipPath() const;
22  virtual FX_BOOL SetClipRect(const CFX_RectF& rtClip);
23  virtual const CFX_RectF& GetClipRect();
24
25  virtual FX_FLOAT GetDpiX() const;
26  virtual FX_FLOAT GetDpiY() const;
27
28  virtual FX_BOOL DrawImage(CFX_DIBSource* pDib,
29                            const CFX_RectF* pSrcRect,
30                            const CFX_RectF& dstRect,
31                            const CFX_Matrix* pImgMatrix = NULL,
32                            const CFX_Matrix* pDevMatrix = NULL);
33  virtual FX_BOOL DrawString(IFDE_Brush* pBrush,
34                             IFX_Font* pFont,
35                             const FXTEXT_CHARPOS* pCharPos,
36                             int32_t iCount,
37                             FX_FLOAT fFontSize,
38                             const CFX_Matrix* pMatrix = NULL);
39  virtual FX_BOOL DrawBezier(IFDE_Pen* pPen,
40                             FX_FLOAT fPenWidth,
41                             const CFX_PointF& pt1,
42                             const CFX_PointF& pt2,
43                             const CFX_PointF& pt3,
44                             const CFX_PointF& pt4,
45                             const CFX_Matrix* pMatrix = NULL);
46  virtual FX_BOOL DrawCurve(IFDE_Pen* pPen,
47                            FX_FLOAT fPenWidth,
48                            const CFX_PointsF& points,
49                            FX_BOOL bClosed,
50                            FX_FLOAT fTension = 0.5f,
51                            const CFX_Matrix* pMatrix = NULL);
52  virtual FX_BOOL DrawEllipse(IFDE_Pen* pPen,
53                              FX_FLOAT fPenWidth,
54                              const CFX_RectF& rect,
55                              const CFX_Matrix* pMatrix = NULL);
56  virtual FX_BOOL DrawLines(IFDE_Pen* pPen,
57                            FX_FLOAT fPenWidth,
58                            const CFX_PointsF& points,
59                            const CFX_Matrix* pMatrix = NULL);
60  virtual FX_BOOL DrawLine(IFDE_Pen* pPen,
61                           FX_FLOAT fPenWidth,
62                           const CFX_PointF& pt1,
63                           const CFX_PointF& pt2,
64                           const CFX_Matrix* pMatrix = NULL);
65  virtual FX_BOOL DrawPath(IFDE_Pen* pPen,
66                           FX_FLOAT fPenWidth,
67                           const IFDE_Path* pPath,
68                           const CFX_Matrix* pMatrix = NULL);
69  virtual FX_BOOL DrawPolygon(IFDE_Pen* pPen,
70                              FX_FLOAT fPenWidth,
71                              const CFX_PointsF& points,
72                              const CFX_Matrix* pMatrix = NULL);
73  virtual FX_BOOL DrawRectangle(IFDE_Pen* pPen,
74                                FX_FLOAT fPenWidth,
75                                const CFX_RectF& rect,
76                                const CFX_Matrix* pMatrix = NULL);
77  virtual FX_BOOL FillClosedCurve(IFDE_Brush* pBrush,
78                                  const CFX_PointsF& points,
79                                  FX_FLOAT fTension = 0.5f,
80                                  const CFX_Matrix* pMatrix = NULL);
81  virtual FX_BOOL FillEllipse(IFDE_Brush* pBrush,
82                              const CFX_RectF& rect,
83                              const CFX_Matrix* pMatrix = NULL);
84  virtual FX_BOOL FillPath(IFDE_Brush* pBrush,
85                           const IFDE_Path* pPath,
86                           const CFX_Matrix* pMatrix = NULL);
87  virtual FX_BOOL FillPolygon(IFDE_Brush* pBrush,
88                              const CFX_PointsF& points,
89                              const CFX_Matrix* pMatrix = NULL);
90  virtual FX_BOOL FillRectangle(IFDE_Brush* pBrush,
91                                const CFX_RectF& rect,
92                                const CFX_Matrix* pMatrix = NULL);
93  FX_BOOL FillSolidPath(IFDE_Brush* pBrush,
94                        const CFX_PathData* pPath,
95                        const CFX_Matrix* pMatrix);
96  FX_BOOL FillHatchPath(IFDE_Brush* pBrush,
97                        const CFX_PathData* pPath,
98                        const CFX_Matrix* pMatrix);
99  FX_BOOL FillTexturePath(IFDE_Brush* pBrush,
100                          const CFX_PathData* pPath,
101                          const CFX_Matrix* pMatrix);
102  FX_BOOL FillLinearGradientPath(IFDE_Brush* pBrush,
103                                 const CFX_PathData* pPath,
104                                 const CFX_Matrix* pMatrix);
105  FX_BOOL DrawSolidString(IFDE_Brush* pBrush,
106                          IFX_Font* pFont,
107                          const FXTEXT_CHARPOS* pCharPos,
108                          int32_t iCount,
109                          FX_FLOAT fFontSize,
110                          const CFX_Matrix* pMatrix);
111  FX_BOOL DrawStringPath(IFDE_Brush* pBrush,
112                         IFX_Font* pFont,
113                         const FXTEXT_CHARPOS* pCharPos,
114                         int32_t iCount,
115                         FX_FLOAT fFontSize,
116                         const CFX_Matrix* pMatrix);
117
118 protected:
119  FX_BOOL CreatePen(IFDE_Pen* pPen,
120                    FX_FLOAT fPenWidth,
121                    CFX_GraphStateData& graphState);
122  FX_BOOL WrapTexture(int32_t iWrapMode,
123                      const CFX_DIBitmap* pBitmap,
124                      const CFX_PathData* pPath,
125                      const CFX_Matrix* pMatrix);
126  CFX_RenderDevice* m_pDevice;
127  CFX_RectF m_rtClip;
128  FX_BOOL m_bOwnerDevice;
129  FXTEXT_CHARPOS* m_pCharPos;
130  int32_t m_iCharCount;
131};
132#endif
133#endif
134