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 kClipRule, 18 kColor, 19 kColorInterpolation, 20 kColorInterpolationFilters, 21 kCx, // <circle>, <ellipse>, <radialGradient>: center x position 22 kCy, // <circle>, <ellipse>, <radialGradient>: center y position 23 kFill, 24 kFillOpacity, 25 kFillRule, 26 kFilter, 27 kFilterUnits, 28 kFontFamily, 29 kFontSize, 30 kFontStyle, 31 kFontWeight, 32 kFx, // <radialGradient>: focal point x position 33 kFy, // <radialGradient>: focal point y position 34 kGradientUnits, 35 kGradientTransform, 36 kHeight, 37 kHref, 38 kOpacity, 39 kPoints, 40 kPreserveAspectRatio, 41 kR, // <circle>, <radialGradient>: radius 42 kRx, // <ellipse>,<rect>: horizontal (corner) radius 43 kRy, // <ellipse>,<rect>: vertical (corner) radius 44 kSpreadMethod, 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: SkSVGProperty adds an extra ptr per attribute; refactor to reduce overhead. 73 74 SkSVGProperty<SkSVGPaint , true> fFill; 75 SkSVGProperty<SkSVGNumberType, true> fFillOpacity; 76 SkSVGProperty<SkSVGFillRule , true> fFillRule; 77 SkSVGProperty<SkSVGFillRule , true> fClipRule; 78 79 SkSVGProperty<SkSVGPaint , true> fStroke; 80 SkSVGProperty<SkSVGDashArray , true> fStrokeDashArray; 81 SkSVGProperty<SkSVGLength , true> fStrokeDashOffset; 82 SkSVGProperty<SkSVGLineCap , true> fStrokeLineCap; 83 SkSVGProperty<SkSVGLineJoin , true> fStrokeLineJoin; 84 SkSVGProperty<SkSVGNumberType, true> fStrokeMiterLimit; 85 SkSVGProperty<SkSVGNumberType, true> fStrokeOpacity; 86 SkSVGProperty<SkSVGLength , true> fStrokeWidth; 87 88 SkSVGProperty<SkSVGVisibility, true> fVisibility; 89 90 SkSVGProperty<SkSVGColorType , true> fColor; 91 SkSVGProperty<SkSVGColorspace, true> fColorInterpolation; 92 SkSVGProperty<SkSVGColorspace, true> fColorInterpolationFilters; 93 94 SkSVGProperty<SkSVGFontFamily, true> fFontFamily; 95 SkSVGProperty<SkSVGFontStyle , true> fFontStyle; 96 SkSVGProperty<SkSVGFontSize , true> fFontSize; 97 SkSVGProperty<SkSVGFontWeight, true> fFontWeight; 98 SkSVGProperty<SkSVGTextAnchor, true> fTextAnchor; 99 100 // uninherited 101 SkSVGProperty<SkSVGNumberType, false> fOpacity; 102 SkSVGProperty<SkSVGFuncIRI , false> fClipPath; 103 SkSVGProperty<SkSVGDisplay , false> fDisplay; 104 SkSVGProperty<SkSVGFuncIRI , false> fMask; 105 SkSVGProperty<SkSVGFuncIRI , false> fFilter; 106 SkSVGProperty<SkSVGColor , false> fStopColor; 107 SkSVGProperty<SkSVGNumberType, false> fStopOpacity; 108 SkSVGProperty<SkSVGColor , false> fFloodColor; 109 SkSVGProperty<SkSVGNumberType, false> fFloodOpacity; 110 SkSVGProperty<SkSVGColor , false> fLightingColor; 111 }; 112 113 #endif // SkSVGAttribute_DEFINED 114