8 #ifndef SkSVGTypes_DEFINED
9 #define SkSVGTypes_DEFINED
53 fValue = std::move(value);
56 template <
typename... Args>
57 void init(Args&&... args) {
59 fValue.emplace(std::forward<Args>(args)...);
67 return fValue.has_value() ? &fValue.value() :
nullptr;
77 void set(
const T& value) {
84 fValue = std::move(value);
89 SkASSERT(fValue.has_value());
90 return &fValue.value();
95 SkASSERT(fValue.has_value());
96 return &fValue.value();
101 SkASSERT(fValue.has_value());
107 SkASSERT(fValue.has_value());
113 std::optional<T> fValue;
134 : fValue(v), fUnit(u) {}
139 return fUnit == other.fUnit && fValue == other.fValue;
167 return fType == other.fType && fIRI == other.fIRI;
184 using Vars = std::vector<SkString>;
190 , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {}
193 , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {}
201 return fType == other.fType && fColor == other.fColor && fVars == other.fVars;
207 SkSpan<const SkString>
vars()
const {
208 return fVars ? SkSpan<const SkString>(fVars->fData) : SkSpan<const SkString>();
211 return fVars ? SkSpan<SkString>(fVars->fData) : SkSpan<SkString>();
217 struct RefCntVars :
public SkNVRefCnt<RefCntVars> {
218 RefCntVars(Vars&& vars) : fData(std::move(vars)) {}
236 : fType(
Type::kIRI), fColor(std::move(fallback_color)), fIRI(iri) {}
244 return fType == other.fType && fColor == other.fColor && fIRI == other.fIRI;
250 SkASSERT(fType == Type::kColor || fType == Type::kIRI);
253 const SkSVGIRI&
iri()
const { SkASSERT(fType == Type::kIRI);
return fIRI; }
276 return fType == other.fType && fIRI == other.fIRI;
281 const SkSVGIRI&
iri()
const { SkASSERT(fType == Type::kIRI);
return fIRI; }
362 SkASSERT(fType != Type::kInherit);
405 : fType(
Type::kDashArray)
406 , fDashArray(std::move(dashArray)) {}
412 return fType == other.fType && fDashArray == other.fDashArray;
418 const std::vector<SkSVGLength>&
dashArray()
const {
return fDashArray; }
422 std::vector<SkSVGLength> fDashArray;
442 return fType == other.fType && fColor == other.fColor;
465 return fType == other.fType;
468 return !(*
this == other);
486 : fType(
Type::kFamily)
490 return fType == other.fType && fFamily == other.fFamily;
516 return fType == other.fType;
535 : fType(
Type::kLength)
539 return fType == other.fType && fSize == other.fSize;
575 return fType == other.fType;
624 return fType == other.fType;
644 kFilterPrimitiveReference,
651 : fType(
Type::kFilterPrimitiveReference), fId(id) {}
654 return fType == other.fType && fId == other.fId;
659 SkASSERT(fType == Type::kFilterPrimitiveReference);
692 : fFreqX(freqX), fFreqY(freqY) {}
@ kXor
r = s*(1-da) + d*(1-sa)
@ kColor
hue and saturation of source with luminosity of destination
Types, consts, functions, and macros for colors.
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:37
constexpr SkColor SK_ColorBLACK
Represents fully opaque black.
Definition: SkColor.h:103
@ kNormal
glyph outlines modified to improve constrast
@ kNone
glyph outlines unchanged
SkPathFillType
Definition: SkPathTypes.h:11
@ kWinding
Specifies that "inside" is computed by a non-zero sum of signed edge crossings.
@ kEvenOdd
Specifies that "inside" is computed by an odd number of edge crossings.
SkSVGDisplay
Definition: SkSVGTypes.h:726
SkSVGXmlSpace
Definition: SkSVGTypes.h:714
SkSVGLineCap
Definition: SkSVGTypes.h:288
SkSVGFeCompositeOperator
Definition: SkSVGTypes.h:679
SkColor SkSVGColorType
Definition: SkSVGTypes.h:25
SkSVGColorspace
Definition: SkSVGTypes.h:719
std::vector< SkPoint > SkSVGPointsType
Definition: SkSVGTypes.h:31
SkSVGPropertyState
Definition: SkSVGTypes.h:33
std::vector< SkSVGNumberType > SkSVGFeColorMatrixValues
Definition: SkSVGTypes.h:677
SkScalar SkSVGNumberType
Definition: SkSVGTypes.h:27
SkSVGFeColorMatrixType
Definition: SkSVGTypes.h:670
int SkSVGIntegerType
Definition: SkSVGTypes.h:26
float SkScalar
Definition: SkScalar.h:14
@ kRepeat
Repeat the shader's image horizontally and vertically.
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
Definition: SkRefCnt.h:160
Definition: SkSVGTypes.h:177
SkSpan< const SkString > vars() const
Definition: SkSVGTypes.h:207
const SkSVGColorType & color() const
Definition: SkSVGTypes.h:206
std::vector< SkString > Vars
Definition: SkSVGTypes.h:184
SkSVGColor & operator=(SkSVGColor &&)=default
Type type() const
Definition: SkSVGTypes.h:205
SkSpan< SkString > vars()
Definition: SkSVGTypes.h:210
SkSVGColor(SkSVGColor &&)=default
bool operator!=(const SkSVGColor &other) const
Definition: SkSVGTypes.h:203
SkSVGColor(const SkSVGColorType &c, Vars &&vars)
Definition: SkSVGTypes.h:191
SkSVGColor(Type t, Vars &&vars)
Definition: SkSVGTypes.h:188
SkSVGColor & operator=(const SkSVGColor &)=default
Type
Definition: SkSVGTypes.h:179
SkSVGColor(const SkSVGColorType &c)
Definition: SkSVGTypes.h:187
SkSVGColor()
Definition: SkSVGTypes.h:186
SkSVGColor(const SkSVGColor &)=default
bool operator==(const SkSVGColor &other) const
Definition: SkSVGTypes.h:200
Definition: SkSVGTypes.h:394
bool operator==(const SkSVGDashArray &other) const
Definition: SkSVGTypes.h:411
const std::vector< SkSVGLength > & dashArray() const
Definition: SkSVGTypes.h:418
SkSVGDashArray & operator=(const SkSVGDashArray &)=default
Type type() const
Definition: SkSVGTypes.h:416
SkSVGDashArray(Type t)
Definition: SkSVGTypes.h:403
SkSVGDashArray(const SkSVGDashArray &)=default
SkSVGDashArray(std::vector< SkSVGLength > &&dashArray)
Definition: SkSVGTypes.h:404
bool operator!=(const SkSVGDashArray &other) const
Definition: SkSVGTypes.h:414
SkSVGDashArray()
Definition: SkSVGTypes.h:402
Type
Definition: SkSVGTypes.h:396
Definition: SkSVGTypes.h:688
SkSVGFeTurbulenceBaseFrequency(SkSVGNumberType freqX, SkSVGNumberType freqY)
Definition: SkSVGTypes.h:691
SkSVGNumberType freqX() const
Definition: SkSVGTypes.h:694
SkSVGFeTurbulenceBaseFrequency()
Definition: SkSVGTypes.h:690
SkSVGNumberType freqY() const
Definition: SkSVGTypes.h:695
Definition: SkSVGTypes.h:342
bool operator==(const SkSVGFillRule &other) const
Definition: SkSVGTypes.h:356
SkSVGFillRule(const SkSVGFillRule &)=default
constexpr SkSVGFillRule(Type t)
Definition: SkSVGTypes.h:351
SkSVGFillRule & operator=(const SkSVGFillRule &)=default
Type type() const
Definition: SkSVGTypes.h:359
bool operator!=(const SkSVGFillRule &other) const
Definition: SkSVGTypes.h:357
Type
Definition: SkSVGTypes.h:344
constexpr SkSVGFillRule()
Definition: SkSVGTypes.h:350
SkPathFillType asFillType() const
Definition: SkSVGTypes.h:361
Definition: SkSVGTypes.h:477
SkSVGFontFamily()
Definition: SkSVGTypes.h:484
Type type() const
Definition: SkSVGTypes.h:494
bool operator!=(const SkSVGFontFamily &other) const
Definition: SkSVGTypes.h:492
SkSVGFontFamily(const char family[])
Definition: SkSVGTypes.h:485
Type
Definition: SkSVGTypes.h:479
const SkString & family() const
Definition: SkSVGTypes.h:496
bool operator==(const SkSVGFontFamily &other) const
Definition: SkSVGTypes.h:489
Definition: SkSVGTypes.h:526
SkSVGFontSize()
Definition: SkSVGTypes.h:533
SkSVGFontSize(const SkSVGLength &s)
Definition: SkSVGTypes.h:534
Type
Definition: SkSVGTypes.h:528
bool operator!=(const SkSVGFontSize &other) const
Definition: SkSVGTypes.h:541
const SkSVGLength & size() const
Definition: SkSVGTypes.h:545
Type type() const
Definition: SkSVGTypes.h:543
bool operator==(const SkSVGFontSize &other) const
Definition: SkSVGTypes.h:538
Definition: SkSVGTypes.h:503
SkSVGFontStyle(Type t)
Definition: SkSVGTypes.h:513
SkSVGFontStyle()
Definition: SkSVGTypes.h:512
bool operator==(const SkSVGFontStyle &other) const
Definition: SkSVGTypes.h:515
Type
Definition: SkSVGTypes.h:505
Type type() const
Definition: SkSVGTypes.h:520
bool operator!=(const SkSVGFontStyle &other) const
Definition: SkSVGTypes.h:518
Definition: SkSVGTypes.h:552
SkSVGFontWeight()
Definition: SkSVGTypes.h:571
SkSVGFontWeight(Type t)
Definition: SkSVGTypes.h:572
bool operator!=(const SkSVGFontWeight &other) const
Definition: SkSVGTypes.h:577
Type
Definition: SkSVGTypes.h:554
bool operator==(const SkSVGFontWeight &other) const
Definition: SkSVGTypes.h:574
Type type() const
Definition: SkSVGTypes.h:579
Definition: SkSVGTypes.h:264
bool operator!=(const SkSVGFuncIRI &other) const
Definition: SkSVGTypes.h:278
SkSVGFuncIRI()
Definition: SkSVGTypes.h:271
SkSVGFuncIRI(SkSVGIRI &&iri)
Definition: SkSVGTypes.h:273
bool operator==(const SkSVGFuncIRI &other) const
Definition: SkSVGTypes.h:275
Type type() const
Definition: SkSVGTypes.h:280
SkSVGFuncIRI(Type t)
Definition: SkSVGTypes.h:272
const SkSVGIRI & iri() const
Definition: SkSVGTypes.h:281
Type
Definition: SkSVGTypes.h:266
Definition: SkSVGTypes.h:152
Type
Definition: SkSVGTypes.h:154
Type type() const
Definition: SkSVGTypes.h:163
bool operator!=(const SkSVGIRI &other) const
Definition: SkSVGTypes.h:169
SkSVGIRI(Type t, const SkSVGStringType &iri)
Definition: SkSVGTypes.h:161
bool operator==(const SkSVGIRI &other) const
Definition: SkSVGTypes.h:166
const SkSVGStringType & iri() const
Definition: SkSVGTypes.h:164
SkSVGIRI()
Definition: SkSVGTypes.h:160
Definition: SkSVGTypes.h:116
constexpr SkSVGLength()
Definition: SkSVGTypes.h:132
bool operator!=(const SkSVGLength &other) const
Definition: SkSVGTypes.h:141
bool operator==(const SkSVGLength &other) const
Definition: SkSVGTypes.h:138
const SkScalar & value() const
Definition: SkSVGTypes.h:143
SkSVGLength & operator=(const SkSVGLength &)=default
constexpr SkSVGLength(SkScalar v, Unit u=Unit::kNumber)
Definition: SkSVGTypes.h:133
SkSVGLength(const SkSVGLength &)=default
Unit
Definition: SkSVGTypes.h:118
const Unit & unit() const
Definition: SkSVGTypes.h:144
Definition: SkSVGTypes.h:294
SkSVGLineJoin(const SkSVGLineJoin &)=default
Type type() const
Definition: SkSVGTypes.h:312
constexpr SkSVGLineJoin()
Definition: SkSVGTypes.h:303
SkSVGLineJoin & operator=(const SkSVGLineJoin &)=default
bool operator!=(const SkSVGLineJoin &other) const
Definition: SkSVGTypes.h:310
Type
Definition: SkSVGTypes.h:296
bool operator==(const SkSVGLineJoin &other) const
Definition: SkSVGTypes.h:309
constexpr SkSVGLineJoin(Type t)
Definition: SkSVGTypes.h:304
Definition: SkSVGTypes.h:454
bool operator==(const SkSVGObjectBoundingBoxUnits &other) const
Definition: SkSVGTypes.h:464
SkSVGObjectBoundingBoxUnits(Type t)
Definition: SkSVGTypes.h:462
Type
Definition: SkSVGTypes.h:456
bool operator!=(const SkSVGObjectBoundingBoxUnits &other) const
Definition: SkSVGTypes.h:467
Type type() const
Definition: SkSVGTypes.h:471
SkSVGObjectBoundingBoxUnits()
Definition: SkSVGTypes.h:461
Definition: SkSVGTypes.h:224
SkSVGPaint & operator=(SkSVGPaint &&)=default
SkSVGPaint(Type t)
Definition: SkSVGTypes.h:233
SkSVGPaint()
Definition: SkSVGTypes.h:232
SkSVGPaint(const SkSVGIRI &iri, SkSVGColor fallback_color)
Definition: SkSVGTypes.h:235
SkSVGPaint(SkSVGPaint &&)=default
Type
Definition: SkSVGTypes.h:226
const SkSVGColor & color() const
Definition: SkSVGTypes.h:249
SkSVGPaint(SkSVGColor c)
Definition: SkSVGTypes.h:234
const SkSVGIRI & iri() const
Definition: SkSVGTypes.h:253
bool operator!=(const SkSVGPaint &other) const
Definition: SkSVGTypes.h:246
Type type() const
Definition: SkSVGTypes.h:248
SkSVGPaint(const SkSVGPaint &)=default
SkSVGPaint & operator=(const SkSVGPaint &)=default
bool operator==(const SkSVGPaint &other) const
Definition: SkSVGTypes.h:243
Definition: SkSVGTypes.h:40
SkSVGProperty(const T &value)
Definition: SkSVGTypes.h:48
constexpr bool isInheritable() const
Definition: SkSVGTypes.h:62
SkSVGProperty()
Definition: SkSVGTypes.h:44
void set(const T &value)
Definition: SkSVGTypes.h:77
const T * operator->() const
Definition: SkSVGTypes.h:93
T ValueT
Definition: SkSVGTypes.h:42
T * operator->()
Definition: SkSVGTypes.h:87
SkSVGProperty(SkSVGPropertyState state)
Definition: SkSVGTypes.h:46
bool isValue() const
Definition: SkSVGTypes.h:64
T & operator*()
Definition: SkSVGTypes.h:99
const T & operator*() const
Definition: SkSVGTypes.h:105
void set(T &&value)
Definition: SkSVGTypes.h:82
void set(SkSVGPropertyState state)
Definition: SkSVGTypes.h:70
SkSVGProperty(T &&value)
Definition: SkSVGTypes.h:52
void init(Args &&... args)
Definition: SkSVGTypes.h:57
T * getMaybeNull() const
Definition: SkSVGTypes.h:66
Definition: SkSVGTypes.h:318
constexpr SkSVGSpreadMethod()
Definition: SkSVGTypes.h:327
Type
Definition: SkSVGTypes.h:321
constexpr SkSVGSpreadMethod(Type t)
Definition: SkSVGTypes.h:328
SkSVGSpreadMethod & operator=(const SkSVGSpreadMethod &)=default
bool operator!=(const SkSVGSpreadMethod &other) const
Definition: SkSVGTypes.h:334
Type type() const
Definition: SkSVGTypes.h:336
SkSVGSpreadMethod(const SkSVGSpreadMethod &)=default
bool operator==(const SkSVGSpreadMethod &other) const
Definition: SkSVGTypes.h:333
Definition: SkSVGTypes.h:425
Type type() const
Definition: SkSVGTypes.h:446
SkSVGStopColor(Type t)
Definition: SkSVGTypes.h:435
bool operator==(const SkSVGStopColor &other) const
Definition: SkSVGTypes.h:441
SkSVGStopColor()
Definition: SkSVGTypes.h:434
Type
Definition: SkSVGTypes.h:427
SkSVGStopColor(const SkSVGColorType &c)
Definition: SkSVGTypes.h:436
SkSVGStopColor(const SkSVGStopColor &)=default
const SkSVGColorType & color() const
Definition: SkSVGTypes.h:447
SkSVGStopColor & operator=(const SkSVGStopColor &)=default
bool operator!=(const SkSVGStopColor &other) const
Definition: SkSVGTypes.h:444
Definition: SkSVGTypes.h:611
SkSVGTextAnchor()
Definition: SkSVGTypes.h:620
SkSVGTextAnchor(Type t)
Definition: SkSVGTypes.h:621
Type type() const
Definition: SkSVGTypes.h:628
Type
Definition: SkSVGTypes.h:613
bool operator==(const SkSVGTextAnchor &other) const
Definition: SkSVGTypes.h:623
bool operator!=(const SkSVGTextAnchor &other) const
Definition: SkSVGTypes.h:626
Definition: SkSVGTypes.h:370
Type type() const
Definition: SkSVGTypes.h:388
bool operator!=(const SkSVGVisibility &other) const
Definition: SkSVGTypes.h:386
bool operator==(const SkSVGVisibility &other) const
Definition: SkSVGTypes.h:385
SkSVGVisibility & operator=(const SkSVGVisibility &)=default
constexpr SkSVGVisibility()
Definition: SkSVGTypes.h:379
Type
Definition: SkSVGTypes.h:372
constexpr SkSVGVisibility(Type t)
Definition: SkSVGTypes.h:380
SkSVGVisibility(const SkSVGVisibility &)=default
Light weight class for managing strings.
Definition: SkString.h:118
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
Definition: SkSVGTypes.h:702
Type
Definition: SkSVGTypes.h:703
@ kTurbulence
Definition: SkSVGTypes.h:705
@ kFractalNoise
Definition: SkSVGTypes.h:704
SkSVGFeTurbulenceType(Type type)
Definition: SkSVGTypes.h:711
Type fType
Definition: SkSVGTypes.h:708
SkSVGFeTurbulenceType()
Definition: SkSVGTypes.h:710
Definition: SkSVGTypes.h:585
Align
Definition: SkSVGTypes.h:586
Scale
Definition: SkSVGTypes.h:602
@ kMeet
Definition: SkSVGTypes.h:603
@ kSlice
Definition: SkSVGTypes.h:604