OLD | NEW |
| (Empty) |
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 XFA_SRC_FDE_FDE_BRUSH_H_ | |
8 #define XFA_SRC_FDE_FDE_BRUSH_H_ | |
9 | |
10 #include "core/include/fxcrt/fx_system.h" | |
11 #include "core/include/fxge/fx_dib.h" | |
12 | |
13 class IFDE_Image; | |
14 | |
15 #define FDE_BRUSHTYPE_Unknown -1 | |
16 #define FDE_BRUSHTYPE_Solid 0 | |
17 #define FDE_BRUSHTYPE_Hatch 1 | |
18 #define FDE_BRUSHTYPE_Texture 2 | |
19 #define FDE_BRUSHTYPE_LinearGradient 3 | |
20 #define FDE_BRUSHTYPE_MAX 3 | |
21 #define FDE_WRAPMODE_Tile 0 | |
22 #define FDE_WRAPMODE_TileFlipX 1 | |
23 #define FDE_WRAPMODE_TileFlipY 2 | |
24 #define FDE_WRAPMODE_TileFlipXY 3 | |
25 #define FDE_WRAPMODE_Clamp 4 | |
26 | |
27 struct FDE_GRADIENTCOLOR { | |
28 FX_FLOAT pos; | |
29 FX_ARGB color; | |
30 }; | |
31 typedef CFX_ArrayTemplate<FDE_GRADIENTCOLOR> CFDE_GradientColors; | |
32 | |
33 class IFDE_Brush { | |
34 public: | |
35 static IFDE_Brush* Create(int32_t iType); | |
36 virtual ~IFDE_Brush() {} | |
37 virtual void Release() = 0; | |
38 virtual int32_t GetType() const = 0; | |
39 }; | |
40 | |
41 class IFDE_SolidBrush : public IFDE_Brush { | |
42 public: | |
43 virtual FX_ARGB GetColor() const = 0; | |
44 virtual void SetColor(FX_ARGB color) = 0; | |
45 virtual const CFX_Matrix& GetMatrix() const = 0; | |
46 virtual void ResetMatrix() = 0; | |
47 virtual void TranslateMatrix(FX_FLOAT dx, FX_FLOAT dy) = 0; | |
48 virtual void RotateMatrix(FX_FLOAT fRadian) = 0; | |
49 virtual void ScaleMatrix(FX_FLOAT sx, FX_FLOAT sy) = 0; | |
50 virtual void ConcatMatrix(const CFX_Matrix& matrix) = 0; | |
51 virtual void SetMatrix(const CFX_Matrix& matrix) = 0; | |
52 }; | |
53 | |
54 #define FDE_HATCHSTYLE_Horizontal 0 | |
55 #define FDE_HATCHSTYLE_Vertical 1 | |
56 #define FDE_HATCHSTYLE_ForwardDiagonal 2 | |
57 #define FDE_HATCHSTYLE_BackwardDiagonal 3 | |
58 #define FDE_HATCHSTYLE_Cross 4 | |
59 #define FDE_HATCHSTYLE_DiagonalCross 5 | |
60 #define FDE_HATCHSTYLE_05Percent 6 | |
61 #define FDE_HATCHSTYLE_10Percent 7 | |
62 #define FDE_HATCHSTYLE_20Percent 8 | |
63 #define FDE_HATCHSTYLE_25Percent 9 | |
64 #define FDE_HATCHSTYLE_30Percent 10 | |
65 #define FDE_HATCHSTYLE_40Percent 11 | |
66 #define FDE_HATCHSTYLE_50Percent 12 | |
67 #define FDE_HATCHSTYLE_60Percent 13 | |
68 #define FDE_HATCHSTYLE_70Percent 14 | |
69 #define FDE_HATCHSTYLE_75Percent 15 | |
70 #define FDE_HATCHSTYLE_80Percent 16 | |
71 #define FDE_HATCHSTYLE_90Percent 17 | |
72 #define FDE_HATCHSTYLE_LightDownwardDiagonal 18 | |
73 #define FDE_HATCHSTYLE_LightUpwardDiagonal 19 | |
74 #define FDE_HATCHSTYLE_DarkDownwardDiagonal 20 | |
75 #define FDE_HATCHSTYLE_DarkUpwardDiagonal 21 | |
76 #define FDE_HATCHSTYLE_WideDownwardDiagonal 22 | |
77 #define FDE_HATCHSTYLE_WideUpwardDiagonal 23 | |
78 #define FDE_HATCHSTYLE_LightVertical 24 | |
79 #define FDE_HATCHSTYLE_LightHorizontal 25 | |
80 #define FDE_HATCHSTYLE_NarrowVertical 26 | |
81 #define FDE_HATCHSTYLE_NarrowHorizontal 27 | |
82 #define FDE_HATCHSTYLE_DarkVertical 28 | |
83 #define FDE_HATCHSTYLE_DarkHorizontal 29 | |
84 #define FDE_HATCHSTYLE_DashedDownwardDiagonal 30 | |
85 #define FDE_HATCHSTYLE_DashedUpwardDiagonal 31 | |
86 #define FDE_HATCHSTYLE_DashedHorizontal 32 | |
87 #define FDE_HATCHSTYLE_DashedVertical 33 | |
88 #define FDE_HATCHSTYLE_SmallConfetti 34 | |
89 #define FDE_HATCHSTYLE_LargeConfetti 35 | |
90 #define FDE_HATCHSTYLE_ZigZag 36 | |
91 #define FDE_HATCHSTYLE_Wave 37 | |
92 #define FDE_HATCHSTYLE_DiagonalBrick 38 | |
93 #define FDE_HATCHSTYLE_HorizontalBrick 39 | |
94 #define FDE_HATCHSTYLE_Weave 40 | |
95 #define FDE_HATCHSTYLE_Plaid 41 | |
96 #define FDE_HATCHSTYLE_Divot 42 | |
97 #define FDE_HATCHSTYLE_DottedGrid 43 | |
98 #define FDE_HATCHSTYLE_DottedDiamond 44 | |
99 #define FDE_HATCHSTYLE_Shingle 45 | |
100 #define FDE_HATCHSTYLE_Trellis 46 | |
101 #define FDE_HATCHSTYLE_Sphere 47 | |
102 #define FDE_HATCHSTYLE_SmallGrid 48 | |
103 #define FDE_HATCHSTYLE_SmallCheckerBoard 49 | |
104 #define FDE_HATCHSTYLE_LargeCheckerBoard 50 | |
105 #define FDE_HATCHSTYLE_OutlinedDiamond 51 | |
106 #define FDE_HATCHSTYLE_SolidDiamond 52 | |
107 #define FDE_HATCHSTYLE_Total 53 | |
108 #define FDE_HATCHSTYLE_LargeGrid FDE_HATCHSTYLE_Cross | |
109 #define FDE_HATCHSTYLE_Min FDE_HATCHSTYLE_Horizontal | |
110 #define FDE_HATCHSTYLE_Max (FDE_HATCHSTYLE_Total - 1) | |
111 | |
112 class IFDE_HatchBrush : public IFDE_Brush { | |
113 public: | |
114 virtual FX_ARGB GetColor(FX_BOOL bForegroundColor) const = 0; | |
115 virtual void SetColor(FX_ARGB color, FX_BOOL bForegroundColor) = 0; | |
116 virtual int32_t GetHatchStyle() const = 0; | |
117 virtual FX_BOOL SetHatchStyle(int32_t iHatchStyle) = 0; | |
118 }; | |
119 | |
120 class IFDE_TextureBrush : public IFDE_Brush { | |
121 public: | |
122 virtual IFDE_Image* GetImage() const = 0; | |
123 virtual void SetImage(IFDE_Image* pImage, FX_BOOL bAutoRelease) = 0; | |
124 virtual int32_t GetWrapMode() const = 0; | |
125 virtual void SetWrapMode(int32_t iWrapMode) = 0; | |
126 }; | |
127 | |
128 #define FDE_LINEARGRADIENTMODE_Horizontal 0 | |
129 #define FDE_LINEARGRADIENTMODE_Vertical 1 | |
130 #define FDE_LINEARGRADIENTMODE_ForwardDiagonal 2 | |
131 #define FDE_LINEARGRADIENTMODE_BackwardDiagonal 3 | |
132 | |
133 class IFDE_LinearGradientBrush : public IFDE_Brush { | |
134 public: | |
135 virtual void GetLinearPoints(CFX_PointF& startingPoint, | |
136 CFX_PointF& endingPoint) const = 0; | |
137 virtual void SetLinearPoints(const CFX_PointF& startingPoint, | |
138 const CFX_PointF& endingPoint) = 0; | |
139 virtual void GetLinearColors(FX_ARGB& startingColor, | |
140 FX_ARGB& endingColor) const = 0; | |
141 virtual void SetLinearColors(const FX_ARGB& startingColor, | |
142 const FX_ARGB& endingColor) = 0; | |
143 virtual int32_t CountGradientColors() const = 0; | |
144 virtual FX_BOOL GetGradientColors(CFDE_GradientColors& colors) const = 0; | |
145 virtual FX_BOOL SetGradientColors(const CFDE_GradientColors& colors) = 0; | |
146 virtual int32_t GetWrapMode() const = 0; | |
147 virtual void SetWrapMode(int32_t iWrapMode) = 0; | |
148 }; | |
149 | |
150 #endif // XFA_SRC_FDE_FDE_BRUSH_H_ | |
OLD | NEW |