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_RENDERDEVICE
8#define _FDE_RENDERDEVICE
9class IFDE_Pen;
10class IFDE_Brush;
11class IFDE_Image;
12class CFX_DIBitmap;
13class CFX_DIBSource;
14
15typedef struct _FDE_HDEVICESTATE { void* pData; } * FDE_HDEVICESTATE;
16
17class IFDE_RenderDevice {
18 public:
19  static IFDE_RenderDevice* Create(CFX_DIBitmap* pBitmap,
20                                   FX_BOOL bRgbByteOrder = FALSE);
21  static IFDE_RenderDevice* Create(CFX_RenderDevice* pDevice);
22  virtual ~IFDE_RenderDevice() {}
23  virtual void Release() = 0;
24
25  virtual int32_t GetWidth() const = 0;
26  virtual int32_t GetHeight() const = 0;
27  virtual FDE_HDEVICESTATE SaveState() = 0;
28  virtual void RestoreState(FDE_HDEVICESTATE hState) = 0;
29  virtual FX_BOOL SetClipPath(const IFDE_Path* pClip) = 0;
30  virtual IFDE_Path* GetClipPath() const = 0;
31  virtual FX_BOOL SetClipRect(const CFX_RectF& rtClip) = 0;
32  virtual const CFX_RectF& GetClipRect() = 0;
33
34  virtual FX_FLOAT GetDpiX() const = 0;
35  virtual FX_FLOAT GetDpiY() const = 0;
36
37  virtual FX_BOOL DrawImage(CFX_DIBSource* pDib,
38                            const CFX_RectF* pSrcRect,
39                            const CFX_RectF& dstRect,
40                            const CFX_Matrix* pImgMatrix = NULL,
41                            const CFX_Matrix* pDevMatrix = NULL) = 0;
42  virtual FX_BOOL DrawString(IFDE_Brush* pBrush,
43                             IFX_Font* pFont,
44                             const FXTEXT_CHARPOS* pCharPos,
45                             int32_t iCount,
46                             FX_FLOAT fFontSize,
47                             const CFX_Matrix* pMatrix = NULL) = 0;
48  virtual FX_BOOL DrawBezier(IFDE_Pen* pPen,
49                             FX_FLOAT fPenWidth,
50                             const CFX_PointF& pt1,
51                             const CFX_PointF& pt2,
52                             const CFX_PointF& pt3,
53                             const CFX_PointF& pt4,
54                             const CFX_Matrix* pMatrix = NULL) = 0;
55  virtual FX_BOOL DrawCurve(IFDE_Pen* pPen,
56                            FX_FLOAT fPenWidth,
57                            const CFX_PointsF& points,
58                            FX_BOOL bClosed,
59                            FX_FLOAT fTension = 0.5f,
60                            const CFX_Matrix* pMatrix = NULL) = 0;
61  virtual FX_BOOL DrawEllipse(IFDE_Pen* pPen,
62                              FX_FLOAT fPenWidth,
63                              const CFX_RectF& rect,
64                              const CFX_Matrix* pMatrix = NULL) = 0;
65  virtual FX_BOOL DrawLines(IFDE_Pen* pPen,
66                            FX_FLOAT fPenWidth,
67                            const CFX_PointsF& points,
68                            const CFX_Matrix* pMatrix = NULL) = 0;
69  virtual FX_BOOL DrawLine(IFDE_Pen* pPen,
70                           FX_FLOAT fPenWidth,
71                           const CFX_PointF& pt1,
72                           const CFX_PointF& pt2,
73                           const CFX_Matrix* pMatrix = NULL) = 0;
74  virtual FX_BOOL DrawPath(IFDE_Pen* pPen,
75                           FX_FLOAT fPenWidth,
76                           const IFDE_Path* pPath,
77                           const CFX_Matrix* pMatrix = NULL) = 0;
78  virtual FX_BOOL DrawPolygon(IFDE_Pen* pPen,
79                              FX_FLOAT fPenWidth,
80                              const CFX_PointsF& points,
81                              const CFX_Matrix* pMatrix = NULL) = 0;
82  virtual FX_BOOL DrawRectangle(IFDE_Pen* pPen,
83                                FX_FLOAT fPenWidth,
84                                const CFX_RectF& rect,
85                                const CFX_Matrix* pMatrix = NULL) = 0;
86  virtual FX_BOOL FillClosedCurve(IFDE_Brush* pBrush,
87                                  const CFX_PointsF& points,
88                                  FX_FLOAT fTension = 0.5f,
89                                  const CFX_Matrix* pMatrix = NULL) = 0;
90  virtual FX_BOOL FillEllipse(IFDE_Brush* pBrush,
91                              const CFX_RectF& rect,
92                              const CFX_Matrix* pMatrix = NULL) = 0;
93  virtual FX_BOOL FillPath(IFDE_Brush* pBrush,
94                           const IFDE_Path* pPath,
95                           const CFX_Matrix* pMatrix = NULL) = 0;
96  virtual FX_BOOL FillPolygon(IFDE_Brush* pBrush,
97                              const CFX_PointsF& points,
98                              const CFX_Matrix* pMatrix = NULL) = 0;
99  virtual FX_BOOL FillRectangle(IFDE_Brush* pBrush,
100                                const CFX_RectF& rect,
101                                const CFX_Matrix* pMatrix = NULL) = 0;
102};
103#endif
104