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