pub struct RetainedPlacement {
pub linear: [f64; 4],
pub translation: (f64, f64),
}Expand description
Where a retained body lands on the device grid: the composed transform its local coordinates are mapped through, split into the linear part and the translation.
A page holds the body rasterized under one placement. Another placement
can be served from it only when the linear parts agree — the same scale,
rotation and skew, so the page’s pixels are the pixels the body would draw
there — and the translations differ by a move a 1:1 composite can make
(Self::offset_to).
Fields§
§linear: [f64; 4]The transform’s linear part, [a, b, c, d] in kurbo’s coefficient
order.
translation: (f64, f64)The transform’s translation, in device pixels.
Implementations§
Source§impl RetainedPlacement
impl RetainedPlacement
Sourcepub const LINEAR_EPSILON: f64 = 1e-6
pub const LINEAR_EPSILON: f64 = 1e-6
How far apart two linear parts may be and still be read as one: well below anything a scale animation or a device-scale change produces, and well above the rounding a transform recomposed from the same factors accumulates.
Sourcepub fn offset_to(&self, other: &Self) -> Option<(i32, i32)>
pub fn offset_to(&self, other: &Self) -> Option<(i32, i32)>
The whole-pixel move from self to other, or None when the two
differ in anything but their translation.
A fractional move is rounded to the nearest whole pixel: a composite is a 1:1 copy of the page’s texels and cannot land between them, so a body sliding by a fraction of a pixel per frame is drawn at most half a pixel from where an inline lowering would rasterize it. A whole-pixel move (the common case of a scroll or a pixel-snapped transition) is exact.