pub struct ShadowRRect {
pub bounds: Rect,
pub radii: [f32; 4],
pub umbra_inset: f32,
pub distance_correction: f32,
pub hole: Option<ShadowHole>,
}Expand description
One pass of a shadow as Skia’s ShadowCircularRRectOp draws it: a round
rect whose penumbra rises from its outer edge, bounds, toward the umbra
umbra_inset in. Corners are fans of triangles whose offsets the GPU
interpolates, so a corner is a quarter circle where the umbra meets its
radius and a skewed one where the blur is wider. Every length is in the
space the shadow is collected in.
Fields§
§bounds: RectThe penumbra’s outer edge.
radii: [f32; 4]The outer corner radii: top-left, top-right, bottom-right, bottom-left.
umbra_inset: f32How far in from bounds the ramp runs, at most half the smaller side.
distance_correction: f32The ramp’s coordinate at the umbra: the umbra inset over the blur.
hole: Option<ShadowHole>The part an opaque caster covers, which the shadow leaves undrawn.
Implementations§
Source§impl ShadowRRect
impl ShadowRRect
Sourcepub fn scaled(self, scale: f32) -> Self
pub fn scaled(self, scale: f32) -> Self
The same shadow in a space whose units are scale of this one’s.
Sourcepub fn translated(self, dx: f32, dy: f32) -> Self
pub fn translated(self, dx: f32, dy: f32) -> Self
The same shadow moved by dx, dy.
Sourcepub fn coverage(&self, x: f32, y: f32) -> f32
pub fn coverage(&self, x: f32, y: f32) -> f32
How much of the shadow’s color the point x, y takes: the falloff
at the offset Skia’s mesh interpolates there, zero outside the shadow
and in its hole.
Sourcepub fn row_coverage(&self, columns: Range<i32>, y: f32, out: &mut [f32])
pub fn row_coverage(&self, columns: Range<i32>, y: f32, out: &mut [f32])
Self::coverage at the centres of the pixels columns of the row
whose centres lie at y, into out: columns alike in what their x
gives the coverage, as the umbra’s middle is, compute it once.
Sourcepub fn row_key(&self, y: f32) -> ShadowRowKey
pub fn row_key(&self, y: f32) -> ShadowRowKey
What a row of pixels whose centres lie at y gives
Self::coverage besides x: two rows with equal keys take equal
coverage at every x, so a raster computes a row once for the rows
alike that follow it.