Merge to XFA: Use stdint.h types throughout PDFium.
[pdfium.git] / xfa / src / fdp / src / fde / fde_gdidevice.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc.\r
6 \r
9 #ifdef _FDEPLUS\r
10 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_\r
11 class CFDE_GdiPath;\r
12 class CFDE_GdiDevice : public IFDE_RenderDevice, public CFX_Target\r
13 {\r
14 public:\r
15     CFDE_GdiDevice(CFX_DIBitmap *pDib);\r
16     ~CFDE_GdiDevice();\r
17 \r
18     virtual void                                Release()\r
19     {\r
20         FDE_Delete this;\r
21     }\r
22 \r
23     virtual int32_t                     GetWidth() const;\r
24     virtual int32_t                     GetHeight() const;\r
25     virtual FDE_HDEVICESTATE    SaveState();\r
26     virtual void                                RestoreState(FDE_HDEVICESTATE hState);\r
27     virtual FX_BOOL                             SetClipPath(const IFDE_Path *pClip);\r
28     virtual IFDE_Path*                  GetClipPath() const;\r
29     virtual FX_BOOL                             SetClipRect(const CFX_RectF &rtClip);\r
30     virtual const CFX_RectF&    GetClipRect();\r
31 \r
32     virtual FX_FLOAT                    GetDpiX() const;\r
33     virtual FX_FLOAT                    GetDpiY() const;\r
34 \r
35     virtual FX_BOOL                             DrawImage(CFX_DIBSource *pDib, const CFX_RectF *pSrcRect, const CFX_RectF &dstRect, const CFX_Matrix *pImgMatrix = NULL, const CFX_Matrix *pDevMatrix = NULL);\r
36     virtual FX_BOOL                             DrawImage(IFDE_Image *pImg, const CFX_RectF *pSrcRect, const CFX_RectF &dstRect, const CFX_Matrix *pImgMatrix = NULL, const CFX_Matrix *pDevMatrix = NULL);\r
37     virtual FX_BOOL                             DrawString(IFDE_Brush *pBrush, IFX_Font *pFont, const FXTEXT_CHARPOS *pCharPos, int32_t iCount, FX_FLOAT fFontSize, const CFX_Matrix *pMatrix = NULL);\r
38     virtual FX_BOOL                             DrawArc(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_RectF &rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix *pMatrix = NULL);\r
39     virtual FX_BOOL                             DrawBezier(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_PointF &pt1, const CFX_PointF &pt2, const CFX_PointF &pt3, const CFX_PointF &pt4, const CFX_Matrix *pMatrix = NULL);\r
40     virtual FX_BOOL                             DrawCurve(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_PointsF &points, FX_BOOL bClosed, FX_FLOAT fTension = 0.5f, const CFX_Matrix *pMatrix = NULL);\r
41     virtual FX_BOOL                             DrawEllipse(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_RectF &rect, const CFX_Matrix *pMatrix = NULL);\r
42     virtual FX_BOOL                             DrawLines(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_PointsF &points, const CFX_Matrix *pMatrix = NULL);\r
43     virtual FX_BOOL                             DrawLine(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_PointF &pt1, const CFX_PointF &pt2, const CFX_Matrix *pMatrix = NULL);\r
44     virtual FX_BOOL                             DrawPath(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const IFDE_Path *pPath, const CFX_Matrix *pMatrix = NULL);\r
45     virtual FX_BOOL                             DrawPie(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_RectF &rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix *pMatrix = NULL);\r
46     virtual FX_BOOL                             DrawChord(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_RectF &rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix *pMatrix = NULL);\r
47     virtual FX_BOOL                             DrawPolygon(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_PointsF &points, const CFX_Matrix *pMatrix = NULL);\r
48     virtual FX_BOOL                             DrawRectangle(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_RectF &rect, const CFX_Matrix *pMatrix = NULL);\r
49     virtual FX_BOOL                             DrawRoundRectangle(IFDE_Pen *pPen, FX_FLOAT fPenWidth, const CFX_RectF &rect, const CFX_SizeF &round, const CFX_Matrix *pMatrix = NULL);\r
50     virtual FX_BOOL                             FillClosedCurve(IFDE_Brush *pBrush, const CFX_PointsF &points, FX_FLOAT fTension = 0.5f, const CFX_Matrix *pMatrix = NULL);\r
51     virtual FX_BOOL                             FillEllipse(IFDE_Brush* pBrush, const CFX_RectF& rect, const CFX_Matrix *pMatrix = NULL);\r
52     virtual FX_BOOL                             FillPath(IFDE_Brush *pBrush, const IFDE_Path *pPath, const CFX_Matrix *pMatrix = NULL);\r
53     virtual FX_BOOL                             FillPie(IFDE_Brush *pBrush, const CFX_RectF &rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix *pMatrix = NULL);\r
54     virtual FX_BOOL                             FillChord(IFDE_Brush *pBrush, const CFX_RectF &rect, FX_FLOAT startAngle, FX_FLOAT sweepAngle, const CFX_Matrix *pMatrix = NULL);\r
55     virtual FX_BOOL                             FillPolygon(IFDE_Brush *pBrush, const CFX_PointsF &points, const CFX_Matrix *pMatrix = NULL);\r
56     virtual FX_BOOL                             FillRectangle(IFDE_Brush *pBrush, const CFX_RectF &rect, const CFX_Matrix *pMatrix = NULL);\r
57     virtual FX_BOOL                             FillRoundRectangle(IFDE_Brush *pBrush, const CFX_RectF &rect, const CFX_SizeF &round, const CFX_Matrix *pMatrix = NULL);\r
58 \r
59 protected:\r
60     Gdiplus::Pen*                               CreateGdiPen(IFDE_Pen *pPen, FX_FLOAT fPenWidth);\r
61     void                                                ReleaseGdiPen(Gdiplus::Pen *pGdiPen);\r
62     Gdiplus::Brush*                             CreateGdiBrush(IFDE_Brush *pBrush);\r
63     void                                                ReleaseGdiBrush(Gdiplus::Brush *pGdiBrush);\r
64     void                                                ApplyMatrix(const CFX_Matrix *pMatrix);\r
65     void                                                RestoreMatrix(const CFX_Matrix *pMatrix);\r
66     Gdiplus::GraphicsState              m_GraphicsState;\r
67     Gdiplus::Graphics                   *m_pGraphics;\r
68     Gdiplus::Bitmap                             *m_pBitmap;\r
69     FX_LPBYTE                                   m_pGlyphBuf;\r
70     FX_DWORD                                    m_dwGlyphLen;\r
71     CFX_RectF                                   m_rtClipRect;\r
72     CFDE_GdiPath                                *m_pClipPath;\r
73 };\r
74 #endif\r
75 #endif\r
76 #endif\r