Trait svgdom::ElementType
source · pub trait ElementType {
fn is_referenced(&self) -> bool;
fn is_basic_shape(&self) -> bool;
fn is_shape(&self) -> bool;
fn is_container(&self) -> bool;
fn is_text_content(&self) -> bool;
fn is_text_content_child(&self) -> bool;
fn is_graphic(&self) -> bool;
fn is_gradient(&self) -> bool;
fn is_paint_server(&self) -> bool;
fn is_filter_primitive(&self) -> bool;
}
Expand description
Required Methods
sourcefn is_referenced(&self) -> bool
fn is_referenced(&self) -> bool
Returns true if the current node is referenced.
Referenced elements are elements that do not render by itself, rather defines rendering properties for other.
List: altGlyphDef
, clipPath
, cursor
, filter
, linearGradient
, marker
,
mask
, pattern
, radialGradient
and symbol
.
Details: https://www.w3.org/TR/SVG/struct.html#Head
Examples
use svgdom::{Document, ElementType};
let doc = Document::from_str(
"<svg xmlns='http://www.w3.org/2000/svg'><linearGradient/></svg>").unwrap();
let mut iter = doc.root().descendants();
assert_eq!(iter.next().unwrap().is_referenced(), false); // root
assert_eq!(iter.next().unwrap().is_referenced(), false); // svg
assert_eq!(iter.next().unwrap().is_referenced(), true); // linearGradient
sourcefn is_basic_shape(&self) -> bool
fn is_basic_shape(&self) -> bool
Returns true if the current node is a basic shape element.
List: rect
, circle
, ellipse
, line
, polyline
, polygon
.
sourcefn is_shape(&self) -> bool
fn is_shape(&self) -> bool
Returns true if the current node is a shape element.
List: path
, rect
, circle
, ellipse
, line
, polyline
and polygon
.
sourcefn is_container(&self) -> bool
fn is_container(&self) -> bool
Returns true if the current node is a container element.
List: a
, defs
, glyph
, g
, marker
, mask
, missing-glyph
, pattern
, svg
,
switch
and symbol
.
Details: https://www.w3.org/TR/SVG/intro.html#TermContainerElement
sourcefn is_text_content(&self) -> bool
fn is_text_content(&self) -> bool
Returns true if the current node is a text content element.
List: altGlyph
, textPath
, text
, tref
and tspan
.
Details: https://www.w3.org/TR/SVG/intro.html#TermTextContentElement
sourcefn is_text_content_child(&self) -> bool
fn is_text_content_child(&self) -> bool
Returns true if the current node is a text content child element.
List: altGlyph
, textPath
, tref
and tspan
.
Details: https://www.w3.org/TR/SVG/intro.html#TermTextContentChildElement
sourcefn is_graphic(&self) -> bool
fn is_graphic(&self) -> bool
Returns true if the current node is a graphic element.
List: circle
, ellipse
, image
, line
, path
, polygon
, polyline
, rect
,
text
and use
.
Details: https://www.w3.org/TR/SVG/intro.html#TermGraphicsElement
sourcefn is_gradient(&self) -> bool
fn is_gradient(&self) -> bool
Returns true if the current node is a gradient element.
List: linearGradient
, radialGradient
.
sourcefn is_paint_server(&self) -> bool
fn is_paint_server(&self) -> bool
Returns true if the current node is a paint server.
List: linearGradient
, radialGradient
and pattern
.
sourcefn is_filter_primitive(&self) -> bool
fn is_filter_primitive(&self) -> bool
Returns true if the current node is a filter primitive.
List: feBlend
, feColorMatrix
, feComponentTransfer
, feComposite
,
feConvolveMatrix
, feDiffuseLighting
, feDisplacementMap
, feFlood
, feGaussianBlur
,
feImage
, feMerge
, feMorphology
, feOffset
, feSpecularLighting
,
feTile
and feTurbulence
.