pub enum MaskShader {
Linear {
from: Point,
to: Point,
from_color: Color,
to_color: Color,
},
Radial {
center: Point,
radius: f32,
from_color: Color,
to_color: Color,
},
}Expand description
What a layer does at compositing, for painting a scene by hand.
The colour a ShaderMask blends over its subtree, as a two-stop fade.
The geometry is absolute, in the same space as the primitives it covers —
the same choice PathGradient makes, and for the same
reason: a fade should be aimed at something real, and a scene primitive holding
a fraction of a box no longer knows which box.
The widget is where fractions belong, and ShaderMask there does take them: it
resolves a FractionalMask against its own box on the way into the scene.
Two stops rather than a list, which is what the gradients elsewhere in this
framework offer; a mask needing more is a CustomPaint away.
Variants§
Linear
A straight fade from from to to, clamped outside that span.
Fields
Radial
A fade outwards from center, reaching to_color at radius.
Implementations§
Source§impl MaskShader
impl MaskShader
Sourcepub fn scaled_xy(self, sx: f32, sy: f32) -> MaskShader
pub fn scaled_xy(self, sx: f32, sy: f32) -> MaskShader
Scales the geometry per axis, as a DPI or paint scale does. A radius has no axis of its own and follows the average, like every other scalar length in a scene.
Sourcepub fn translated(self, dx: f32, dy: f32) -> MaskShader
pub fn translated(self, dx: f32, dy: f32) -> MaskShader
Moves the geometry with the subtree it covers.
Trait Implementations§
Source§impl Clone for MaskShader
impl Clone for MaskShader
Source§fn clone(&self) -> MaskShader
fn clone(&self) -> MaskShader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more