| OLD | NEW |
| 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 __H_FX_GRAPHICS__ | 7 #ifndef __H_FX_GRAPHICS__ |
| 8 #define __H_FX_GRAPHICS__ | 8 #define __H_FX_GRAPHICS__ |
| 9 | 9 |
| 10 typedef int FX_ERR; | 10 typedef int FX_ERR; |
| 11 #define FX_ERR_Succeeded 0 | 11 #define FX_ERR_Succeeded 0 |
| 12 #define FX_ERR_Indefinite -1 | 12 #define FX_ERR_Indefinite -1 |
| 13 #define FX_ERR_Parameter_Invalid -100 | 13 #define FX_ERR_Parameter_Invalid -100 |
| 14 #define FX_ERR_Property_Invalid -200 | 14 #define FX_ERR_Property_Invalid -200 |
| 15 #define FX_ERR_Intermediate_Value_Invalid -300 | 15 #define FX_ERR_Intermediate_Value_Invalid -300 |
| 16 #define FX_ERR_Method_Not_Supported -400 | 16 #define FX_ERR_Method_Not_Supported -400 |
| 17 #define FX_ERR_Out_Of_Memory -500 | 17 #define FX_ERR_Out_Of_Memory -500 |
| 18 #define _FX_RETURN_IF_FAIL(arg) {if (!(arg)) return;} | 18 #define _FX_RETURN_IF_FAIL(arg) {if (!(arg)) return;} |
| 19 #define _FX_RETURN_VALUE_IF_FAIL(arg, val) {if (!(arg)) return val;} | 19 #define _FX_RETURN_VALUE_IF_FAIL(arg, val) {if (!(arg)) return val;} |
| 20 #define _FX_GOTO_POSITION_IF_FAIL(arg, pos) {if (!(arg)) goto pos;} | 20 #define _FX_GOTO_POSITION_IF_FAIL(arg, pos) {if (!(arg)) goto pos;} |
| 21 #define _FX_ERR_CHECK_RETURN_IF_FAIL(arg) {if ((arg) != FX_ERR_Succeeded) return
;} | 21 #define _FX_ERR_CHECK_RETURN_IF_FAIL(arg) {if ((arg) != FX_ERR_Succeeded) return
;} |
| 22 #define _FX_ERR_CHECK_RETURN_VALUE_IF_FAIL(arg, val) {if ((arg) != FX_ERR_Succee
ded) return val;} | 22 #define _FX_ERR_CHECK_RETURN_VALUE_IF_FAIL(arg, val) {if ((arg) != FX_ERR_Succee
ded) return val;} |
| 23 #define _FX_ERR_CHECK_GOTO_POSITION_IF_FAIL(arg, pos) {if ((arg) != FX_ERR_Succe
eded) goto pos;} | 23 #define _FX_ERR_CHECK_GOTO_POSITION_IF_FAIL(arg, pos) {if ((arg) != FX_ERR_Succe
eded) goto pos;} |
| 24 | 24 |
| 25 #define FX_SHADING_Steps 256 | 25 #define FX_SHADING_Steps 256 |
| 26 typedef FX_INT32 FX_DashStyle; | 26 typedef int32_t FX_DashStyle; |
| 27 enum { | 27 enum { |
| 28 FX_DASHSTYLE_Solid = 0, | 28 FX_DASHSTYLE_Solid = 0, |
| 29 FX_DASHSTYLE_Dash = 1, | 29 FX_DASHSTYLE_Dash = 1, |
| 30 FX_DASHSTYLE_Dot = 2, | 30 FX_DASHSTYLE_Dot = 2, |
| 31 FX_DASHSTYLE_DashDot = 3, | 31 FX_DASHSTYLE_DashDot = 3, |
| 32 FX_DASHSTYLE_DashDotDot = 4 | 32 FX_DASHSTYLE_DashDotDot = 4 |
| 33 }; | 33 }; |
| 34 typedef FX_INT32 FX_StrokeAlignment; | 34 typedef int32_t FX_StrokeAlignment; |
| 35 enum { | 35 enum { |
| 36 FX_STROKEALIGNMENT_Center = 0, | 36 FX_STROKEALIGNMENT_Center = 0, |
| 37 FX_STROKEALIGNMENT_Inset = 1, | 37 FX_STROKEALIGNMENT_Inset = 1, |
| 38 FX_STROKEALIGNMENT_Outset = 2, | 38 FX_STROKEALIGNMENT_Outset = 2, |
| 39 FX_STROKEALIGNMENT_Left = 3, | 39 FX_STROKEALIGNMENT_Left = 3, |
| 40 FX_STROKEALIGNMENT_Right = 4 | 40 FX_STROKEALIGNMENT_Right = 4 |
| 41 }; | 41 }; |
| 42 typedef FX_INT32 FX_HatchStyle; | 42 typedef int32_t FX_HatchStyle; |
| 43 enum { | 43 enum { |
| 44 FX_HATCHSTYLE_Horizontal = 0, | 44 FX_HATCHSTYLE_Horizontal = 0, |
| 45 FX_HATCHSTYLE_Vertical = 1, | 45 FX_HATCHSTYLE_Vertical = 1, |
| 46 FX_HATCHSTYLE_ForwardDiagonal = 2, | 46 FX_HATCHSTYLE_ForwardDiagonal = 2, |
| 47 FX_HATCHSTYLE_BackwardDiagonal = 3, | 47 FX_HATCHSTYLE_BackwardDiagonal = 3, |
| 48 FX_HATCHSTYLE_Cross = 4, | 48 FX_HATCHSTYLE_Cross = 4, |
| 49 FX_HATCHSTYLE_DiagonalCross = 5, | 49 FX_HATCHSTYLE_DiagonalCross = 5, |
| 50 FX_HATCHSTYLE_05Percent = 6, | 50 FX_HATCHSTYLE_05Percent = 6, |
| 51 FX_HATCHSTYLE_10Percent = 7, | 51 FX_HATCHSTYLE_10Percent = 7, |
| 52 FX_HATCHSTYLE_20Percent = 8, | 52 FX_HATCHSTYLE_20Percent = 8, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 FX_HATCHSTYLE_DottedDiamond = 44, | 88 FX_HATCHSTYLE_DottedDiamond = 44, |
| 89 FX_HATCHSTYLE_Shingle = 45, | 89 FX_HATCHSTYLE_Shingle = 45, |
| 90 FX_HATCHSTYLE_Trellis = 46, | 90 FX_HATCHSTYLE_Trellis = 46, |
| 91 FX_HATCHSTYLE_Sphere = 47, | 91 FX_HATCHSTYLE_Sphere = 47, |
| 92 FX_HATCHSTYLE_SmallGrid = 48, | 92 FX_HATCHSTYLE_SmallGrid = 48, |
| 93 FX_HATCHSTYLE_SmallCheckerBoard = 49, | 93 FX_HATCHSTYLE_SmallCheckerBoard = 49, |
| 94 FX_HATCHSTYLE_LargeCheckerBoard = 50, | 94 FX_HATCHSTYLE_LargeCheckerBoard = 50, |
| 95 FX_HATCHSTYLE_OutlinedDiamond = 51, | 95 FX_HATCHSTYLE_OutlinedDiamond = 51, |
| 96 FX_HATCHSTYLE_SolidDiamond = 52 | 96 FX_HATCHSTYLE_SolidDiamond = 52 |
| 97 }; | 97 }; |
| 98 typedef FX_INT32 FX_DeviceCap; | 98 typedef int32_t FX_DeviceCap; |
| 99 typedef FX_INT32 FX_FillMode; | 99 typedef int32_t FX_FillMode; |
| 100 class CFX_RenderDevice; | 100 class CFX_RenderDevice; |
| 101 class CFX_GraphStateData; | 101 class CFX_GraphStateData; |
| 102 class CFX_Matrix; | 102 class CFX_Matrix; |
| 103 class CFX_DIBSource; | 103 class CFX_DIBSource; |
| 104 class CFX_DIBitmap; | 104 class CFX_DIBitmap; |
| 105 class CFX_Font; | 105 class CFX_Font; |
| 106 class CFX_WideString; | 106 class CFX_WideString; |
| 107 class IFX_FileRead; | 107 class IFX_FileRead; |
| 108 class CFX_PathGenerator; | 108 class CFX_PathGenerator; |
| 109 class CAGG_Graphics; | 109 class CAGG_Graphics; |
| 110 class CFX_Graphics; | 110 class CFX_Graphics; |
| 111 class CFX_Color; | 111 class CFX_Color; |
| 112 class CFX_Path; | 112 class CFX_Path; |
| 113 class CFX_Pattern; | 113 class CFX_Pattern; |
| 114 class CFX_Shading; | 114 class CFX_Shading; |
| 115 class CFX_Graphics | 115 class CFX_Graphics |
| 116 { | 116 { |
| 117 public: | 117 public: |
| 118 | 118 |
| 119 | 119 |
| 120 CFX_Graphics(); | 120 CFX_Graphics(); |
| 121 | 121 |
| 122 FX_ERR Create(CFX_RenderDevice * renderDevice, FX_BOOL isAntialiasing = TRUE
); | 122 FX_ERR Create(CFX_RenderDevice * renderDevice, FX_BOOL isAntialiasing = TRUE
); |
| 123 | 123 |
| 124 FX_ERR Create(FX_INT32» width, | 124 FX_ERR Create(int32_t» width, |
| 125 FX_INT32» height, | 125 int32_t» height, |
| 126 FXDIB_Format format, | 126 FXDIB_Format format, |
| 127 FX_BOOL isNative = TRUE, | 127 FX_BOOL isNative = TRUE, |
| 128 FX_BOOL isAntialiasing = TRUE); | 128 FX_BOOL isAntialiasing = TRUE); |
| 129 | 129 |
| 130 | 130 |
| 131 virtual ~CFX_Graphics(); | 131 virtual ~CFX_Graphics(); |
| 132 | 132 |
| 133 | 133 |
| 134 | 134 |
| 135 FX_ERR GetDeviceCap(const FX_INT32 capID, FX_DeviceCap & capVal); | 135 FX_ERR GetDeviceCap(const int32_t capID, FX_DeviceCap & capVal); |
| 136 FX_ERR IsPrinterDevice(FX_BOOL & isPrinter); | 136 FX_ERR IsPrinterDevice(FX_BOOL & isPrinter); |
| 137 FX_ERR EnableAntialiasing(FX_BOOL isAntialiasing); | 137 FX_ERR EnableAntialiasing(FX_BOOL isAntialiasing); |
| 138 | 138 |
| 139 | 139 |
| 140 | 140 |
| 141 FX_ERR SaveGraphState(); | 141 FX_ERR SaveGraphState(); |
| 142 | 142 |
| 143 FX_ERR RestoreGraphState(); | 143 FX_ERR RestoreGraphState(); |
| 144 | 144 |
| 145 | 145 |
| 146 | 146 |
| 147 FX_ERR GetLineCap(CFX_GraphStateData::LineCap & lineCap); | 147 FX_ERR GetLineCap(CFX_GraphStateData::LineCap & lineCap); |
| 148 | 148 |
| 149 FX_ERR SetLineCap(CFX_GraphStateData::LineCap lineCap); | 149 FX_ERR SetLineCap(CFX_GraphStateData::LineCap lineCap); |
| 150 | 150 |
| 151 FX_ERR GetDashCount(FX_INT32 & dashCount); | 151 FX_ERR GetDashCount(int32_t & dashCount); |
| 152 | 152 |
| 153 FX_ERR GetLineDash(FX_FLOAT & dashPhase, FX_FLOAT * dashArray); | 153 FX_ERR GetLineDash(FX_FLOAT & dashPhase, FX_FLOAT * dashArray); |
| 154 | 154 |
| 155 FX_ERR SetLineDash(FX_FLOAT dashPhase, FX_FLOAT * dashArray, FX_INT32 dashCo
unt); | 155 FX_ERR SetLineDash(FX_FLOAT dashPhase, FX_FLOAT * dashArray, int32_t dashCou
nt); |
| 156 | 156 |
| 157 FX_ERR SetLineDash(FX_DashStyle dashStyle); | 157 FX_ERR SetLineDash(FX_DashStyle dashStyle); |
| 158 | 158 |
| 159 FX_ERR GetLineJoin(CFX_GraphStateData::LineJoin & lineJoin); | 159 FX_ERR GetLineJoin(CFX_GraphStateData::LineJoin & lineJoin); |
| 160 | 160 |
| 161 FX_ERR SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); | 161 FX_ERR SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); |
| 162 | 162 |
| 163 FX_ERR GetMiterLimit(FX_FLOAT & miterLimit); | 163 FX_ERR GetMiterLimit(FX_FLOAT & miterLimit); |
| 164 | 164 |
| 165 FX_ERR SetMiterLimit(FX_FLOAT miterLimit); | 165 FX_ERR SetMiterLimit(FX_FLOAT miterLimit); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 | 218 |
| 219 FX_ERR SetFont(CFX_Font * font); | 219 FX_ERR SetFont(CFX_Font * font); |
| 220 | 220 |
| 221 FX_ERR SetFontSize(const FX_FLOAT size); | 221 FX_ERR SetFontSize(const FX_FLOAT size); |
| 222 | 222 |
| 223 FX_ERR SetFontHScale(const FX_FLOAT scale); | 223 FX_ERR SetFontHScale(const FX_FLOAT scale); |
| 224 | 224 |
| 225 FX_ERR SetCharSpacing(const FX_FLOAT spacing); | 225 FX_ERR SetCharSpacing(const FX_FLOAT spacing); |
| 226 | 226 |
| 227 FX_ERR SetTextDrawingMode(const FX_INT32 mode); | 227 FX_ERR SetTextDrawingMode(const int32_t mode); |
| 228 | 228 |
| 229 | 229 |
| 230 FX_ERR ShowText(const CFX_PointF & point, | 230 FX_ERR ShowText(const CFX_PointF & point, |
| 231 const CFX_WideString & text, | 231 const CFX_WideString & text, |
| 232 CFX_Matrix * matrix = NULL); | 232 CFX_Matrix * matrix = NULL); |
| 233 | 233 |
| 234 | 234 |
| 235 FX_ERR CalcTextRect(CFX_RectF & rect, | 235 FX_ERR CalcTextRect(CFX_RectF & rect, |
| 236 const CFX_WideString & text, | 236 const CFX_WideString & text, |
| 237 FX_BOOL isMultiline = FALSE, | 237 FX_BOOL isMultiline = FALSE, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 CFX_Matrix * matrix); | 288 CFX_Matrix * matrix); |
| 289 | 289 |
| 290 FX_ERR FillPathWithShading(CFX_Path * path, | 290 FX_ERR FillPathWithShading(CFX_Path * path, |
| 291 FX_FillMode fillMode, | 291 FX_FillMode fillMode, |
| 292 CFX_Matrix * matrix); | 292 CFX_Matrix * matrix); |
| 293 FX_ERR SetDIBitsWithMatrix(CFX_DIBSource * source, CFX_Matrix * matrix); | 293 FX_ERR SetDIBitsWithMatrix(CFX_DIBSource * source, CFX_Matrix * matrix); |
| 294 FX_ERR CalcTextInfo(const CFX_WideString & text, FX_DWORD * charCodes, FXTEX
T_CHARPOS * charPos, CFX_RectF & rect); | 294 FX_ERR CalcTextInfo(const CFX_WideString & text, FX_DWORD * charCodes, FXTEX
T_CHARPOS * charPos, CFX_RectF & rect); |
| 295 | 295 |
| 296 | 296 |
| 297 protected: | 297 protected: |
| 298 FX_INT32» » _type; | 298 int32_t» » _type; |
| 299 private: | 299 private: |
| 300 struct TInfo { | 300 struct TInfo { |
| 301 CFX_GraphStateData _graphState; | 301 CFX_GraphStateData _graphState; |
| 302 FX_BOOL _isAntialiasing; | 302 FX_BOOL _isAntialiasing; |
| 303 FX_StrokeAlignment _strokeAlignment; | 303 FX_StrokeAlignment _strokeAlignment; |
| 304 CFX_Matrix _CTM; | 304 CFX_Matrix _CTM; |
| 305 FX_BOOL _isActOnDash; | 305 FX_BOOL _isActOnDash; |
| 306 CFX_Color * _strokeColor; | 306 CFX_Color * _strokeColor; |
| 307 CFX_Color * _fillColor; | 307 CFX_Color * _fillColor; |
| 308 CFX_Font * _font; | 308 CFX_Font * _font; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 FX_ERR Set(const FX_ARGB argb); | 411 FX_ERR Set(const FX_ARGB argb); |
| 412 | 412 |
| 413 | 413 |
| 414 FX_ERR Set(CFX_Pattern * pattern, const FX_ARGB argb = 0x0); | 414 FX_ERR Set(CFX_Pattern * pattern, const FX_ARGB argb = 0x0); |
| 415 | 415 |
| 416 | 416 |
| 417 FX_ERR Set(CFX_Shading * shading); | 417 FX_ERR Set(CFX_Shading * shading); |
| 418 | 418 |
| 419 private: | 419 private: |
| 420 FX_INT32» » » » _type; | 420 int32_t» » » » _type; |
| 421 union { | 421 union { |
| 422 struct { | 422 struct { |
| 423 FX_ARGB _argb; | 423 FX_ARGB _argb; |
| 424 CFX_Pattern * _pattern; | 424 CFX_Pattern * _pattern; |
| 425 }; | 425 }; |
| 426 CFX_Shading * _shading; | 426 CFX_Shading * _shading; |
| 427 }; | 427 }; |
| 428 | 428 |
| 429 friend class CFX_Graphics; | 429 friend class CFX_Graphics; |
| 430 }; | 430 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 441 CFX_Matrix * matrix = NULL); | 441 CFX_Matrix * matrix = NULL); |
| 442 | 442 |
| 443 FX_ERR Create(FX_HatchStyle hatchStyle, | 443 FX_ERR Create(FX_HatchStyle hatchStyle, |
| 444 const FX_ARGB foreArgb, | 444 const FX_ARGB foreArgb, |
| 445 const FX_ARGB backArgb, | 445 const FX_ARGB backArgb, |
| 446 CFX_Matrix * matrix = NULL); | 446 CFX_Matrix * matrix = NULL); |
| 447 | 447 |
| 448 virtual ~CFX_Pattern(); | 448 virtual ~CFX_Pattern(); |
| 449 | 449 |
| 450 private: | 450 private: |
| 451 FX_INT32» » » » _type; | 451 int32_t» » » » _type; |
| 452 CFX_Matrix _matrix; | 452 CFX_Matrix _matrix; |
| 453 union { | 453 union { |
| 454 struct { | 454 struct { |
| 455 CFX_RectF _rect; | 455 CFX_RectF _rect; |
| 456 FX_FLOAT _xStep; | 456 FX_FLOAT _xStep; |
| 457 FX_FLOAT _yStep; | 457 FX_FLOAT _yStep; |
| 458 FX_BOOL _isColored; | 458 FX_BOOL _isColored; |
| 459 }; | 459 }; |
| 460 struct { | 460 struct { |
| 461 CFX_DIBitmap * _bitmap; | 461 CFX_DIBitmap * _bitmap; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 491 FX_BOOL isExtendedBegin, | 491 FX_BOOL isExtendedBegin, |
| 492 FX_BOOL isExtendedEnd, | 492 FX_BOOL isExtendedEnd, |
| 493 const FX_ARGB beginArgb, | 493 const FX_ARGB beginArgb, |
| 494 const FX_ARGB endArgb); | 494 const FX_ARGB endArgb); |
| 495 | 495 |
| 496 virtual ~CFX_Shading(); | 496 virtual ~CFX_Shading(); |
| 497 | 497 |
| 498 private: | 498 private: |
| 499 FX_ERR InitArgbArray(); | 499 FX_ERR InitArgbArray(); |
| 500 private: | 500 private: |
| 501 FX_INT32» _type; | 501 int32_t» _type; |
| 502 CFX_PointF _beginPoint; | 502 CFX_PointF _beginPoint; |
| 503 CFX_PointF _endPoint; | 503 CFX_PointF _endPoint; |
| 504 FX_FLOAT _beginRadius; | 504 FX_FLOAT _beginRadius; |
| 505 FX_FLOAT _endRadius; | 505 FX_FLOAT _endRadius; |
| 506 FX_BOOL _isExtendedBegin; | 506 FX_BOOL _isExtendedBegin; |
| 507 FX_BOOL _isExtendedEnd; | 507 FX_BOOL _isExtendedEnd; |
| 508 FX_ARGB _beginArgb; | 508 FX_ARGB _beginArgb; |
| 509 FX_ARGB _endArgb; | 509 FX_ARGB _endArgb; |
| 510 FX_ARGB _argbArray[FX_SHADING_Steps]; | 510 FX_ARGB _argbArray[FX_SHADING_Steps]; |
| 511 friend class CFX_Graphics; | 511 friend class CFX_Graphics; |
| 512 }; | 512 }; |
| 513 #endif | 513 #endif |
| OLD | NEW |