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 "experimental/svg/model/SkSVGTypes.h" 12 #include "src/core/SkTLazy.h" 13 14 class SkSVGRenderContext; 15 16 enum class SkSVGAttribute { 17 kClipPath, 18 kClipRule, 19 kCx, // <circle>, <ellipse>, <radialGradient>: center x position 20 kCy, // <circle>, <ellipse>, <radialGradient>: center y position 21 kD, 22 kFill, 23 kFillOpacity, 24 kFillRule, 25 kFontFamily, 26 kFontSize, 27 kFx, // <radialGradient>: focal point x position 28 kFy, // <radialGradient>: focal point y position 29 kGradientTransform, 30 kHeight, 31 kHref, 32 kOffset, 33 kOpacity, 34 kPatternTransform, 35 kPoints, 36 kR, // <circle>, <radialGradient>: radius 37 kRx, // <ellipse>,<rect>: horizontal (corner) radius 38 kRy, // <ellipse>,<rect>: vertical (corner) radius 39 kSpreadMethod, 40 kStopColor, 41 kStopOpacity, 42 kStroke, 43 kStrokeDashArray, 44 kStrokeDashOffset, 45 kStrokeOpacity, 46 kStrokeLineCap, 47 kStrokeLineJoin, 48 kStrokeMiterLimit, 49 kStrokeWidth, 50 kTransform, 51 kText, 52 kTextAnchor, 53 kViewBox, 54 kVisibility, 55 kWidth, 56 kX, 57 kX1, // <line>: first endpoint x 58 kX2, // <line>: second endpoint x 59 kY, 60 kY1, // <line>: first endpoint y 61 kY2, // <line>: second endpoint y 62 63 kUnknown, 64 }; 65 66 struct SkSVGPresentationAttributes { 67 static SkSVGPresentationAttributes MakeInitial(); 68 69 // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead. 70 71 SkTLazy<SkSVGPaint> fFill; 72 SkTLazy<SkSVGNumberType> fFillOpacity; 73 SkTLazy<SkSVGFillRule> fFillRule; 74 SkTLazy<SkSVGFillRule> fClipRule; 75 76 SkTLazy<SkSVGPaint> fStroke; 77 SkTLazy<SkSVGDashArray> fStrokeDashArray; 78 SkTLazy<SkSVGLength> fStrokeDashOffset; 79 SkTLazy<SkSVGLineCap> fStrokeLineCap; 80 SkTLazy<SkSVGLineJoin> fStrokeLineJoin; 81 SkTLazy<SkSVGNumberType> fStrokeMiterLimit; 82 SkTLazy<SkSVGNumberType> fStrokeOpacity; 83 SkTLazy<SkSVGLength> fStrokeWidth; 84 85 SkTLazy<SkSVGVisibility> fVisibility; 86 87 // uninherited 88 SkTLazy<SkSVGNumberType> fOpacity; 89 SkTLazy<SkSVGClip> fClipPath; 90 }; 91 92 #endif // SkSVGAttribute_DEFINED 93