8 #ifndef SkSVGNode_DEFINED
9 #define SkSVGNode_DEFINED
64 #define SVG_PRES_ATTR(attr_name, attr_type, attr_inherited) \
66 bool set##attr_name(SkSVGAttributeParser::ParseResult< \
67 SkSVGProperty<attr_type, attr_inherited>>&& pr) {\
68 if (pr.isValid()) { this->set##attr_name(std::move(*pr)); } \
69 return pr.isValid(); \
73 const SkSVGProperty<attr_type, attr_inherited>& get##attr_name() const { \
74 return fPresentationAttributes.f##attr_name; \
76 void set##attr_name(const SkSVGProperty<attr_type, attr_inherited>& v) { \
77 auto* dest = &fPresentationAttributes.f##attr_name; \
78 if (!dest->isInheritable() || v.isValue()) { \
82 dest->set(SkSVGPropertyState::kInherit); \
85 void set##attr_name(SkSVGProperty<attr_type, attr_inherited>&& v) { \
86 auto* dest = &fPresentationAttributes.f##attr_name; \
87 if (!dest->isInheritable() || v.isValue()) { \
89 *dest = std::move(v); \
91 dest->set(SkSVGPropertyState::kInherit); \
109 bool setAttribute(
const char* attributeName,
const char* attributeValue);
187 #define _SVG_ATTR_SETTERS(attr_name, attr_type, attr_default, set_cp, set_mv) \
189 bool set##attr_name( \
190 const SkSVGAttributeParser::ParseResult<attr_type>& pr) { \
191 if (pr.isValid()) { this->set##attr_name(*pr); } \
192 return pr.isValid(); \
194 bool set##attr_name( \
195 SkSVGAttributeParser::ParseResult<attr_type>&& pr) { \
196 if (pr.isValid()) { this->set##attr_name(std::move(*pr)); } \
197 return pr.isValid(); \
200 void set##attr_name(const attr_type& a) { set_cp(a); } \
201 void set##attr_name(attr_type&& a) { set_mv(std::move(a)); }
203 #define SVG_ATTR(attr_name, attr_type, attr_default) \
205 attr_type f##attr_name = attr_default; \
207 const attr_type& get##attr_name() const { return f##attr_name; } \
209 attr_name, attr_type, attr_default, \
210 [this](const attr_type& a) { this->f##attr_name = a; }, \
211 [this](attr_type&& a) { this->f##attr_name = std::move(a); })
213 #define SVG_OPTIONAL_ATTR(attr_name, attr_type) \
215 SkTLazy<attr_type> f##attr_name; \
217 const SkTLazy<attr_type>& get##attr_name() const { return f##attr_name; } \
219 attr_name, attr_type, attr_default, \
220 [this](const attr_type& a) { this->f##attr_name.set(a); }, \
221 [this](attr_type&& a) { this->f##attr_name.set(std::move(a)); })
@ kLine
SkPath::RawIter returns 2 points.
SkSVGAttribute
Definition: SkSVGAttribute.h:16
SkSVGTag
Definition: SkSVGNode.h:23
#define SVG_PRES_ATTR(attr_name, attr_type, attr_inherited)
Definition: SkSVGNode.h:64
SkSVGDisplay
Definition: SkSVGTypes.h:726
SkSVGLineCap
Definition: SkSVGTypes.h:288
SkColor SkSVGColorType
Definition: SkSVGTypes.h:25
SkSVGColorspace
Definition: SkSVGTypes.h:719
SkScalar SkSVGNumberType
Definition: SkSVGTypes.h:27
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
SkPaint controls options applied when drawing.
Definition: SkPaint.h:44
SkPath contain geometry.
Definition: SkPath.h:58
Definition: SkRefCnt.h:119
Definition: SkSVGTypes.h:177
Definition: SkSVGTypes.h:394
Definition: SkSVGTypes.h:342
Definition: SkSVGTypes.h:477
Definition: SkSVGTypes.h:526
Definition: SkSVGTypes.h:503
Definition: SkSVGTypes.h:552
Definition: SkSVGTypes.h:264
Definition: SkSVGRenderContext.h:27
Definition: SkSVGTypes.h:116
Definition: SkSVGTypes.h:294
Definition: SkSVGNode.h:95
SkRect objectBoundingBox(const SkSVGRenderContext &) const
void render(const SkSVGRenderContext &) const
bool setAttribute(const char *attributeName, const char *attributeValue)
virtual SkRect onObjectBoundingBox(const SkSVGRenderContext &) const
Definition: SkSVGNode.h:172
virtual bool parseAndSetAttribute(const char *name, const char *value)
void setAttribute(SkSVGAttribute, const SkSVGValue &)
bool asPaint(const SkSVGRenderContext &, SkPaint *) const
SkPath asPath(const SkSVGRenderContext &) const
virtual void appendChild(sk_sp< SkSVGNode >)=0
virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue &)
Definition: SkSVGNode.h:168
virtual bool hasChildren() const
Definition: SkSVGNode.h:170
SkSVGTag tag() const
Definition: SkSVGNode.h:99
virtual SkPath onAsPath(const SkSVGRenderContext &) const =0
Definition: SkSVGTypes.h:224
Definition: SkSVGRenderContext.h:61
Definition: SkSVGTypes.h:611
Definition: SkSVGValue.h:18
Definition: SkSVGTypes.h:370
SK_API sk_sp< SkShader > Color(SkColor)
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
static constexpr SkRect MakeEmpty()
Returns constructed SkRect set to (0, 0, 0, 0).
Definition: SkRect.h:595
Definition: SkSVGAttribute.h:69
Definition: SkSVGTypes.h:585