pub struct Transform {
pub a: f32,
pub b: f32,
pub c: f32,
pub d: f32,
pub e: f32,
pub f: f32,
}Expand description
An affine placement: where a shape’s own coordinates land on the page.
The six numbers are the usual two-by-three, in the order matrix() writes
them: x' = a x + c y + e and y' = b x + d y + f. The two offsets are in
points, as every length in this crate is.
Fields§
§a: f32x from x.
b: f32y from x.
c: f32x from y.
d: f32y from y.
e: f32The x offset, in points.
f: f32The y offset, in points.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn parse(text: &str) -> Option<Self>
pub fn parse(text: &str) -> Option<Self>
Read a draw:transform attribute.
None where nothing in it parsed, so that a shape carrying an attribute
this cannot read is placed by its corner rather than at the page’s
origin. An operation this does not know is skipped and the rest is kept:
a shape drawn from three of its four operations is closer to right than a
shape not drawn.
Sourcepub fn apply(self, (x, y): (f32, f32)) -> (f32, f32)
pub fn apply(self, (x, y): (f32, f32)) -> (f32, f32)
Where a point in the shape’s own coordinates lands, in points.
Sourcepub fn is_upright(self) -> bool
pub fn is_upright(self) -> bool
Whether this turns or leans the shape, rather than only moving it.
A placement that does neither can be reduced to a corner and a size, which is what most of a renderer wants to be handed.