|
NovaSVG 0.10.0
A header-only SVG library
|
#include <svgelement.h>


Public Member Functions | |
| SVGElement (Document *document, ElementID id) | |
| virtual | ~SVGElement ()=default |
| bool | hasAttribute (std::string_view name) const |
| const std::string & | getAttribute (std::string_view name) const |
| bool | setAttribute (std::string_view name, const std::string &value) |
| const Attribute * | findAttribute (PropertyID id) const |
| bool | hasAttribute (PropertyID id) const |
| const std::string & | getAttribute (PropertyID id) const |
| bool | setAttribute (int specificity, PropertyID id, const std::string &value) |
| void | setAttributes (const AttributeList &attributes) |
| bool | setAttribute (const Attribute &attribute) |
| virtual void | parseAttribute (PropertyID id, const std::string &value) |
| SVGElement * | previousElement () const |
| SVGElement * | nextElement () const |
| SVGNode * | addChild (std::unique_ptr< SVGNode > child) |
| SVGNode * | firstChild () const |
| SVGNode * | lastChild () const |
| ElementID | id () const |
| const AttributeList & | attributes () const |
| const SVGPropertyList & | properties () const |
| const SVGNodeList & | children () const |
| virtual Transform | localTransform () const |
| virtual Rect | fillBoundingBox () const |
| virtual Rect | strokeBoundingBox () const |
| virtual Rect | paintBoundingBox () const |
| SVGMarkerElement * | getMarker (std::string_view id) const |
| SVGClipPathElement * | getClipper (std::string_view id) const |
| SVGMaskElement * | getMasker (std::string_view id) const |
| SVGFilterElement * | getFilterElement (std::string_view id) const |
| SVGPaintElement * | getPainter (std::string_view id) const |
| SVGElement * | elementFromPoint (float x, float y) |
| template<typename T > | |
| void | transverse (T callback) |
| void | addProperty (SVGProperty &value) |
| SVGProperty * | getProperty (PropertyID id) const |
| Size | currentViewportSize () const |
| float | font_size () const |
| void | cloneChildren (SVGElement *parentElement) const |
| std::unique_ptr< SVGNode > | clone (bool deep) const final |
| virtual void | build () |
| virtual void | layoutElement (const SVGLayoutState &state) |
| void | layoutChildren (SVGLayoutState &state) |
| virtual void | layout (SVGLayoutState &state) |
| void | renderChildren (SVGRenderState &state) const |
| virtual void | render (SVGRenderState &state) const |
| virtual std::shared_ptr< Canvas > | applyFilterPrimitive (SVGFilterContext &context) const |
| bool | isDisplayNone () const |
| bool | isOverflowHidden () const |
| bool | isVisibilityHidden () const |
| bool | isHiddenElement () const |
| bool | isPointableElement () const |
| const SVGClipPathElement * | clipper () const |
| const SVGMaskElement * | masker () const |
| const SVGFilterElement * | filterElement () const |
| float | opacity () const |
| MixBlendMode | mixBlendMode () const |
| bool | isElement () const final |
Public Member Functions inherited from novasvg::SVGNode | |
| SVGNode (Document *document) | |
| virtual | ~SVGNode ()=default |
| virtual bool | isTextNode () const |
| virtual bool | isPaintElement () const |
| virtual bool | isGraphicsElement () const |
| virtual bool | isGeometryElement () const |
| virtual bool | isTextPositioningElement () const |
| Document * | document () const |
| SVGRootElement * | rootElement () const |
| SVGElement * | parentElement () const |
| void | setParentElement (SVGElement *parent) |
| bool | isRootElement () const |
Static Public Member Functions | |
| static std::unique_ptr< SVGElement > | create (Document *document, ElementID id) |
Definition at line 820 of file svgelement.h.
| NOVASVG_INLINE novasvg::SVGElement::SVGElement | ( | Document * | document, |
| ElementID | id | ||
| ) |
Definition at line 5191 of file svgelement.h.
|
virtualdefault |
| NOVASVG_INLINE SVGNode * novasvg::SVGElement::addChild | ( | std::unique_ptr< SVGNode > | child | ) |
Definition at line 5333 of file svgelement.h.
References novasvg::SVGNode::setParentElement().
Referenced by novasvg::SVGUseElement::build(), and cloneChildren().
| NOVASVG_INLINE void novasvg::SVGElement::addProperty | ( | SVGProperty & | value | ) |
Definition at line 5460 of file svgelement.h.
Referenced by novasvg::SVGCircleElement::SVGCircleElement(), novasvg::SVGClipPathElement::SVGClipPathElement(), novasvg::SVGEllipseElement::SVGEllipseElement(), novasvg::SVGFitToViewBox::SVGFitToViewBox(), novasvg::SVGForeignObjectElement::SVGForeignObjectElement(), novasvg::SVGGradientElement::SVGGradientElement(), novasvg::SVGGraphicsElement::SVGGraphicsElement(), novasvg::SVGImageElement::SVGImageElement(), novasvg::SVGLinearGradientElement::SVGLinearGradientElement(), novasvg::SVGLineElement::SVGLineElement(), novasvg::SVGMarkerElement::SVGMarkerElement(), novasvg::SVGMaskElement::SVGMaskElement(), novasvg::SVGPathElement::SVGPathElement(), novasvg::SVGPatternElement::SVGPatternElement(), novasvg::SVGPolyElement::SVGPolyElement(), novasvg::SVGRadialGradientElement::SVGRadialGradientElement(), novasvg::SVGRectElement::SVGRectElement(), novasvg::SVGStopElement::SVGStopElement(), novasvg::SVGSVGElement::SVGSVGElement(), novasvg::SVGTextPositioningElement::SVGTextPositioningElement(), novasvg::SVGURIReference::SVGURIReference(), and novasvg::SVGUseElement::SVGUseElement().
|
inlinevirtual |
Reimplemented in novasvg::SVGFEGaussianBlurElement, novasvg::SVGFEOffsetElement, novasvg::SVGFEFloodElement, novasvg::SVGFEMergeElement, novasvg::SVGFECompositeElement, and novasvg::SVGFEDropShadowElement.
Definition at line 892 of file svgelement.h.
|
inline |
Definition at line 848 of file svgelement.h.
Referenced by novasvg::SVGLinearGradientElement::applyPaint(), novasvg::SVGRadialGradientElement::applyPaint(), novasvg::SVGPatternElement::applyPaint(), novasvg::SVGGradientElement::collectGradientAttributes(), setAttributes(), and novasvg::SVGLayoutState::SVGLayoutState().
|
virtual |
Reimplemented in novasvg::SVGUseElement.
Definition at line 5516 of file svgelement.h.
References novasvg::toSVGElement().
Referenced by novasvg::SVGUseElement::build().
|
inline |
Definition at line 850 of file svgelement.h.
Referenced by novasvg::SVGClipPathElement::applyClipPath(), novasvg::SVGFilterElement::applyFilter(), novasvg::buildGradientStops(), novasvg::Element::children(), novasvg::SVGGradientElement::collectGradientAttributes(), nextElement(), novasvg::SVGFilterElement::pixelMargin(), previousElement(), and novasvg::SVGClipPathElement::requiresMasking().
|
inline |
Definition at line 901 of file svgelement.h.
Referenced by novasvg::SVGClipPathElement::applyClipMask(), novasvg::SVGMaskElement::applyMask(), and novasvg::SVGClipPathElement::requiresMasking().
|
finalvirtual |
Implements novasvg::SVGNode.
Definition at line 5508 of file svgelement.h.
References cloneChildren(), create(), and novasvg::SVGNode::document().
| NOVASVG_INLINE void novasvg::SVGElement::cloneChildren | ( | SVGElement * | parentElement | ) | const |
Definition at line 5501 of file svgelement.h.
References addChild(), and novasvg::SVGNode::parentElement().
Referenced by clone().
|
static |
Definition at line 5116 of file svgelement.h.
References novasvg::Circle, novasvg::ClipPath, novasvg::Defs, novasvg::SVGNode::document(), novasvg::Ellipse, novasvg::FeComposite, novasvg::FeDropShadow, novasvg::FeFlood, novasvg::FeGaussianBlur, novasvg::FeMerge, novasvg::FeMergeNode, novasvg::FeOffset, novasvg::Filter, novasvg::ForeignObject, novasvg::G, novasvg::Image, novasvg::Line, novasvg::LinearGradient, novasvg::Marker, novasvg::Mask, novasvg::Path, novasvg::Pattern, novasvg::Polygon, novasvg::Polyline, novasvg::RadialGradient, novasvg::Rect, novasvg::Stop, novasvg::Style, novasvg::Svg, novasvg::Switch, novasvg::Symbol, novasvg::Text, novasvg::Tspan, and novasvg::Use.
Referenced by clone().
| NOVASVG_INLINE Size novasvg::SVGElement::currentViewportSize | ( | ) | const |
Definition at line 5476 of file svgelement.h.
References novasvg::SVGNode::parentElement(), novasvg::Rect::size(), novasvg::Svg, novasvg::SVGRect::value(), novasvg::LengthContext::valueForLength(), and novasvg::SVGFitToViewBox::viewBox().
Referenced by novasvg::SVGGraphicsElement::localTransform().
| NOVASVG_INLINE SVGElement * novasvg::SVGElement::elementFromPoint | ( | float | x, |
| float | y | ||
| ) |
Definition at line 5434 of file svgelement.h.
References isPointableElement(), localTransform(), paintBoundingBox(), novasvg::SVGNode::parentElement(), and novasvg::toSVGElement().
Referenced by novasvg::Document::elementFromPoint().
|
virtual |
Reimplemented in novasvg::SVGImageElement, novasvg::SVGForeignObjectElement, novasvg::SVGTextElement, and novasvg::SVGGeometryElement.
Definition at line 5354 of file svgelement.h.
References novasvg::Rect::Empty, fillBoundingBox(), novasvg::Rect::Invalid, isHiddenElement(), novasvg::Rect::isValid(), novasvg::toSVGElement(), and novasvg::Rect::unite().
Referenced by novasvg::SVGClipPathElement::clipBoundingBox(), fillBoundingBox(), novasvg::SVGGraphicsElement::localTransform(), novasvg::SVGMaskElement::maskBoundingBox(), and novasvg::SVGMaskElement::maskRect().
|
inline |
Definition at line 903 of file svgelement.h.
| NOVASVG_INLINE const Attribute * novasvg::SVGElement::findAttribute | ( | PropertyID | id | ) | const |
Definition at line 5221 of file svgelement.h.
| NOVASVG_INLINE SVGNode * novasvg::SVGElement::firstChild | ( | ) | const |
Definition at line 5340 of file svgelement.h.
|
inline |
Definition at line 871 of file svgelement.h.
Referenced by novasvg::LengthContext::valueForLength().
| NOVASVG_INLINE const std::string & novasvg::SVGElement::getAttribute | ( | PropertyID | id | ) | const |
Definition at line 5243 of file svgelement.h.
References novasvg::emptyString, and novasvg::Attribute::value().
| NOVASVG_INLINE const std::string & novasvg::SVGElement::getAttribute | ( | std::string_view | name | ) | const |
Definition at line 5205 of file svgelement.h.
References novasvg::emptyString, getAttribute(), novasvg::propertyid(), and novasvg::Unknown.
Referenced by novasvg::RuleIndex::candidates(), novasvg::Element::getAttribute(), getAttribute(), and novasvg::switchChildPasses().
| NOVASVG_INLINE SVGClipPathElement * novasvg::SVGElement::getClipper | ( | std::string_view | id | ) | const |
Definition at line 5402 of file svgelement.h.
References novasvg::ClipPath, novasvg::SVGRootElement::getElementById(), and novasvg::SVGNode::rootElement().
Referenced by layoutElement().
| NOVASVG_INLINE SVGFilterElement * novasvg::SVGElement::getFilterElement | ( | std::string_view | id | ) | const |
Definition at line 5418 of file svgelement.h.
References novasvg::Filter, novasvg::SVGRootElement::getElementById(), and novasvg::SVGNode::rootElement().
Referenced by layoutElement().
| NOVASVG_INLINE SVGMarkerElement * novasvg::SVGElement::getMarker | ( | std::string_view | id | ) | const |
Definition at line 5394 of file svgelement.h.
References novasvg::SVGRootElement::getElementById(), novasvg::Marker, and novasvg::SVGNode::rootElement().
Referenced by novasvg::SVGGeometryElement::updateMarkerPositions().
| NOVASVG_INLINE SVGMaskElement * novasvg::SVGElement::getMasker | ( | std::string_view | id | ) | const |
Definition at line 5410 of file svgelement.h.
References novasvg::SVGRootElement::getElementById(), novasvg::Mask, and novasvg::SVGNode::rootElement().
Referenced by layoutElement().
| NOVASVG_INLINE SVGPaintElement * novasvg::SVGElement::getPainter | ( | std::string_view | id | ) | const |
Definition at line 5426 of file svgelement.h.
References novasvg::SVGRootElement::getElementById(), and novasvg::SVGNode::rootElement().
Referenced by novasvg::SVGGraphicsElement::getPaintServer().
| NOVASVG_INLINE SVGProperty * novasvg::SVGElement::getProperty | ( | PropertyID | id | ) | const |
Definition at line 5465 of file svgelement.h.
Referenced by parseAttribute().
| NOVASVG_INLINE bool novasvg::SVGElement::hasAttribute | ( | PropertyID | id | ) | const |
Definition at line 5232 of file svgelement.h.
| NOVASVG_INLINE bool novasvg::SVGElement::hasAttribute | ( | std::string_view | name | ) | const |
Definition at line 5197 of file svgelement.h.
References hasAttribute(), novasvg::propertyid(), and novasvg::Unknown.
Referenced by novasvg::SVGGradientElement::collectGradientAttributes(), novasvg::handleTextChunk(), novasvg::Element::hasAttribute(), hasAttribute(), and novasvg::switchChildPasses().
|
inline |
Definition at line 847 of file svgelement.h.
Referenced by novasvg::Document::applyStyleSheet(), novasvg::RuleIndex::candidates(), novasvg::SVGGradientElement::collectGradientAttributes(), and novasvg::isDisallowedElement().
|
inline |
Definition at line 894 of file svgelement.h.
References novasvg::None.
Referenced by isHiddenElement(), novasvg::SVGUseElement::render(), novasvg::SVGImageElement::render(), novasvg::SVGForeignObjectElement::render(), novasvg::SVGGElement::render(), novasvg::SVGSwitchElement::render(), novasvg::SVGTextElement::render(), and novasvg::SVGSVGElement::render().
|
inlinefinalvirtual |
Reimplemented from novasvg::SVGNode.
Definition at line 907 of file svgelement.h.
| NOVASVG_INLINE bool novasvg::SVGElement::isHiddenElement | ( | ) | const |
Definition at line 5570 of file svgelement.h.
References novasvg::ClipPath, novasvg::Defs, novasvg::FeComposite, novasvg::FeDropShadow, novasvg::FeFlood, novasvg::FeGaussianBlur, novasvg::FeMerge, novasvg::FeMergeNode, novasvg::FeOffset, novasvg::Filter, isDisplayNone(), novasvg::LinearGradient, novasvg::Marker, novasvg::Mask, novasvg::Pattern, novasvg::RadialGradient, novasvg::Stop, and novasvg::Symbol.
Referenced by fillBoundingBox(), and strokeBoundingBox().
|
inline |
Definition at line 895 of file svgelement.h.
References novasvg::Hidden.
Referenced by novasvg::SVGSVGElement::render(), and novasvg::SVGMarkerElement::renderMarker().
| NOVASVG_INLINE bool novasvg::SVGElement::isPointableElement | ( | ) | const |
Definition at line 5598 of file svgelement.h.
References novasvg::Circle, novasvg::Ellipse, novasvg::ForeignObject, novasvg::Hidden, novasvg::Image, novasvg::Line, novasvg::None, novasvg::Path, novasvg::Polygon, novasvg::Polyline, novasvg::Rect, and novasvg::Text.
Referenced by elementFromPoint().
|
inline |
Definition at line 896 of file svgelement.h.
References novasvg::Visible.
Referenced by novasvg::SVGImageElement::render(), novasvg::SVGForeignObjectElement::render(), and novasvg::SVGTextElement::render().
| NOVASVG_INLINE SVGNode * novasvg::SVGElement::lastChild | ( | ) | const |
Definition at line 5347 of file svgelement.h.
|
virtual |
Reimplemented in novasvg::SVGRootElement, and novasvg::SVGTextElement.
Definition at line 5550 of file svgelement.h.
References layoutChildren(), and layoutElement().
Referenced by novasvg::SVGRootElement::layout(), and novasvg::SVGTextElement::layout().
| NOVASVG_INLINE void novasvg::SVGElement::layoutChildren | ( | SVGLayoutState & | state | ) |
Definition at line 5541 of file svgelement.h.
References novasvg::toSVGElement().
Referenced by layout().
|
virtual |
Reimplemented in novasvg::SVGForeignObjectElement, novasvg::SVGMaskElement, novasvg::SVGStopElement, novasvg::SVGGeometryElement, and novasvg::SVGTextPositioningElement.
Definition at line 5525 of file svgelement.h.
References novasvg::render::state::font_size, getClipper(), getFilterElement(), getMasker(), novasvg::Rect::Invalid, and novasvg::render::state::opacity.
Referenced by layout(), novasvg::SVGForeignObjectElement::layoutElement(), novasvg::SVGMaskElement::layoutElement(), novasvg::SVGStopElement::layoutElement(), novasvg::SVGGeometryElement::layoutElement(), and novasvg::SVGTextPositioningElement::layoutElement().
|
inlinevirtual |
Reimplemented in novasvg::SVGUseElement, novasvg::SVGMarkerElement, novasvg::SVGGraphicsElement, and novasvg::SVGSVGElement.
Definition at line 852 of file svgelement.h.
References novasvg::Transform::Identity.
Referenced by elementFromPoint(), novasvg::Element::getGlobalMatrix(), novasvg::Element::getLocalMatrix(), and novasvg::Element::renderToBitmap().
|
inline |
Definition at line 902 of file svgelement.h.
Referenced by novasvg::SVGMaskElement::applyMask().
|
inline |
Definition at line 905 of file svgelement.h.
| NOVASVG_INLINE SVGElement * novasvg::SVGElement::nextElement | ( | ) | const |
Definition at line 5312 of file svgelement.h.
References children(), novasvg::SVGNode::isTextNode(), and novasvg::SVGNode::parentElement().
|
inline |
|
virtual |
Definition at line 5382 of file svgelement.h.
References novasvg::SVGClipPathElement::clipBoundingBox(), novasvg::Rect::Empty, novasvg::Rect::intersect(), novasvg::Rect::isValid(), novasvg::SVGMaskElement::maskBoundingBox(), and strokeBoundingBox().
Referenced by novasvg::SVGRenderState::beginGroup(), novasvg::SVGClipPathElement::clipBoundingBox(), elementFromPoint(), novasvg::Element::getBoundingBox(), novasvg::SVGRootElement::layout(), novasvg::SVGMarkerElement::markerBoundingBox(), and novasvg::SVGMaskElement::maskBoundingBox().
|
virtual |
Reimplemented in novasvg::SVGImageElement.
Definition at line 5283 of file svgelement.h.
References getProperty(), novasvg::SVGNode::rootElement(), and novasvg::SVGRootElement::setNeedsLayout().
Referenced by novasvg::SVGImageElement::parseAttribute(), and setAttribute().
| NOVASVG_INLINE SVGElement * novasvg::SVGElement::previousElement | ( | ) | const |
Definition at line 5291 of file svgelement.h.
References children(), novasvg::SVGNode::isTextNode(), and novasvg::SVGNode::parentElement().
|
inline |
Definition at line 849 of file svgelement.h.
|
virtual |
Reimplemented in novasvg::SVGUseElement, novasvg::SVGImageElement, novasvg::SVGForeignObjectElement, novasvg::SVGGElement, novasvg::SVGSwitchElement, novasvg::SVGTextElement, novasvg::SVGSVGElement, and novasvg::SVGGeometryElement.
Definition at line 5566 of file svgelement.h.
Referenced by novasvg::Element::render().
| NOVASVG_INLINE void novasvg::SVGElement::renderChildren | ( | SVGRenderState & | state | ) | const |
Definition at line 5557 of file svgelement.h.
References novasvg::toSVGElement().
Referenced by novasvg::SVGClipPathElement::applyClipMask(), novasvg::SVGMaskElement::applyMask(), novasvg::SVGUseElement::render(), novasvg::SVGGElement::render(), novasvg::SVGSVGElement::render(), and novasvg::SVGMarkerElement::renderMarker().
| NOVASVG_INLINE bool novasvg::SVGElement::setAttribute | ( | const Attribute & | attribute | ) |
Definition at line 5278 of file svgelement.h.
References novasvg::Attribute::id(), setAttribute(), novasvg::Attribute::specificity(), and novasvg::Attribute::value().
| NOVASVG_INLINE bool novasvg::SVGElement::setAttribute | ( | int | specificity, |
| PropertyID | id, | ||
| const std::string & | value | ||
| ) |
Definition at line 5254 of file svgelement.h.
References parseAttribute().
| NOVASVG_INLINE bool novasvg::SVGElement::setAttribute | ( | std::string_view | name, |
| const std::string & | value | ||
| ) |
Definition at line 5213 of file svgelement.h.
References novasvg::propertyid(), setAttribute(), and novasvg::Unknown.
Referenced by novasvg::Document::applyStyleSheet(), novasvg::parseInlineStyle(), setAttribute(), novasvg::Element::setAttribute(), setAttribute(), and setAttributes().
| NOVASVG_INLINE void novasvg::SVGElement::setAttributes | ( | const AttributeList & | attributes | ) |
Definition at line 5271 of file svgelement.h.
References attributes(), and setAttribute().
|
virtual |
Reimplemented in novasvg::SVGImageElement, novasvg::SVGForeignObjectElement, novasvg::SVGTextElement, and novasvg::SVGGeometryElement.
Definition at line 5368 of file svgelement.h.
References novasvg::Rect::Empty, novasvg::Rect::Invalid, isHiddenElement(), novasvg::Rect::isValid(), strokeBoundingBox(), novasvg::toSVGElement(), and novasvg::Rect::unite().
Referenced by paintBoundingBox(), and strokeBoundingBox().
|
inline |
Definition at line 949 of file svgelement.h.
References novasvg::toSVGElement().