pub struct Group { /* private fields */ }
Expand description
A group container.
The preprocessor will remove all groups that don’t impact rendering. Those that left is just an indicator that a new canvas should be created.
g
element in SVG.
Implementations§
source§impl Group
impl Group
sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Element’s ID.
Taken from the SVG itself. Isn’t automatically generated. Can be empty.
sourcepub fn transform(&self) -> Transform
pub fn transform(&self) -> Transform
Element’s transform.
This is a relative transform. The one that is set via the transform
attribute in SVG.
sourcepub fn abs_transform(&self) -> Transform
pub fn abs_transform(&self) -> Transform
Element’s absolute transform.
Contains all ancestors transforms including group’s transform.
Note that subroots, like clipPaths, masks and patterns, have their own root transform, which isn’t affected by the node that references this subroot.
sourcepub fn opacity(&self) -> Opacity
pub fn opacity(&self) -> Opacity
Group opacity.
After the group is rendered we should combine it with a parent group using the specified opacity.
sourcepub fn blend_mode(&self) -> BlendMode
pub fn blend_mode(&self) -> BlendMode
Group blend mode.
mix-blend-mode
in SVG.
sourcepub fn bounding_box(&self) -> Rect
pub fn bounding_box(&self) -> Rect
Element’s object bounding box.
objectBoundingBox
in SVG terms. Meaning it doesn’t affected by parent transforms.
Can be set to None
in case of an empty group.
sourcepub fn abs_bounding_box(&self) -> Rect
pub fn abs_bounding_box(&self) -> Rect
Element’s bounding box in canvas coordinates.
userSpaceOnUse
in SVG terms.
sourcepub fn stroke_bounding_box(&self) -> Rect
pub fn stroke_bounding_box(&self) -> Rect
Element’s object bounding box including stroke.
Similar to bounding_box
, but includes stroke.
sourcepub fn abs_stroke_bounding_box(&self) -> Rect
pub fn abs_stroke_bounding_box(&self) -> Rect
Element’s bounding box including stroke in user coordinates.
Similar to abs_bounding_box
, but includes stroke.
sourcepub fn layer_bounding_box(&self) -> NonZeroRect
pub fn layer_bounding_box(&self) -> NonZeroRect
Element’s “layer” bounding box in object units.
Conceptually, this is stroke_bounding_box
expanded and/or clipped
by filters_bounding_box
, but also including all the children.
This is the bounding box resvg
will later use to allocate layers/pixmaps
during isolated groups rendering.
Only groups have it, because only groups can have filters. For other nodes layer bounding box is the same as stroke bounding box.
Unlike other bounding boxes, cannot have zero size.
sourcepub fn abs_layer_bounding_box(&self) -> NonZeroRect
pub fn abs_layer_bounding_box(&self) -> NonZeroRect
Element’s “layer” bounding box in canvas units.
sourcepub fn should_isolate(&self) -> bool
pub fn should_isolate(&self) -> bool
Checks if this group should be isolated during rendering.
sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Returns true
if the group has any children.
sourcepub fn filters_bounding_box(&self) -> Option<NonZeroRect>
pub fn filters_bounding_box(&self) -> Option<NonZeroRect>
Calculates a node’s filter bounding box.
Filters with objectBoundingBox
and missing or zero bounding_box
would be ignored.
Note that a filter region can act like a clipping rectangle,
therefore this function can produce a bounding box smaller than bounding_box
.
Returns None
when then group has no filters.
This function is very fast, that’s why we do not store this bbox as a Group
field.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Group
impl !RefUnwindSafe for Group
impl Send for Group
impl Sync for Group
impl Unpin for Group
impl !UnwindSafe for Group
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)