Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: xfa/include/fxgraphics/fx_graphics.h

Issue 1784323006: Re-enable warning 4201 for xfa and other clean up (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: remove tags Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxgraphics/fx_graphics.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_ 7 #ifndef XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_
8 #define XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_ 8 #define XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_
9 9
10 #include "core/include/fpdfapi/fpdf_pageobj.h" 10 #include "core/include/fpdfapi/fpdf_pageobj.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 typedef int32_t FX_DeviceCap; 94 typedef int32_t FX_DeviceCap;
95 typedef int32_t FX_FillMode; 95 typedef int32_t FX_FillMode;
96 class CFX_RenderDevice; 96 class CFX_RenderDevice;
97 class CFX_GraphStateData; 97 class CFX_GraphStateData;
98 class CFX_Matrix; 98 class CFX_Matrix;
99 class CFX_DIBSource; 99 class CFX_DIBSource;
100 class CFX_DIBitmap; 100 class CFX_DIBitmap;
101 class CFX_Font; 101 class CFX_Font;
102 class CFX_WideString; 102 class CFX_WideString;
103 class CFX_PathGenerator; 103 class CFX_PathGenerator;
104 class CAGG_Graphics;
105 class CFX_Graphics; 104 class CFX_Graphics;
106 class CFX_Color; 105 class CFX_Color;
107 class CFX_Path; 106 class CFX_Path;
108 class CFX_Pattern; 107 class CFX_Pattern;
109 class CFX_Shading; 108 class CFX_Shading;
109
110 class CAGG_Graphics {
111 public:
112 CAGG_Graphics();
113 virtual ~CAGG_Graphics();
114
115 FX_ERR Create(CFX_Graphics* owner,
116 int32_t width,
117 int32_t height,
118 FXDIB_Format format);
119
120 private:
121 CFX_Graphics* m_owner;
122 };
123
110 class CFX_Graphics { 124 class CFX_Graphics {
111 public: 125 public:
112 CFX_Graphics(); 126 CFX_Graphics();
127 virtual ~CFX_Graphics();
113 128
114 FX_ERR Create(CFX_RenderDevice* renderDevice, FX_BOOL isAntialiasing = TRUE); 129 FX_ERR Create(CFX_RenderDevice* renderDevice, FX_BOOL isAntialiasing = TRUE);
115
116 FX_ERR Create(int32_t width, 130 FX_ERR Create(int32_t width,
117 int32_t height, 131 int32_t height,
118 FXDIB_Format format, 132 FXDIB_Format format,
119 FX_BOOL isNative = TRUE, 133 FX_BOOL isNative = TRUE,
120 FX_BOOL isAntialiasing = TRUE); 134 FX_BOOL isAntialiasing = TRUE);
121 135
122 virtual ~CFX_Graphics();
123
124 FX_ERR GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal); 136 FX_ERR GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal);
125 FX_ERR IsPrinterDevice(FX_BOOL& isPrinter); 137 FX_ERR IsPrinterDevice(FX_BOOL& isPrinter);
126 FX_ERR EnableAntialiasing(FX_BOOL isAntialiasing); 138 FX_ERR EnableAntialiasing(FX_BOOL isAntialiasing);
127 139
128 FX_ERR SaveGraphState(); 140 FX_ERR SaveGraphState();
129
130 FX_ERR RestoreGraphState(); 141 FX_ERR RestoreGraphState();
131 142
132 FX_ERR GetLineCap(CFX_GraphStateData::LineCap& lineCap); 143 FX_ERR GetLineCap(CFX_GraphStateData::LineCap& lineCap) const;
144 FX_ERR GetDashCount(int32_t& dashCount) const;
145 FX_ERR GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray) const;
146 FX_ERR GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const;
147 FX_ERR GetMiterLimit(FX_FLOAT& miterLimit) const;
148 FX_ERR GetLineWidth(FX_FLOAT& lineWidth) const;
149 FX_ERR GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const;
150 FX_ERR GetClipRect(CFX_RectF& rect) const;
151 CFX_Matrix* GetMatrix();
152 CFX_RenderDevice* GetRenderDevice();
133 153
134 FX_ERR SetLineCap(CFX_GraphStateData::LineCap lineCap); 154 FX_ERR SetLineCap(CFX_GraphStateData::LineCap lineCap);
135
136 FX_ERR GetDashCount(int32_t& dashCount);
137
138 FX_ERR GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray);
139
140 FX_ERR SetLineDash(FX_FLOAT dashPhase, 155 FX_ERR SetLineDash(FX_FLOAT dashPhase,
141 FX_FLOAT* dashArray, 156 FX_FLOAT* dashArray,
142 int32_t dashCount); 157 int32_t dashCount);
143
144 FX_ERR SetLineDash(FX_DashStyle dashStyle); 158 FX_ERR SetLineDash(FX_DashStyle dashStyle);
145
146 FX_ERR GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin);
147
148 FX_ERR SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); 159 FX_ERR SetLineJoin(CFX_GraphStateData::LineJoin lineJoin);
149
150 FX_ERR GetMiterLimit(FX_FLOAT& miterLimit);
151
152 FX_ERR SetMiterLimit(FX_FLOAT miterLimit); 160 FX_ERR SetMiterLimit(FX_FLOAT miterLimit);
153
154 FX_ERR GetLineWidth(FX_FLOAT& lineWidth);
155
156 FX_ERR SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE); 161 FX_ERR SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE);
157
158 FX_ERR GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment);
159
160 FX_ERR SetStrokeAlignment(FX_StrokeAlignment strokeAlignment); 162 FX_ERR SetStrokeAlignment(FX_StrokeAlignment strokeAlignment);
161
162 FX_ERR SetStrokeColor(CFX_Color* color); 163 FX_ERR SetStrokeColor(CFX_Color* color);
163
164 FX_ERR SetFillColor(CFX_Color* color); 164 FX_ERR SetFillColor(CFX_Color* color);
165 FX_ERR SetClipRect(const CFX_RectF& rect);
166 FX_ERR SetFont(CFX_Font* font);
167 FX_ERR SetFontSize(const FX_FLOAT size);
168 FX_ERR SetFontHScale(const FX_FLOAT scale);
169 FX_ERR SetCharSpacing(const FX_FLOAT spacing);
170 FX_ERR SetTextDrawingMode(const int32_t mode);
165 171
166 FX_ERR StrokePath(CFX_Path* path, CFX_Matrix* matrix = NULL); 172 FX_ERR StrokePath(CFX_Path* path, CFX_Matrix* matrix = NULL);
167
168 FX_ERR FillPath(CFX_Path* path, 173 FX_ERR FillPath(CFX_Path* path,
169 FX_FillMode fillMode = FXFILL_WINDING, 174 FX_FillMode fillMode = FXFILL_WINDING,
170 CFX_Matrix* matrix = NULL); 175 CFX_Matrix* matrix = NULL);
171
172 FX_ERR ClipPath(CFX_Path* path, 176 FX_ERR ClipPath(CFX_Path* path,
173 FX_FillMode fillMode = FXFILL_WINDING, 177 FX_FillMode fillMode = FXFILL_WINDING,
174 CFX_Matrix* matrix = NULL); 178 CFX_Matrix* matrix = NULL);
175
176 FX_ERR DrawImage(CFX_DIBSource* source, 179 FX_ERR DrawImage(CFX_DIBSource* source,
177 const CFX_PointF& point, 180 const CFX_PointF& point,
178 CFX_Matrix* matrix = NULL); 181 CFX_Matrix* matrix = NULL);
179
180 FX_ERR StretchImage(CFX_DIBSource* source, 182 FX_ERR StretchImage(CFX_DIBSource* source,
181 const CFX_RectF& rect, 183 const CFX_RectF& rect,
182 CFX_Matrix* matrix = NULL); 184 CFX_Matrix* matrix = NULL);
183
184 FX_ERR ConcatMatrix(const CFX_Matrix* matrix); 185 FX_ERR ConcatMatrix(const CFX_Matrix* matrix);
185
186 CFX_Matrix* GetMatrix();
187
188 FX_ERR GetClipRect(CFX_RectF& rect);
189
190 FX_ERR SetClipRect(const CFX_RectF& rect);
191
192 FX_ERR ClearClip(); 186 FX_ERR ClearClip();
193
194 FX_ERR SetFont(CFX_Font* font);
195
196 FX_ERR SetFontSize(const FX_FLOAT size);
197
198 FX_ERR SetFontHScale(const FX_FLOAT scale);
199
200 FX_ERR SetCharSpacing(const FX_FLOAT spacing);
201
202 FX_ERR SetTextDrawingMode(const int32_t mode);
203
204 FX_ERR ShowText(const CFX_PointF& point, 187 FX_ERR ShowText(const CFX_PointF& point,
205 const CFX_WideString& text, 188 const CFX_WideString& text,
206 CFX_Matrix* matrix = NULL); 189 CFX_Matrix* matrix = NULL);
207
208 FX_ERR CalcTextRect(CFX_RectF& rect, 190 FX_ERR CalcTextRect(CFX_RectF& rect,
209 const CFX_WideString& text, 191 const CFX_WideString& text,
210 FX_BOOL isMultiline = FALSE, 192 FX_BOOL isMultiline = FALSE,
211 CFX_Matrix* matrix = NULL); 193 CFX_Matrix* matrix = NULL);
212
213 FX_ERR Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix); 194 FX_ERR Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix);
214 FX_ERR Transfer(CFX_Graphics* graphics, 195 FX_ERR Transfer(CFX_Graphics* graphics,
215 FX_FLOAT srcLeft, 196 FX_FLOAT srcLeft,
216 FX_FLOAT srcTop, 197 FX_FLOAT srcTop,
217 const CFX_RectF& dstRect, 198 const CFX_RectF& dstRect,
218 const CFX_Matrix* matrix); 199 const CFX_Matrix* matrix);
219 200
220 CFX_RenderDevice* GetRenderDevice();
221
222 FX_ERR InverseRect(const CFX_RectF& rect); 201 FX_ERR InverseRect(const CFX_RectF& rect);
223 FX_ERR XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); 202 FX_ERR XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect);
224 FX_ERR EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); 203 FX_ERR EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect);
225 204
226 private: 205 private:
227 FX_ERR RenderDeviceSetLineDash(FX_DashStyle dashStyle); 206 FX_ERR RenderDeviceSetLineDash(FX_DashStyle dashStyle);
228
229 FX_ERR RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix); 207 FX_ERR RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix);
230
231 FX_ERR RenderDeviceFillPath(CFX_Path* path, 208 FX_ERR RenderDeviceFillPath(CFX_Path* path,
232 FX_FillMode fillMode, 209 FX_FillMode fillMode,
233 CFX_Matrix* matrix); 210 CFX_Matrix* matrix);
234
235 FX_ERR RenderDeviceDrawImage(CFX_DIBSource* source, 211 FX_ERR RenderDeviceDrawImage(CFX_DIBSource* source,
236 const CFX_PointF& point, 212 const CFX_PointF& point,
237 CFX_Matrix* matrix); 213 CFX_Matrix* matrix);
238
239 FX_ERR RenderDeviceStretchImage(CFX_DIBSource* source, 214 FX_ERR RenderDeviceStretchImage(CFX_DIBSource* source,
240 const CFX_RectF& rect, 215 const CFX_RectF& rect,
241 CFX_Matrix* matrix); 216 CFX_Matrix* matrix);
242
243 FX_ERR RenderDeviceShowText(const CFX_PointF& point, 217 FX_ERR RenderDeviceShowText(const CFX_PointF& point,
244 const CFX_WideString& text, 218 const CFX_WideString& text,
245 CFX_Matrix* matrix); 219 CFX_Matrix* matrix);
246 220
247 FX_ERR StrokePathWithPattern(CFX_Path* path, CFX_Matrix* matrix); 221 FX_ERR StrokePathWithPattern(CFX_Path* path, CFX_Matrix* matrix);
248
249 FX_ERR StrokePathWithShading(CFX_Path* path, CFX_Matrix* matrix); 222 FX_ERR StrokePathWithShading(CFX_Path* path, CFX_Matrix* matrix);
250 223
251 FX_ERR FillPathWithPattern(CFX_Path* path, 224 FX_ERR FillPathWithPattern(CFX_Path* path,
252 FX_FillMode fillMode, 225 FX_FillMode fillMode,
253 CFX_Matrix* matrix); 226 CFX_Matrix* matrix);
254
255 FX_ERR FillPathWithShading(CFX_Path* path, 227 FX_ERR FillPathWithShading(CFX_Path* path,
256 FX_FillMode fillMode, 228 FX_FillMode fillMode,
257 CFX_Matrix* matrix); 229 CFX_Matrix* matrix);
230
258 FX_ERR SetDIBitsWithMatrix(CFX_DIBSource* source, CFX_Matrix* matrix); 231 FX_ERR SetDIBitsWithMatrix(CFX_DIBSource* source, CFX_Matrix* matrix);
259 FX_ERR CalcTextInfo(const CFX_WideString& text, 232 FX_ERR CalcTextInfo(const CFX_WideString& text,
260 FX_DWORD* charCodes, 233 FX_DWORD* charCodes,
261 FXTEXT_CHARPOS* charPos, 234 FXTEXT_CHARPOS* charPos,
262 CFX_RectF& rect); 235 CFX_RectF& rect);
263 236
264 protected: 237 protected:
265 int32_t _type; 238 int32_t m_type;
266 239
267 private: 240 private:
268 struct TInfo { 241 struct TInfo {
269 CFX_GraphStateData _graphState; 242 TInfo()
270 FX_BOOL _isAntialiasing; 243 : isAntialiasing(TRUE),
271 FX_StrokeAlignment _strokeAlignment; 244 strokeAlignment(FX_STROKEALIGNMENT_Center),
272 CFX_Matrix _CTM; 245 isActOnDash(FALSE),
273 FX_BOOL _isActOnDash; 246 strokeColor(nullptr),
274 CFX_Color* _strokeColor; 247 fillColor(nullptr),
275 CFX_Color* _fillColor; 248 font(nullptr),
276 CFX_Font* _font; 249 fontSize(40.0),
277 FX_FLOAT _fontSize; 250 fontHScale(1.0),
278 FX_FLOAT _fontHScale; 251 fontSpacing(0.0) {}
279 FX_FLOAT _fontSpacing; 252 explicit TInfo(const TInfo& info);
280 } _info; 253 TInfo& operator=(const TInfo& other);
281 CFX_RenderDevice* _renderDevice; 254
282 CFX_PtrArray _infoStack; 255 CFX_GraphStateData graphState;
283 CAGG_Graphics* _aggGraphics; 256 FX_BOOL isAntialiasing;
257 FX_StrokeAlignment strokeAlignment;
258 CFX_Matrix CTM;
259 FX_BOOL isActOnDash;
260 CFX_Color* strokeColor;
261 CFX_Color* fillColor;
262 CFX_Font* font;
263 FX_FLOAT fontSize;
264 FX_FLOAT fontHScale;
265 FX_FLOAT fontSpacing;
266 } m_info;
267 CFX_RenderDevice* m_renderDevice;
268 CFX_PtrArray m_infoStack;
269 CAGG_Graphics* m_aggGraphics;
284 friend class CAGG_Graphics; 270 friend class CAGG_Graphics;
285 }; 271 };
272
286 class CFX_Path { 273 class CFX_Path {
287 public: 274 public:
288 CFX_Path(); 275 CFX_Path();
276 virtual ~CFX_Path();
289 277
290 FX_ERR Create(); 278 FX_ERR Create();
291
292 virtual ~CFX_Path();
293
294 FX_ERR MoveTo(FX_FLOAT x, FX_FLOAT y); 279 FX_ERR MoveTo(FX_FLOAT x, FX_FLOAT y);
295
296 FX_ERR LineTo(FX_FLOAT x, FX_FLOAT y); 280 FX_ERR LineTo(FX_FLOAT x, FX_FLOAT y);
297
298 FX_ERR BezierTo(FX_FLOAT ctrlX1, 281 FX_ERR BezierTo(FX_FLOAT ctrlX1,
299 FX_FLOAT ctrlY1, 282 FX_FLOAT ctrlY1,
300 FX_FLOAT ctrlX2, 283 FX_FLOAT ctrlX2,
301 FX_FLOAT ctrlY2, 284 FX_FLOAT ctrlY2,
302 FX_FLOAT toX, 285 FX_FLOAT toX,
303 FX_FLOAT toY); 286 FX_FLOAT toY);
304
305 FX_ERR ArcTo(FX_FLOAT left, 287 FX_ERR ArcTo(FX_FLOAT left,
306 FX_FLOAT top, 288 FX_FLOAT top,
307 FX_FLOAT width, 289 FX_FLOAT width,
308 FX_FLOAT height, 290 FX_FLOAT height,
309 FX_FLOAT startAngle, 291 FX_FLOAT startAngle,
310 FX_FLOAT sweepAngle); 292 FX_FLOAT sweepAngle);
311
312 FX_ERR Close(); 293 FX_ERR Close();
313 294
314 FX_ERR AddLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); 295 FX_ERR AddLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2);
315
316 FX_ERR AddBezier(FX_FLOAT startX, 296 FX_ERR AddBezier(FX_FLOAT startX,
317 FX_FLOAT startY, 297 FX_FLOAT startY,
318 FX_FLOAT ctrlX1, 298 FX_FLOAT ctrlX1,
319 FX_FLOAT ctrlY1, 299 FX_FLOAT ctrlY1,
320 FX_FLOAT ctrlX2, 300 FX_FLOAT ctrlX2,
321 FX_FLOAT ctrlY2, 301 FX_FLOAT ctrlY2,
322 FX_FLOAT endX, 302 FX_FLOAT endX,
323 FX_FLOAT endY); 303 FX_FLOAT endY);
324
325 FX_ERR AddRectangle(FX_FLOAT left, 304 FX_ERR AddRectangle(FX_FLOAT left,
326 FX_FLOAT top, 305 FX_FLOAT top,
327 FX_FLOAT width, 306 FX_FLOAT width,
328 FX_FLOAT height); 307 FX_FLOAT height);
329
330 FX_ERR AddEllipse(FX_FLOAT left, 308 FX_ERR AddEllipse(FX_FLOAT left,
331 FX_FLOAT top, 309 FX_FLOAT top,
332 FX_FLOAT width, 310 FX_FLOAT width,
333 FX_FLOAT height); 311 FX_FLOAT height);
334
335 FX_ERR AddEllipse(const CFX_RectF& rect); 312 FX_ERR AddEllipse(const CFX_RectF& rect);
336
337 FX_ERR AddArc(FX_FLOAT left, 313 FX_ERR AddArc(FX_FLOAT left,
338 FX_FLOAT top, 314 FX_FLOAT top,
339 FX_FLOAT width, 315 FX_FLOAT width,
340 FX_FLOAT height, 316 FX_FLOAT height,
341 FX_FLOAT startAngle, 317 FX_FLOAT startAngle,
342 FX_FLOAT sweepAngle); 318 FX_FLOAT sweepAngle);
343
344 FX_ERR AddPie(FX_FLOAT left, 319 FX_ERR AddPie(FX_FLOAT left,
345 FX_FLOAT top, 320 FX_FLOAT top,
346 FX_FLOAT width, 321 FX_FLOAT width,
347 FX_FLOAT height, 322 FX_FLOAT height,
348 FX_FLOAT startAngle, 323 FX_FLOAT startAngle,
349 FX_FLOAT sweepAngle); 324 FX_FLOAT sweepAngle);
350
351 FX_ERR AddSubpath(CFX_Path* path); 325 FX_ERR AddSubpath(CFX_Path* path);
352
353 FX_ERR Clear(); 326 FX_ERR Clear();
354 327
355 FX_BOOL IsEmpty(); 328 FX_BOOL IsEmpty();
356
357 CFX_PathData* GetPathData(); 329 CFX_PathData* GetPathData();
358 330
359 private: 331 private:
360 CFX_PathGenerator* _generator; 332 CFX_PathGenerator* m_generator;
361 }; 333 };
334
362 class CFX_Color { 335 class CFX_Color {
363 public: 336 public:
364 CFX_Color(); 337 CFX_Color();
365 338 // TODO(weili): Remove implicit conversions. Make this explicit.
366 CFX_Color(const FX_ARGB argb); 339 CFX_Color(const FX_ARGB argb);
367 340 explicit CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb = 0x0);
368 CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb = 0x0); 341 explicit CFX_Color(CFX_Shading* shading);
369
370 CFX_Color(CFX_Shading* shading);
371
372 virtual ~CFX_Color(); 342 virtual ~CFX_Color();
373 343
374 FX_ERR Set(const FX_ARGB argb); 344 FX_ERR Set(const FX_ARGB argb);
375
376 FX_ERR Set(CFX_Pattern* pattern, const FX_ARGB argb = 0x0); 345 FX_ERR Set(CFX_Pattern* pattern, const FX_ARGB argb = 0x0);
377
378 FX_ERR Set(CFX_Shading* shading); 346 FX_ERR Set(CFX_Shading* shading);
379 347
380 private: 348 private:
381 int32_t _type; 349 int32_t m_type;
382 union { 350 union {
383 struct { 351 struct {
384 FX_ARGB _argb; 352 FX_ARGB argb;
385 CFX_Pattern* _pattern; 353 CFX_Pattern* pattern;
386 }; 354 } m_info;
387 CFX_Shading* _shading; 355 CFX_Shading* m_shading;
388 }; 356 };
389 357
390 friend class CFX_Graphics; 358 friend class CFX_Graphics;
391 }; 359 };
360
392 class CFX_Pattern { 361 class CFX_Pattern {
393 public: 362 public:
394 CFX_Pattern(); 363 CFX_Pattern();
364 virtual ~CFX_Pattern();
395 365
396 FX_ERR Create(CFX_DIBitmap* bitmap, 366 FX_ERR Create(CFX_DIBitmap* bitmap,
397 const FX_FLOAT xStep, 367 const FX_FLOAT xStep,
398 const FX_FLOAT yStep, 368 const FX_FLOAT yStep,
399 CFX_Matrix* matrix = NULL); 369 CFX_Matrix* matrix = NULL);
400
401 FX_ERR Create(FX_HatchStyle hatchStyle, 370 FX_ERR Create(FX_HatchStyle hatchStyle,
402 const FX_ARGB foreArgb, 371 const FX_ARGB foreArgb,
403 const FX_ARGB backArgb, 372 const FX_ARGB backArgb,
404 CFX_Matrix* matrix = NULL); 373 CFX_Matrix* matrix = NULL);
405 374
406 virtual ~CFX_Pattern();
407
408 private: 375 private:
409 int32_t _type; 376 int32_t m_type;
410 CFX_Matrix _matrix; 377 CFX_Matrix m_matrix;
411 union { 378 union {
412 struct { 379 struct {
413 CFX_RectF _rect; 380 CFX_RectF rect;
414 FX_FLOAT _xStep; 381 FX_FLOAT xStep;
415 FX_FLOAT _yStep; 382 FX_FLOAT yStep;
416 FX_BOOL _isColored; 383 FX_BOOL isColored;
417 }; 384 } m_rectInfo;
418 struct { 385 struct {
419 CFX_DIBitmap* _bitmap; 386 CFX_DIBitmap* bitmap;
420 FX_FLOAT _x1Step; 387 FX_FLOAT x1Step;
421 FX_FLOAT _y1Step; 388 FX_FLOAT y1Step;
422 }; 389 } m_bitmapInfo;
423 struct { 390 struct {
424 FX_HatchStyle _hatchStyle; 391 FX_HatchStyle hatchStyle;
425 FX_ARGB _foreArgb; 392 FX_ARGB foreArgb;
426 FX_ARGB _backArgb; 393 FX_ARGB backArgb;
427 }; 394 } m_hatchInfo;
428 }; 395 };
429 friend class CFX_Graphics; 396 friend class CFX_Graphics;
430 }; 397 };
398
431 class CFX_Shading { 399 class CFX_Shading {
432 public: 400 public:
433 CFX_Shading(); 401 CFX_Shading();
402 virtual ~CFX_Shading();
434 403
435 FX_ERR CreateAxial(const CFX_PointF& beginPoint, 404 FX_ERR CreateAxial(const CFX_PointF& beginPoint,
436 const CFX_PointF& endPoint, 405 const CFX_PointF& endPoint,
437 FX_BOOL isExtendedBegin, 406 FX_BOOL isExtendedBegin,
438 FX_BOOL isExtendedEnd, 407 FX_BOOL isExtendedEnd,
439 const FX_ARGB beginArgb, 408 const FX_ARGB beginArgb,
440 const FX_ARGB endArgb); 409 const FX_ARGB endArgb);
441
442 FX_ERR CreateRadial(const CFX_PointF& beginPoint, 410 FX_ERR CreateRadial(const CFX_PointF& beginPoint,
443 const CFX_PointF& endPoint, 411 const CFX_PointF& endPoint,
444 const FX_FLOAT beginRadius, 412 const FX_FLOAT beginRadius,
445 const FX_FLOAT endRadius, 413 const FX_FLOAT endRadius,
446 FX_BOOL isExtendedBegin, 414 FX_BOOL isExtendedBegin,
447 FX_BOOL isExtendedEnd, 415 FX_BOOL isExtendedEnd,
448 const FX_ARGB beginArgb, 416 const FX_ARGB beginArgb,
449 const FX_ARGB endArgb); 417 const FX_ARGB endArgb);
450 418
451 virtual ~CFX_Shading();
452
453 private: 419 private:
454 FX_ERR InitArgbArray(); 420 FX_ERR InitArgbArray();
455 421
456 private: 422 int32_t m_type;
457 int32_t _type; 423 CFX_PointF m_beginPoint;
458 CFX_PointF _beginPoint; 424 CFX_PointF m_endPoint;
459 CFX_PointF _endPoint; 425 FX_FLOAT m_beginRadius;
460 FX_FLOAT _beginRadius; 426 FX_FLOAT m_endRadius;
461 FX_FLOAT _endRadius; 427 FX_BOOL m_isExtendedBegin;
462 FX_BOOL _isExtendedBegin; 428 FX_BOOL m_isExtendedEnd;
463 FX_BOOL _isExtendedEnd; 429 FX_ARGB m_beginArgb;
464 FX_ARGB _beginArgb; 430 FX_ARGB m_endArgb;
465 FX_ARGB _endArgb; 431 FX_ARGB m_argbArray[FX_SHADING_Steps];
466 FX_ARGB _argbArray[FX_SHADING_Steps];
467 friend class CFX_Graphics; 432 friend class CFX_Graphics;
468 }; 433 };
469 434
470 #endif // XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_ 435 #endif // XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_
OLDNEW
« no previous file with comments | « xfa/fxgraphics/fx_graphics.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698