pub struct PathPlacement {
pub region: AtlasRegion,
pub device_rect: [f32; 4],
}Expand description
A rasterized path plus the exact rect it must be drawn at.
The two travel together because they are one decision, not two. The atlas
bitmap is rasterized on its own integer grid; if the quad that samples it
is placed or sized even slightly differently, every texel is resampled
through the atlas’s FilterMode::Linear and the coverage mask smears.
A 16 dp line-style icon does not survive that: a 1 px stroke drawn at a
half-pixel offset peaks at 48 % coverage instead of 100 %, and
sub-pixel dash gaps close up entirely, so a dashed ring renders as a grey
haze. Returning the rect from the same call that decides the raster is
what stops the two from ever disagreeing again.
See PathAtlas::lookup_or_rasterize for when the rect is snapped.
Fields§
§region: AtlasRegionWhere the coverage mask lives in the atlas texture.
device_rect: [f32; 4][x, y, w, h] in pre-transform device pixels — the quad the
caller must emit. When snapped this is integral and exactly
region.w × region.h, so the mask samples 1:1 onto whole pixels.
Trait Implementations§
Source§impl Clone for PathPlacement
impl Clone for PathPlacement
Source§fn clone(&self) -> PathPlacement
fn clone(&self) -> PathPlacement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more