blob: dd806a356ae392c80e3e55a9137e3136216082e9 [file] [log] [blame]
Florin Malitab3418102020-10-15 18:10:29 -04001/*
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
14class SkSVGRenderContext;
15
16enum 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,
Tyler Dennistonb3cafbc2020-10-30 15:00:48 -040026 kFilter,
Florin Malitab3418102020-10-15 18:10:29 -040027 kFontFamily,
28 kFontSize,
29 kFontStyle,
30 kFontWeight,
31 kFx, // <radialGradient>: focal point x position
32 kFy, // <radialGradient>: focal point y position
Tyler Dennistonab76ab42020-10-21 15:08:45 -040033 kGradientUnits,
Florin Malitab3418102020-10-15 18:10:29 -040034 kGradientTransform,
35 kHeight,
36 kHref,
37 kOffset,
38 kOpacity,
39 kPatternTransform,
40 kPoints,
Florin Malita385e7442020-10-21 16:55:46 -040041 kPreserveAspectRatio,
Florin Malitab3418102020-10-15 18:10:29 -040042 kR, // <circle>, <radialGradient>: radius
43 kRx, // <ellipse>,<rect>: horizontal (corner) radius
44 kRy, // <ellipse>,<rect>: vertical (corner) radius
45 kSpreadMethod,
46 kStopColor,
47 kStopOpacity,
48 kStroke,
49 kStrokeDashArray,
50 kStrokeDashOffset,
51 kStrokeOpacity,
52 kStrokeLineCap,
53 kStrokeLineJoin,
54 kStrokeMiterLimit,
55 kStrokeWidth,
56 kTransform,
57 kText,
58 kTextAnchor,
59 kViewBox,
60 kVisibility,
61 kWidth,
62 kX,
63 kX1, // <line>: first endpoint x
64 kX2, // <line>: second endpoint x
65 kY,
66 kY1, // <line>: first endpoint y
67 kY2, // <line>: second endpoint y
68
69 kUnknown,
70};
71
72struct SkSVGPresentationAttributes {
73 static SkSVGPresentationAttributes MakeInitial();
74
75 // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead.
76
77 SkTLazy<SkSVGPaint> fFill;
78 SkTLazy<SkSVGNumberType> fFillOpacity;
79 SkTLazy<SkSVGFillRule> fFillRule;
80 SkTLazy<SkSVGFillRule> fClipRule;
81
82 SkTLazy<SkSVGPaint> fStroke;
83 SkTLazy<SkSVGDashArray> fStrokeDashArray;
84 SkTLazy<SkSVGLength> fStrokeDashOffset;
85 SkTLazy<SkSVGLineCap> fStrokeLineCap;
86 SkTLazy<SkSVGLineJoin> fStrokeLineJoin;
87 SkTLazy<SkSVGNumberType> fStrokeMiterLimit;
88 SkTLazy<SkSVGNumberType> fStrokeOpacity;
89 SkTLazy<SkSVGLength> fStrokeWidth;
90
91 SkTLazy<SkSVGVisibility> fVisibility;
92
93 SkTLazy<SkSVGColorType> fColor;
94
Florin Malita39fe8c82020-10-20 10:43:03 -040095 SkTLazy<SkSVGFontFamily> fFontFamily;
96 SkTLazy<SkSVGFontStyle> fFontStyle;
97 SkTLazy<SkSVGFontSize> fFontSize;
98 SkTLazy<SkSVGFontWeight> fFontWeight;
Florin Malita056385b2020-10-27 22:57:56 -040099 SkTLazy<SkSVGTextAnchor> fTextAnchor;
Florin Malita39fe8c82020-10-20 10:43:03 -0400100
Florin Malitab3418102020-10-15 18:10:29 -0400101 // TODO(tdenniston): add SkSVGStopColor
102
103 // uninherited
104 SkTLazy<SkSVGNumberType> fOpacity;
105 SkTLazy<SkSVGClip> fClipPath;
Tyler Dennistonb3cafbc2020-10-30 15:00:48 -0400106 SkTLazy<SkSVGFilterType> fFilter;
Florin Malitab3418102020-10-15 18:10:29 -0400107};
108
109#endif // SkSVGAttribute_DEFINED