• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkSVGTypes_DEFINED
9 #define SkSVGTypes_DEFINED
10 
11 #include "include/core/SkColor.h"
12 #include "include/core/SkMatrix.h"
13 #include "include/core/SkPath.h"
14 #include "include/core/SkPoint.h"
15 #include "include/core/SkRect.h"
16 #include "include/core/SkRefCnt.h"
17 #include "include/core/SkScalar.h"
18 #include "include/core/SkSpan.h"
19 #include "include/core/SkString.h"
20 #include "include/core/SkTypes.h"
21 #include "include/private/base/SkTDArray.h"
22 #include "src/base/SkTLazy.h"
23 
24 using SkSVGColorType     = SkColor;
25 using SkSVGIntegerType   = int;
26 using SkSVGNumberType    = SkScalar;
27 using SkSVGStringType    = SkString;
28 using SkSVGViewBoxType   = SkRect;
29 using SkSVGTransformType = SkMatrix;
30 using SkSVGPointsType    = SkTDArray<SkPoint>;
31 
32 enum class SkSVGPropertyState {
33     kUnspecified,
34     kInherit,
35     kValue,
36 };
37 
38 // https://www.w3.org/TR/SVG11/intro.html#TermProperty
39 template <typename T, bool kInheritable> class SkSVGProperty {
40 public:
41     using ValueT = T;
42 
SkSVGProperty()43     SkSVGProperty() : fState(SkSVGPropertyState::kUnspecified) {}
44 
SkSVGProperty(SkSVGPropertyState state)45     explicit SkSVGProperty(SkSVGPropertyState state) : fState(state) {}
46 
SkSVGProperty(const T & value)47     explicit SkSVGProperty(const T& value) : fState(SkSVGPropertyState::kValue) {
48         fValue.set(value);
49     }
50 
SkSVGProperty(T && value)51     explicit SkSVGProperty(T&& value) : fState(SkSVGPropertyState::kValue) {
52         fValue.set(std::move(value));
53     }
54 
55     template <typename... Args>
init(Args &&...args)56     void init(Args&&... args) {
57         fState = SkSVGPropertyState::kValue;
58         fValue.init(std::forward<Args>(args)...);
59     }
60 
isInheritable()61     constexpr bool isInheritable() const { return kInheritable; }
62 
isValue()63     bool isValue() const { return fState == SkSVGPropertyState::kValue; }
64 
getMaybeNull()65     T* getMaybeNull() const {
66         return fValue.getMaybeNull();
67     }
68 
set(SkSVGPropertyState state)69     void set(SkSVGPropertyState state) {
70         fState = state;
71         if (fState != SkSVGPropertyState::kValue) {
72             fValue.reset();
73         }
74     }
75 
set(const T & value)76     void set(const T& value) {
77         fState = SkSVGPropertyState::kValue;
78         fValue.set(value);
79     }
80 
set(T && value)81     void set(T&& value) {
82         fState = SkSVGPropertyState::kValue;
83         fValue.set(std::move(value));
84     }
85 
86     T* operator->() {
87         SkASSERT(fState == SkSVGPropertyState::kValue);
88         SkASSERT(fValue.isValid());
89         return fValue.get();
90     }
91 
92     const T* operator->() const {
93         SkASSERT(fState == SkSVGPropertyState::kValue);
94         SkASSERT(fValue.isValid());
95         return fValue.get();
96     }
97 
98     T& operator*() {
99         SkASSERT(fState == SkSVGPropertyState::kValue);
100         SkASSERT(fValue.isValid());
101         return *fValue;
102     }
103 
104     const T& operator*() const {
105         SkASSERT(fState == SkSVGPropertyState::kValue);
106         SkASSERT(fValue.isValid());
107         return *fValue;
108     }
109 
110 private:
111     SkSVGPropertyState fState;
112     SkTLazy<T> fValue;
113 };
114 
115 class SkSVGLength {
116 public:
117     enum class Unit {
118         kUnknown,
119         kNumber,
120         kPercentage,
121         kEMS,
122         kEXS,
123         kPX,
124         kCM,
125         kMM,
126         kIN,
127         kPT,
128         kPC,
129     };
130 
SkSVGLength()131     constexpr SkSVGLength()                    : fValue(0), fUnit(Unit::kUnknown) {}
132     explicit constexpr SkSVGLength(SkScalar v, Unit u = Unit::kNumber)
fValue(v)133         : fValue(v), fUnit(u) {}
134     SkSVGLength(const SkSVGLength&)            = default;
135     SkSVGLength& operator=(const SkSVGLength&) = default;
136 
137     bool operator==(const SkSVGLength& other) const {
138         return fUnit == other.fUnit && fValue == other.fValue;
139     }
140     bool operator!=(const SkSVGLength& other) const { return !(*this == other); }
141 
value()142     const SkScalar& value() const { return fValue; }
unit()143     const Unit&     unit()  const { return fUnit;  }
144 
145 private:
146     SkScalar fValue;
147     Unit     fUnit;
148 };
149 
150 // https://www.w3.org/TR/SVG11/linking.html#IRIReference
151 class SkSVGIRI {
152 public:
153     enum class Type {
154         kLocal,
155         kNonlocal,
156         kDataURI,
157     };
158 
SkSVGIRI()159     SkSVGIRI() : fType(Type::kLocal) {}
SkSVGIRI(Type t,const SkSVGStringType & iri)160     SkSVGIRI(Type t, const SkSVGStringType& iri) : fType(t), fIRI(iri) {}
161 
type()162     Type type() const { return fType; }
iri()163     const SkSVGStringType& iri() const { return fIRI; }
164 
165     bool operator==(const SkSVGIRI& other) const {
166         return fType == other.fType && fIRI == other.fIRI;
167     }
168     bool operator!=(const SkSVGIRI& other) const { return !(*this == other); }
169 
170 private:
171     Type fType;
172     SkSVGStringType fIRI;
173 };
174 
175 // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGColor
176 class SkSVGColor {
177 public:
178     enum class Type {
179         kCurrentColor,
180         kColor,
181         kICCColor,
182     };
183     using Vars = SkSTArray<1, SkString>;
184 
SkSVGColor()185     SkSVGColor() : SkSVGColor(SK_ColorBLACK) {}
SkSVGColor(const SkSVGColorType & c)186     explicit SkSVGColor(const SkSVGColorType& c) : fType(Type::kColor), fColor(c), fVars(nullptr) {}
SkSVGColor(Type t,Vars && vars)187     explicit SkSVGColor(Type t, Vars&& vars)
188         : fType(t), fColor(SK_ColorBLACK)
189         , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {}
SkSVGColor(const SkSVGColorType & c,Vars && vars)190     explicit SkSVGColor(const SkSVGColorType& c, Vars&& vars)
191         : fType(Type::kColor), fColor(c)
192         , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {}
193 
194     SkSVGColor(const SkSVGColor&)            = default;
195     SkSVGColor& operator=(const SkSVGColor&) = default;
196     SkSVGColor(SkSVGColor&&)                 = default;
197     SkSVGColor& operator=(SkSVGColor&&)      = default;
198 
199     bool operator==(const SkSVGColor& other) const {
200         return fType == other.fType && fColor == other.fColor && fVars == other.fVars;
201     }
202     bool operator!=(const SkSVGColor& other) const { return !(*this == other); }
203 
type()204     Type type() const { return fType; }
color()205     const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
vars()206     SkSpan<const SkString> vars() const {
207         return fVars ? SkSpan<const SkString>(fVars->fData) : SkSpan<const SkString>();
208     }
vars()209     SkSpan<SkString> vars()       {
210         return fVars ? SkSpan<SkString>(fVars->fData) : SkSpan<SkString>();
211     }
212 
213 private:
214     Type fType;
215     SkSVGColorType fColor;
216     struct RefCntVars : public SkNVRefCnt<RefCntVars> {
RefCntVarsRefCntVars217         RefCntVars(Vars&& vars) : fData(std::move(vars)) {}
218         Vars fData;
219     };
220     sk_sp<RefCntVars> fVars;
221 };
222 
223 class SkSVGPaint {
224 public:
225     enum class Type {
226         kNone,
227         kColor,
228         kIRI,
229     };
230 
SkSVGPaint()231     SkSVGPaint() : fType(Type::kNone), fColor(SK_ColorBLACK) {}
SkSVGPaint(Type t)232     explicit SkSVGPaint(Type t) : fType(t), fColor(SK_ColorBLACK) {}
SkSVGPaint(SkSVGColor c)233     explicit SkSVGPaint(SkSVGColor c) : fType(Type::kColor), fColor(std::move(c)) {}
SkSVGPaint(const SkSVGIRI & iri,SkSVGColor fallback_color)234     SkSVGPaint(const SkSVGIRI& iri, SkSVGColor fallback_color)
235         : fType(Type::kIRI), fColor(std::move(fallback_color)), fIRI(iri) {}
236 
237     SkSVGPaint(const SkSVGPaint&)            = default;
238     SkSVGPaint& operator=(const SkSVGPaint&) = default;
239     SkSVGPaint(SkSVGPaint&&)                 = default;
240     SkSVGPaint& operator=(SkSVGPaint&&)      = default;
241 
242     bool operator==(const SkSVGPaint& other) const {
243         return fType == other.fType && fColor == other.fColor && fIRI == other.fIRI;
244     }
245     bool operator!=(const SkSVGPaint& other) const { return !(*this == other); }
246 
type()247     Type type() const { return fType; }
color()248     const SkSVGColor& color() const {
249         SkASSERT(fType == Type::kColor || fType == Type::kIRI);
250         return fColor;
251     }
iri()252     const SkSVGIRI& iri() const { SkASSERT(fType == Type::kIRI); return fIRI; }
253 
254 private:
255     Type fType;
256 
257     // Logical union.
258     SkSVGColor fColor;
259     SkSVGIRI   fIRI;
260 };
261 
262 // <funciri> | none (used for clip/mask/filter properties)
263 class SkSVGFuncIRI {
264 public:
265     enum class Type {
266         kNone,
267         kIRI,
268     };
269 
SkSVGFuncIRI()270     SkSVGFuncIRI() : fType(Type::kNone) {}
SkSVGFuncIRI(Type t)271     explicit SkSVGFuncIRI(Type t) : fType(t) {}
SkSVGFuncIRI(SkSVGIRI && iri)272     explicit SkSVGFuncIRI(SkSVGIRI&& iri) : fType(Type::kIRI), fIRI(std::move(iri)) {}
273 
274     bool operator==(const SkSVGFuncIRI& other) const {
275         return fType == other.fType && fIRI == other.fIRI;
276     }
277     bool operator!=(const SkSVGFuncIRI& other) const { return !(*this == other); }
278 
type()279     Type type() const { return fType; }
iri()280     const SkSVGIRI& iri() const { SkASSERT(fType == Type::kIRI); return fIRI; }
281 
282 private:
283     Type           fType;
284     SkSVGIRI       fIRI;
285 };
286 
287 enum class SkSVGLineCap {
288     kButt,
289     kRound,
290     kSquare,
291 };
292 
293 class SkSVGLineJoin {
294 public:
295     enum class Type {
296         kMiter,
297         kRound,
298         kBevel,
299         kInherit,
300     };
301 
SkSVGLineJoin()302     constexpr SkSVGLineJoin() : fType(Type::kInherit) {}
SkSVGLineJoin(Type t)303     constexpr explicit SkSVGLineJoin(Type t) : fType(t) {}
304 
305     SkSVGLineJoin(const SkSVGLineJoin&)            = default;
306     SkSVGLineJoin& operator=(const SkSVGLineJoin&) = default;
307 
308     bool operator==(const SkSVGLineJoin& other) const { return fType == other.fType; }
309     bool operator!=(const SkSVGLineJoin& other) const { return !(*this == other); }
310 
type()311     Type type() const { return fType; }
312 
313 private:
314     Type fType;
315 };
316 
317 class SkSVGSpreadMethod {
318 public:
319     // These values must match Skia's SkShader::TileMode enum.
320     enum class Type {
321         kPad,       // kClamp_TileMode
322         kRepeat,    // kRepeat_TileMode
323         kReflect,   // kMirror_TileMode
324     };
325 
SkSVGSpreadMethod()326     constexpr SkSVGSpreadMethod() : fType(Type::kPad) {}
SkSVGSpreadMethod(Type t)327     constexpr explicit SkSVGSpreadMethod(Type t) : fType(t) {}
328 
329     SkSVGSpreadMethod(const SkSVGSpreadMethod&)            = default;
330     SkSVGSpreadMethod& operator=(const SkSVGSpreadMethod&) = default;
331 
332     bool operator==(const SkSVGSpreadMethod& other) const { return fType == other.fType; }
333     bool operator!=(const SkSVGSpreadMethod& other) const { return !(*this == other); }
334 
type()335     Type type() const { return fType; }
336 
337 private:
338     Type fType;
339 };
340 
341 class SkSVGFillRule {
342 public:
343     enum class Type {
344         kNonZero,
345         kEvenOdd,
346         kInherit,
347     };
348 
SkSVGFillRule()349     constexpr SkSVGFillRule() : fType(Type::kInherit) {}
SkSVGFillRule(Type t)350     constexpr explicit SkSVGFillRule(Type t) : fType(t) {}
351 
352     SkSVGFillRule(const SkSVGFillRule&)            = default;
353     SkSVGFillRule& operator=(const SkSVGFillRule&) = default;
354 
355     bool operator==(const SkSVGFillRule& other) const { return fType == other.fType; }
356     bool operator!=(const SkSVGFillRule& other) const { return !(*this == other); }
357 
type()358     Type type() const { return fType; }
359 
asFillType()360     SkPathFillType asFillType() const {
361         SkASSERT(fType != Type::kInherit); // should never be called for unresolved values.
362         return fType == Type::kEvenOdd ? SkPathFillType::kEvenOdd : SkPathFillType::kWinding;
363     }
364 
365 private:
366     Type fType;
367 };
368 
369 class SkSVGVisibility {
370 public:
371     enum class Type {
372         kVisible,
373         kHidden,
374         kCollapse,
375         kInherit,
376     };
377 
SkSVGVisibility()378     constexpr SkSVGVisibility() : fType(Type::kVisible) {}
SkSVGVisibility(Type t)379     constexpr explicit SkSVGVisibility(Type t) : fType(t) {}
380 
381     SkSVGVisibility(const SkSVGVisibility&)            = default;
382     SkSVGVisibility& operator=(const SkSVGVisibility&) = default;
383 
384     bool operator==(const SkSVGVisibility& other) const { return fType == other.fType; }
385     bool operator!=(const SkSVGVisibility& other) const { return !(*this == other); }
386 
type()387     Type type() const { return fType; }
388 
389 private:
390     Type fType;
391 };
392 
393 class SkSVGDashArray {
394 public:
395     enum class Type {
396         kNone,
397         kDashArray,
398         kInherit,
399     };
400 
SkSVGDashArray()401     SkSVGDashArray()                : fType(Type::kNone) {}
SkSVGDashArray(Type t)402     explicit SkSVGDashArray(Type t) : fType(t) {}
SkSVGDashArray(SkTDArray<SkSVGLength> && dashArray)403     explicit SkSVGDashArray(SkTDArray<SkSVGLength>&& dashArray)
404         : fType(Type::kDashArray)
405         , fDashArray(std::move(dashArray)) {}
406 
407     SkSVGDashArray(const SkSVGDashArray&)            = default;
408     SkSVGDashArray& operator=(const SkSVGDashArray&) = default;
409 
410     bool operator==(const SkSVGDashArray& other) const {
411         return fType == other.fType && fDashArray == other.fDashArray;
412     }
413     bool operator!=(const SkSVGDashArray& other) const { return !(*this == other); }
414 
type()415     Type type() const { return fType; }
416 
dashArray()417     const SkTDArray<SkSVGLength>& dashArray() const { return fDashArray; }
418 
419 private:
420     Type fType;
421     SkTDArray<SkSVGLength> fDashArray;
422 };
423 
424 class SkSVGStopColor {
425 public:
426     enum class Type {
427         kColor,
428         kCurrentColor,
429         kICCColor,
430         kInherit,
431     };
432 
SkSVGStopColor()433     SkSVGStopColor() : fType(Type::kColor), fColor(SK_ColorBLACK) {}
SkSVGStopColor(Type t)434     explicit SkSVGStopColor(Type t) : fType(t), fColor(SK_ColorBLACK) {}
SkSVGStopColor(const SkSVGColorType & c)435     explicit SkSVGStopColor(const SkSVGColorType& c) : fType(Type::kColor), fColor(c) {}
436 
437     SkSVGStopColor(const SkSVGStopColor&)            = default;
438     SkSVGStopColor& operator=(const SkSVGStopColor&) = default;
439 
440     bool operator==(const SkSVGStopColor& other) const {
441         return fType == other.fType && fColor == other.fColor;
442     }
443     bool operator!=(const SkSVGStopColor& other) const { return !(*this == other); }
444 
type()445     Type type() const { return fType; }
color()446     const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
447 
448 private:
449     Type fType;
450     SkSVGColorType fColor;
451 };
452 
453 class SkSVGObjectBoundingBoxUnits {
454 public:
455     enum class Type {
456         kUserSpaceOnUse,
457         kObjectBoundingBox,
458     };
459 
SkSVGObjectBoundingBoxUnits()460     SkSVGObjectBoundingBoxUnits() : fType(Type::kUserSpaceOnUse) {}
SkSVGObjectBoundingBoxUnits(Type t)461     explicit SkSVGObjectBoundingBoxUnits(Type t) : fType(t) {}
462 
463     bool operator==(const SkSVGObjectBoundingBoxUnits& other) const {
464         return fType == other.fType;
465     }
466     bool operator!=(const SkSVGObjectBoundingBoxUnits& other) const {
467         return !(*this == other);
468     }
469 
type()470     Type type() const { return fType; }
471 
472 private:
473     Type fType;
474 };
475 
476 class SkSVGFontFamily {
477 public:
478     enum class Type {
479         kFamily,
480         kInherit,
481     };
482 
SkSVGFontFamily()483     SkSVGFontFamily() : fType(Type::kInherit) {}
SkSVGFontFamily(const char family[])484     explicit SkSVGFontFamily(const char family[])
485         : fType(Type::kFamily)
486         , fFamily(family) {}
487 
488     bool operator==(const SkSVGFontFamily& other) const {
489         return fType == other.fType && fFamily == other.fFamily;
490     }
491     bool operator!=(const SkSVGFontFamily& other) const { return !(*this == other); }
492 
type()493     Type type() const { return fType; }
494 
family()495     const SkString& family() const { return fFamily; }
496 
497 private:
498     Type     fType;
499     SkString fFamily;
500 };
501 
502 class SkSVGFontStyle {
503 public:
504     enum class Type {
505         kNormal,
506         kItalic,
507         kOblique,
508         kInherit,
509     };
510 
SkSVGFontStyle()511     SkSVGFontStyle() : fType(Type::kInherit) {}
SkSVGFontStyle(Type t)512     explicit SkSVGFontStyle(Type t) : fType(t) {}
513 
514     bool operator==(const SkSVGFontStyle& other) const {
515         return fType == other.fType;
516     }
517     bool operator!=(const SkSVGFontStyle& other) const { return !(*this == other); }
518 
type()519     Type type() const { return fType; }
520 
521 private:
522     Type fType;
523 };
524 
525 class SkSVGFontSize {
526 public:
527     enum class Type {
528         kLength,
529         kInherit,
530     };
531 
SkSVGFontSize()532     SkSVGFontSize() : fType(Type::kInherit), fSize(0) {}
SkSVGFontSize(const SkSVGLength & s)533     explicit SkSVGFontSize(const SkSVGLength& s)
534         : fType(Type::kLength)
535         , fSize(s) {}
536 
537     bool operator==(const SkSVGFontSize& other) const {
538         return fType == other.fType && fSize == other.fSize;
539     }
540     bool operator!=(const SkSVGFontSize& other) const { return !(*this == other); }
541 
type()542     Type type() const { return fType; }
543 
size()544     const SkSVGLength& size() const { return fSize; }
545 
546 private:
547     Type        fType;
548     SkSVGLength fSize;
549 };
550 
551 class SkSVGFontWeight {
552 public:
553     enum class Type {
554         k100,
555         k200,
556         k300,
557         k400,
558         k500,
559         k600,
560         k700,
561         k800,
562         k900,
563         kNormal,
564         kBold,
565         kBolder,
566         kLighter,
567         kInherit,
568     };
569 
SkSVGFontWeight()570     SkSVGFontWeight() : fType(Type::kInherit) {}
SkSVGFontWeight(Type t)571     explicit SkSVGFontWeight(Type t) : fType(t) {}
572 
573     bool operator==(const SkSVGFontWeight& other) const {
574         return fType == other.fType;
575     }
576     bool operator!=(const SkSVGFontWeight& other) const { return !(*this == other); }
577 
type()578     Type type() const { return fType; }
579 
580 private:
581     Type fType;
582 };
583 
584 struct SkSVGPreserveAspectRatio {
585     enum Align : uint8_t {
586         // These values are chosen such that bits [0,1] encode X alignment, and
587         // bits [2,3] encode Y alignment.
588         kXMinYMin = 0x00,
589         kXMidYMin = 0x01,
590         kXMaxYMin = 0x02,
591         kXMinYMid = 0x04,
592         kXMidYMid = 0x05,
593         kXMaxYMid = 0x06,
594         kXMinYMax = 0x08,
595         kXMidYMax = 0x09,
596         kXMaxYMax = 0x0a,
597 
598         kNone     = 0x10,
599     };
600 
601     enum Scale {
602         kMeet,
603         kSlice,
604     };
605 
606     Align fAlign = kXMidYMid;
607     Scale fScale = kMeet;
608 };
609 
610 class SkSVGTextAnchor {
611 public:
612     enum class Type {
613         kStart,
614         kMiddle,
615         kEnd,
616         kInherit,
617     };
618 
SkSVGTextAnchor()619     SkSVGTextAnchor() : fType(Type::kInherit) {}
SkSVGTextAnchor(Type t)620     explicit SkSVGTextAnchor(Type t) : fType(t) {}
621 
622     bool operator==(const SkSVGTextAnchor& other) const {
623         return fType == other.fType;
624     }
625     bool operator!=(const SkSVGTextAnchor& other) const { return !(*this == other); }
626 
type()627     Type type() const { return fType; }
628 
629 private:
630     Type fType;
631 };
632 
633 // https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveInAttribute
634 class SkSVGFeInputType {
635 public:
636     enum class Type {
637         kSourceGraphic,
638         kSourceAlpha,
639         kBackgroundImage,
640         kBackgroundAlpha,
641         kFillPaint,
642         kStrokePaint,
643         kFilterPrimitiveReference,
644         kUnspecified,
645     };
646 
SkSVGFeInputType()647     SkSVGFeInputType() : fType(Type::kUnspecified) {}
SkSVGFeInputType(Type t)648     explicit SkSVGFeInputType(Type t) : fType(t) {}
SkSVGFeInputType(const SkSVGStringType & id)649     explicit SkSVGFeInputType(const SkSVGStringType& id)
650             : fType(Type::kFilterPrimitiveReference), fId(id) {}
651 
652     bool operator==(const SkSVGFeInputType& other) const {
653         return fType == other.fType && fId == other.fId;
654     }
655     bool operator!=(const SkSVGFeInputType& other) const { return !(*this == other); }
656 
id()657     const SkString& id() const {
658         SkASSERT(fType == Type::kFilterPrimitiveReference);
659         return fId;
660     }
661 
type()662     Type type() const { return fType; }
663 
664 private:
665     Type fType;
666     SkString fId;
667 };
668 
669 enum class SkSVGFeColorMatrixType {
670     kMatrix,
671     kSaturate,
672     kHueRotate,
673     kLuminanceToAlpha,
674 };
675 
676 using SkSVGFeColorMatrixValues = SkTDArray<SkSVGNumberType>;
677 
678 enum class SkSVGFeCompositeOperator {
679     kOver,
680     kIn,
681     kOut,
682     kAtop,
683     kXor,
684     kArithmetic,
685 };
686 
687 class SkSVGFeTurbulenceBaseFrequency {
688 public:
SkSVGFeTurbulenceBaseFrequency()689     SkSVGFeTurbulenceBaseFrequency() : fFreqX(0), fFreqY(0) {}
SkSVGFeTurbulenceBaseFrequency(SkSVGNumberType freqX,SkSVGNumberType freqY)690     SkSVGFeTurbulenceBaseFrequency(SkSVGNumberType freqX, SkSVGNumberType freqY)
691             : fFreqX(freqX), fFreqY(freqY) {}
692 
freqX()693     SkSVGNumberType freqX() const { return fFreqX; }
freqY()694     SkSVGNumberType freqY() const { return fFreqY; }
695 
696 private:
697     SkSVGNumberType fFreqX;
698     SkSVGNumberType fFreqY;
699 };
700 
701 struct SkSVGFeTurbulenceType {
702     enum Type {
703         kFractalNoise,
704         kTurbulence,
705     };
706 
707     Type fType;
708 
SkSVGFeTurbulenceTypeSkSVGFeTurbulenceType709     SkSVGFeTurbulenceType() : fType(kTurbulence) {}
SkSVGFeTurbulenceTypeSkSVGFeTurbulenceType710     explicit SkSVGFeTurbulenceType(Type type) : fType(type) {}
711 };
712 
713 enum class SkSVGXmlSpace {
714     kDefault,
715     kPreserve,
716 };
717 
718 enum class SkSVGColorspace {
719     kAuto,
720     kSRGB,
721     kLinearRGB,
722 };
723 
724 // https://www.w3.org/TR/SVG11/painting.html#DisplayProperty
725 enum class SkSVGDisplay {
726     kInline,
727     kNone,
728 };
729 
730 #endif // SkSVGTypes_DEFINED
731