Function rsvg::rect::rect_to_transform
source · pub fn rect_to_transform(
rect: &Option<Rect>,
units: CoordUnits
) -> Result<Transform, ()>
Expand description
Creates a transform to map to a rectangle.
The rectangle is an Option<Rect>
to indicate the possibility that there is no
bounding box from where the rectangle could be obtained.
This depends on a CoordUnits
parameter. When this is
CoordUnits::ObjectBoundingBox
, the bounding box must not be empty, since the calling
code would then not have a usable size to work with. In that case, if the bbox is
empty, this function returns Err(())
.
Usually calling code can simply ignore the action it was about to take if this function returns an error.