Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkSVGAttribute_DEFINED |
| 9 | #define SkSVGAttribute_DEFINED |
| 10 | |
| 11 | #include "modules/svg/include/SkSVGTypes.h" |
| 12 | #include "src/core/SkTLazy.h" |
| 13 | |
| 14 | class SkSVGRenderContext; |
| 15 | |
| 16 | enum class SkSVGAttribute { |
| 17 | kClipPath, |
| 18 | kClipRule, |
| 19 | kColor, |
| 20 | kCx, // <circle>, <ellipse>, <radialGradient>: center x position |
| 21 | kCy, // <circle>, <ellipse>, <radialGradient>: center y position |
| 22 | kD, |
| 23 | kFill, |
| 24 | kFillOpacity, |
| 25 | kFillRule, |
| 26 | kFontFamily, |
| 27 | kFontSize, |
| 28 | kFontStyle, |
| 29 | kFontWeight, |
| 30 | kFx, // <radialGradient>: focal point x position |
| 31 | kFy, // <radialGradient>: focal point y position |
| 32 | kGradientTransform, |
| 33 | kHeight, |
| 34 | kHref, |
| 35 | kOffset, |
| 36 | kOpacity, |
| 37 | kPatternTransform, |
| 38 | kPoints, |
| 39 | kR, // <circle>, <radialGradient>: radius |
| 40 | kRx, // <ellipse>,<rect>: horizontal (corner) radius |
| 41 | kRy, // <ellipse>,<rect>: vertical (corner) radius |
| 42 | kSpreadMethod, |
| 43 | kStopColor, |
| 44 | kStopOpacity, |
| 45 | kStroke, |
| 46 | kStrokeDashArray, |
| 47 | kStrokeDashOffset, |
| 48 | kStrokeOpacity, |
| 49 | kStrokeLineCap, |
| 50 | kStrokeLineJoin, |
| 51 | kStrokeMiterLimit, |
| 52 | kStrokeWidth, |
| 53 | kTransform, |
| 54 | kText, |
| 55 | kTextAnchor, |
| 56 | kViewBox, |
| 57 | kVisibility, |
| 58 | kWidth, |
| 59 | kX, |
| 60 | kX1, // <line>: first endpoint x |
| 61 | kX2, // <line>: second endpoint x |
| 62 | kY, |
| 63 | kY1, // <line>: first endpoint y |
| 64 | kY2, // <line>: second endpoint y |
| 65 | |
| 66 | kUnknown, |
| 67 | }; |
| 68 | |
| 69 | struct SkSVGPresentationAttributes { |
| 70 | static SkSVGPresentationAttributes MakeInitial(); |
| 71 | |
| 72 | // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead. |
| 73 | |
| 74 | SkTLazy<SkSVGPaint> fFill; |
| 75 | SkTLazy<SkSVGNumberType> fFillOpacity; |
| 76 | SkTLazy<SkSVGFillRule> fFillRule; |
| 77 | SkTLazy<SkSVGFillRule> fClipRule; |
| 78 | |
| 79 | SkTLazy<SkSVGPaint> fStroke; |
| 80 | SkTLazy<SkSVGDashArray> fStrokeDashArray; |
| 81 | SkTLazy<SkSVGLength> fStrokeDashOffset; |
| 82 | SkTLazy<SkSVGLineCap> fStrokeLineCap; |
| 83 | SkTLazy<SkSVGLineJoin> fStrokeLineJoin; |
| 84 | SkTLazy<SkSVGNumberType> fStrokeMiterLimit; |
| 85 | SkTLazy<SkSVGNumberType> fStrokeOpacity; |
| 86 | SkTLazy<SkSVGLength> fStrokeWidth; |
| 87 | |
| 88 | SkTLazy<SkSVGVisibility> fVisibility; |
| 89 | |
| 90 | SkTLazy<SkSVGColorType> fColor; |
| 91 | |
Florin Malita | 39fe8c8 | 2020-10-20 10:43:03 -0400 | [diff] [blame^] | 92 | SkTLazy<SkSVGFontFamily> fFontFamily; |
| 93 | SkTLazy<SkSVGFontStyle> fFontStyle; |
| 94 | SkTLazy<SkSVGFontSize> fFontSize; |
| 95 | SkTLazy<SkSVGFontWeight> fFontWeight; |
| 96 | |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 97 | // TODO(tdenniston): add SkSVGStopColor |
| 98 | |
| 99 | // uninherited |
| 100 | SkTLazy<SkSVGNumberType> fOpacity; |
| 101 | SkTLazy<SkSVGClip> fClipPath; |
| 102 | }; |
| 103 | |
| 104 | #endif // SkSVGAttribute_DEFINED |