blob: 3d14a0f8af2cd993056cd450f40659e68d228d68 [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 -070013typedef struct FDE_HDEVICESTATE_ { void* pData; } * FDE_HDEVICESTATE;
14
15class CFDE_Brush;
16class CFDE_Path;
17class CFDE_Pen;
18class CFX_RenderDevice;
19class IFX_Font;
20
21class CFDE_RenderDevice : public CFX_Target {
Dan Sinclair1770c022016-03-14 14:14:16 -040022 public:
dsinclairacd0d592016-04-21 11:06:27 -070023 CFDE_RenderDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice);
24 ~CFDE_RenderDevice();
Dan Sinclair1770c022016-03-14 14:14:16 -040025
dsinclairacd0d592016-04-21 11:06:27 -070026 void Release() { delete this; }
Dan Sinclair1770c022016-03-14 14:14:16 -040027
dsinclairacd0d592016-04-21 11:06:27 -070028 int32_t GetWidth() const;
29 int32_t GetHeight() const;
30 FDE_HDEVICESTATE SaveState();
31 void RestoreState(FDE_HDEVICESTATE hState);
32 FX_BOOL SetClipPath(const CFDE_Path* pClip);
33 CFDE_Path* GetClipPath() const;
34 FX_BOOL SetClipRect(const CFX_RectF& rtClip);
35 const CFX_RectF& GetClipRect();
Dan Sinclair1770c022016-03-14 14:14:16 -040036
dsinclairacd0d592016-04-21 11:06:27 -070037 FX_FLOAT GetDpiX() const;
38 FX_FLOAT GetDpiY() const;
39
40 FX_BOOL DrawImage(CFX_DIBSource* pDib,
41 const CFX_RectF* pSrcRect,
42 const CFX_RectF& dstRect,
43 const CFX_Matrix* pImgMatrix = NULL,
44 const CFX_Matrix* pDevMatrix = NULL);
45 FX_BOOL DrawString(CFDE_Brush* pBrush,
46 IFX_Font* pFont,
47 const FXTEXT_CHARPOS* pCharPos,
48 int32_t iCount,
49 FX_FLOAT fFontSize,
50 const CFX_Matrix* pMatrix = NULL);
51 FX_BOOL DrawBezier(CFDE_Pen* pPen,
52 FX_FLOAT fPenWidth,
53 const CFX_PointF& pt1,
54 const CFX_PointF& pt2,
55 const CFX_PointF& pt3,
56 const CFX_PointF& pt4,
57 const CFX_Matrix* pMatrix = NULL);
58 FX_BOOL DrawCurve(CFDE_Pen* pPen,
59 FX_FLOAT fPenWidth,
60 const CFX_PointsF& points,
61 FX_BOOL bClosed,
62 FX_FLOAT fTension = 0.5f,
63 const CFX_Matrix* pMatrix = NULL);
64 FX_BOOL DrawEllipse(CFDE_Pen* pPen,
65 FX_FLOAT fPenWidth,
66 const CFX_RectF& rect,
67 const CFX_Matrix* pMatrix = NULL);
68 FX_BOOL DrawLines(CFDE_Pen* pPen,
69 FX_FLOAT fPenWidth,
70 const CFX_PointsF& points,
71 const CFX_Matrix* pMatrix = NULL);
72 FX_BOOL DrawLine(CFDE_Pen* pPen,
73 FX_FLOAT fPenWidth,
74 const CFX_PointF& pt1,
75 const CFX_PointF& pt2,
76 const CFX_Matrix* pMatrix = NULL);
77 FX_BOOL DrawPath(CFDE_Pen* pPen,
78 FX_FLOAT fPenWidth,
79 const CFDE_Path* pPath,
80 const CFX_Matrix* pMatrix = NULL);
81 FX_BOOL DrawPolygon(CFDE_Pen* pPen,
82 FX_FLOAT fPenWidth,
83 const CFX_PointsF& points,
84 const CFX_Matrix* pMatrix = NULL);
85 FX_BOOL DrawRectangle(CFDE_Pen* pPen,
86 FX_FLOAT fPenWidth,
87 const CFX_RectF& rect,
88 const CFX_Matrix* pMatrix = NULL);
89 FX_BOOL FillClosedCurve(CFDE_Brush* pBrush,
90 const CFX_PointsF& points,
91 FX_FLOAT fTension = 0.5f,
92 const CFX_Matrix* pMatrix = NULL);
93 FX_BOOL FillEllipse(CFDE_Brush* pBrush,
94 const CFX_RectF& rect,
95 const CFX_Matrix* pMatrix = NULL);
96 FX_BOOL FillPath(CFDE_Brush* pBrush,
97 const CFDE_Path* pPath,
98 const CFX_Matrix* pMatrix = NULL);
99 FX_BOOL FillPolygon(CFDE_Brush* pBrush,
100 const CFX_PointsF& points,
101 const CFX_Matrix* pMatrix = NULL);
102 FX_BOOL FillRectangle(CFDE_Brush* pBrush,
103 const CFX_RectF& rect,
104 const CFX_Matrix* pMatrix = NULL);
dsinclair25c223d2016-04-12 09:51:45 -0700105
dsinclaira5c13232016-04-12 13:19:36 -0700106 FX_BOOL DrawSolidString(CFDE_Brush* pBrush,
Dan Sinclair1770c022016-03-14 14:14:16 -0400107 IFX_Font* pFont,
108 const FXTEXT_CHARPOS* pCharPos,
109 int32_t iCount,
110 FX_FLOAT fFontSize,
111 const CFX_Matrix* pMatrix);
dsinclaira5c13232016-04-12 13:19:36 -0700112 FX_BOOL DrawStringPath(CFDE_Brush* pBrush,
Dan Sinclair1770c022016-03-14 14:14:16 -0400113 IFX_Font* pFont,
114 const FXTEXT_CHARPOS* pCharPos,
115 int32_t iCount,
116 FX_FLOAT fFontSize,
117 const CFX_Matrix* pMatrix);
118
119 protected:
dsinclaira5c13232016-04-12 13:19:36 -0700120 FX_BOOL CreatePen(CFDE_Pen* pPen,
Dan Sinclair1770c022016-03-14 14:14:16 -0400121 FX_FLOAT fPenWidth,
122 CFX_GraphStateData& graphState);
dsinclair25c223d2016-04-12 09:51:45 -0700123
Dan Sinclair1770c022016-03-14 14:14:16 -0400124 CFX_RenderDevice* m_pDevice;
125 CFX_RectF m_rtClip;
126 FX_BOOL m_bOwnerDevice;
127 FXTEXT_CHARPOS* m_pCharPos;
128 int32_t m_iCharCount;
129};
130
131#endif // XFA_FDE_FDE_GEDEVICE_H_