blob: debb69115c1c0f4dda0d5d9e4cdd7faf1a0779c5 [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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 XFA_FDE_FDE_GEDEVICE_H_
8#define XFA_FDE_FDE_GEDEVICE_H_
9
dsinclairacd0d592016-04-21 11:06:27 -070010#include "core/fxge/include/fx_ge.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040011#include "xfa/fgas/crt/fgas_memory.h"
12
dsinclairacd0d592016-04-21 11:06:27 -070013class CFDE_Brush;
14class CFDE_Path;
15class CFDE_Pen;
thestiga4fdfc52016-06-07 17:33:37 -070016class CFGAS_GEFont;
dsinclairacd0d592016-04-21 11:06:27 -070017
18class CFDE_RenderDevice : public CFX_Target {
Dan Sinclair1770c022016-03-14 14:14:16 -040019 public:
dsinclairacd0d592016-04-21 11:06:27 -070020 CFDE_RenderDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice);
tsepezf74ad992016-05-11 10:26:05 -070021 ~CFDE_RenderDevice() override;
Dan Sinclair1770c022016-03-14 14:14:16 -040022
dsinclairacd0d592016-04-21 11:06:27 -070023 int32_t GetWidth() const;
24 int32_t GetHeight() const;
dsinclairfe433f12016-06-06 12:03:31 -070025 void SaveState();
26 void RestoreState();
dsinclairacd0d592016-04-21 11:06:27 -070027 FX_BOOL SetClipPath(const CFDE_Path* pClip);
28 CFDE_Path* GetClipPath() const;
29 FX_BOOL SetClipRect(const CFX_RectF& rtClip);
30 const CFX_RectF& GetClipRect();
Dan Sinclair1770c022016-03-14 14:14:16 -040031
dsinclairacd0d592016-04-21 11:06:27 -070032 FX_FLOAT GetDpiX() const;
33 FX_FLOAT GetDpiY() const;
34
35 FX_BOOL DrawImage(CFX_DIBSource* pDib,
36 const CFX_RectF* pSrcRect,
37 const CFX_RectF& dstRect,
38 const CFX_Matrix* pImgMatrix = NULL,
39 const CFX_Matrix* pDevMatrix = NULL);
40 FX_BOOL DrawString(CFDE_Brush* pBrush,
thestiga4fdfc52016-06-07 17:33:37 -070041 CFGAS_GEFont* pFont,
dsinclairacd0d592016-04-21 11:06:27 -070042 const FXTEXT_CHARPOS* pCharPos,
43 int32_t iCount,
44 FX_FLOAT fFontSize,
45 const CFX_Matrix* pMatrix = NULL);
46 FX_BOOL DrawBezier(CFDE_Pen* pPen,
47 FX_FLOAT fPenWidth,
48 const CFX_PointF& pt1,
49 const CFX_PointF& pt2,
50 const CFX_PointF& pt3,
51 const CFX_PointF& pt4,
52 const CFX_Matrix* pMatrix = NULL);
53 FX_BOOL DrawCurve(CFDE_Pen* pPen,
54 FX_FLOAT fPenWidth,
55 const CFX_PointsF& points,
56 FX_BOOL bClosed,
57 FX_FLOAT fTension = 0.5f,
58 const CFX_Matrix* pMatrix = NULL);
59 FX_BOOL DrawEllipse(CFDE_Pen* pPen,
60 FX_FLOAT fPenWidth,
61 const CFX_RectF& rect,
62 const CFX_Matrix* pMatrix = NULL);
63 FX_BOOL DrawLines(CFDE_Pen* pPen,
64 FX_FLOAT fPenWidth,
65 const CFX_PointsF& points,
66 const CFX_Matrix* pMatrix = NULL);
67 FX_BOOL DrawLine(CFDE_Pen* pPen,
68 FX_FLOAT fPenWidth,
69 const CFX_PointF& pt1,
70 const CFX_PointF& pt2,
71 const CFX_Matrix* pMatrix = NULL);
72 FX_BOOL DrawPath(CFDE_Pen* pPen,
73 FX_FLOAT fPenWidth,
74 const CFDE_Path* pPath,
75 const CFX_Matrix* pMatrix = NULL);
76 FX_BOOL DrawPolygon(CFDE_Pen* pPen,
77 FX_FLOAT fPenWidth,
78 const CFX_PointsF& points,
79 const CFX_Matrix* pMatrix = NULL);
80 FX_BOOL DrawRectangle(CFDE_Pen* pPen,
81 FX_FLOAT fPenWidth,
82 const CFX_RectF& rect,
83 const CFX_Matrix* pMatrix = NULL);
84 FX_BOOL FillClosedCurve(CFDE_Brush* pBrush,
85 const CFX_PointsF& points,
86 FX_FLOAT fTension = 0.5f,
87 const CFX_Matrix* pMatrix = NULL);
88 FX_BOOL FillEllipse(CFDE_Brush* pBrush,
89 const CFX_RectF& rect,
90 const CFX_Matrix* pMatrix = NULL);
91 FX_BOOL FillPath(CFDE_Brush* pBrush,
92 const CFDE_Path* pPath,
93 const CFX_Matrix* pMatrix = NULL);
94 FX_BOOL FillPolygon(CFDE_Brush* pBrush,
95 const CFX_PointsF& points,
96 const CFX_Matrix* pMatrix = NULL);
97 FX_BOOL FillRectangle(CFDE_Brush* pBrush,
98 const CFX_RectF& rect,
99 const CFX_Matrix* pMatrix = NULL);
dsinclair25c223d2016-04-12 09:51:45 -0700100
dsinclaira5c13232016-04-12 13:19:36 -0700101 FX_BOOL DrawSolidString(CFDE_Brush* pBrush,
thestiga4fdfc52016-06-07 17:33:37 -0700102 CFGAS_GEFont* pFont,
Dan Sinclair1770c022016-03-14 14:14:16 -0400103 const FXTEXT_CHARPOS* pCharPos,
104 int32_t iCount,
105 FX_FLOAT fFontSize,
106 const CFX_Matrix* pMatrix);
dsinclaira5c13232016-04-12 13:19:36 -0700107 FX_BOOL DrawStringPath(CFDE_Brush* pBrush,
thestiga4fdfc52016-06-07 17:33:37 -0700108 CFGAS_GEFont* pFont,
Dan Sinclair1770c022016-03-14 14:14:16 -0400109 const FXTEXT_CHARPOS* pCharPos,
110 int32_t iCount,
111 FX_FLOAT fFontSize,
112 const CFX_Matrix* pMatrix);
113
114 protected:
dsinclaira5c13232016-04-12 13:19:36 -0700115 FX_BOOL CreatePen(CFDE_Pen* pPen,
Dan Sinclair1770c022016-03-14 14:14:16 -0400116 FX_FLOAT fPenWidth,
117 CFX_GraphStateData& graphState);
dsinclair25c223d2016-04-12 09:51:45 -0700118
Dan Sinclair1770c022016-03-14 14:14:16 -0400119 CFX_RenderDevice* m_pDevice;
120 CFX_RectF m_rtClip;
121 FX_BOOL m_bOwnerDevice;
122 FXTEXT_CHARPOS* m_pCharPos;
123 int32_t m_iCharCount;
124};
125
126#endif // XFA_FDE_FDE_GEDEVICE_H_