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