pub enum RenderEffect {
Blur {
radius_x: f32,
radius_y: f32,
edge_treatment: TileMode,
},
Offset {
offset_x: f32,
offset_y: f32,
},
Shader {
shader: RuntimeShader,
},
Chain {
first: Box<RenderEffect>,
second: Box<RenderEffect>,
},
}Expand description
A render effect applied to a graphics layer’s rendered content.
Matches Jetpack Compose’s RenderEffect sealed class hierarchy,
extended with Shader for custom WGSL effects.
Variants§
Blur
Gaussian blur applied to the layer’s rendered content.
Offset
Offset the rendered content by a fixed amount.
Shader
Apply a custom WGSL shader effect.
Fields
shader: RuntimeShaderChain
Chain two effects: apply first, then apply second to the result.
Implementations§
Source§impl RenderEffect
impl RenderEffect
Sourcepub fn blur(radius: f32) -> RenderEffect
pub fn blur(radius: f32) -> RenderEffect
Create a blur effect with equal radius in both directions.
Sourcepub fn blur_with_edge_treatment(
radius: f32,
edge_treatment: TileMode,
) -> RenderEffect
pub fn blur_with_edge_treatment( radius: f32, edge_treatment: TileMode, ) -> RenderEffect
Create a blur effect with equal radius in both directions and explicit edge treatment semantics.
Sourcepub fn blur_xy(
radius_x: f32,
radius_y: f32,
edge_treatment: TileMode,
) -> RenderEffect
pub fn blur_xy( radius_x: f32, radius_y: f32, edge_treatment: TileMode, ) -> RenderEffect
Create a blur effect with separate horizontal and vertical radii.
Sourcepub fn offset(offset_x: f32, offset_y: f32) -> RenderEffect
pub fn offset(offset_x: f32, offset_y: f32) -> RenderEffect
Create an offset effect.
Sourcepub fn runtime_shader(shader: RuntimeShader) -> RenderEffect
pub fn runtime_shader(shader: RuntimeShader) -> RenderEffect
Create a custom shader effect from a RuntimeShader.
Sourcepub fn then(self, other: RenderEffect) -> RenderEffect
pub fn then(self, other: RenderEffect) -> RenderEffect
Chain this effect with another: self is applied first, then other.
Sourcepub fn contains_runtime_shader(&self) -> bool
pub fn contains_runtime_shader(&self) -> bool
Returns true if this effect or any chained sub-effect is a
RuntimeShader. Animated shaders produce different output every frame,
so layer surface caching is counterproductive for them.
Trait Implementations§
Source§impl Clone for RenderEffect
impl Clone for RenderEffect
Source§fn clone(&self) -> RenderEffect
fn clone(&self) -> RenderEffect
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more