FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ImmutableCustomEffect

    struct · ferroui-base · v0.5.0

    struct ImmutableCustomEffect
    

    The immutable snapshot of a custom effect: what Visual.Effect holds for a custom effect value and what crosses to the render thread.

    It is Send + Sync and compares by value. Cloning shares the value.

    View source

    Members

    new

    fn new<T: CustomEffect>(value: T) -> Self
    

    The snapshot of value.

    Source

    name

    fn name(self: &Self) -> &'static str
    

    The name of the effect (CustomEffect::NAME).

    Source

    value_type_id

    fn value_type_id(self: &Self) -> TypeId
    

    The type of the value, by which a backend finds its factory for the effect.

    Source

    is

    fn is<T: CustomEffect>(self: &Self) -> bool
    

    Whether the value is a T.

    Source

    downcast_ref

    fn downcast_ref<T: CustomEffect>(self: &Self) -> Option<&T>
    

    The value, when it is a T.

    Source

    padding

    fn padding(self: &Self) -> Thickness
    

    How far the output of the effect extends beyond the bounds of its content (CustomEffect::padding): each side at least zero, a value that is not finite read as zero. A shader effect whose padding is ShaderEffectPadding::SampleRadius adds its sample radius to each side.

    Source

    for_each_parameter

    fn for_each_parameter(self: &Self, f: &mut dyn FnMut(&'static str, EffectParameterValue) -> ())
    

    Calls f with the name and value of each parameter (CustomEffect::for_each_parameter), without allocating.

    Source

    parameters

    fn parameters(self: &Self) -> Vec<(&'static str, EffectParameterValue)>
    

    The parameters with their values.

    Source

    parameter

    fn parameter(self: &Self, name: &str) -> Option<EffectParameterValue>
    

    The value of the parameter name (ignoring case, - and _).

    Source

    interpolate

    fn interpolate(self: &Self, to: &ImmutableCustomEffect, progress: f64) -> Option<ImmutableCustomEffect>
    

    The effect at progress of the way from self to to (CustomEffect::interpolate); None when the two are effects of different types.

    Source

    neutral

    fn neutral(self: &Self) -> Option<ImmutableCustomEffect>
    

    The value of this effect's type that leaves its content unchanged (CustomEffect::neutral).

    Source

    has_graph

    fn has_graph(self: &Self) -> bool
    

    Whether the type of the effect has a graph that loaded (CustomEffect::graph): the render walk draws the effect as that graph around the content of its visual.

    Source

    graph_error

    fn graph_error(self: &Self) -> Option<CompositionEffectFactoryError>
    

    Why the graph of the type of the effect did not load, as an effect factory reports it; None when it loaded or the type has none.

    Source

    graph_members

    fn graph_members(self: &Self) -> Vec<(&'static str, String)>
    

    The animatable members of the graph of the type: for each value of for_each_graph_value, in order, its name and the full name of the member it sets (EffectName.PropertyName). Empty without a graph.

    Source

    for_each_graph_value

    fn for_each_graph_value(self: &Self, f: &mut dyn FnMut(&'static str, EffectParameterValue) -> ())
    

    Calls f with the name and value of each animatable member of the graph of the effect (CustomEffect::for_each_graph_value).

    Source

    cpu_reference

    fn cpu_reference(self: &Self, pixels: &mut [u8], width: usize, height: usize, scale: f64) -> bool
    

    Applies the CPU reference of the effect to premultiplied RGBA pixels (CustomEffect::cpu_reference); returns whether the effect has one.

    Source

    shader

    fn shader(self: &Self) -> Option<Arc<ShaderEffectDescription>>
    

    The runtime shader of the type of the effect, read once per type (CustomEffect::shader); None when the type has none, or has a graph, which takes precedence.

    Source

    has_shader

    fn has_shader(self: &Self) -> bool
    

    Whether the type of the effect is a runtime shader effect (shader).

    Source

    for_each_shader_uniform

    fn for_each_shader_uniform(self: &Self, layer_size: [f32; 2], layer_scale: f32, f: &mut dyn FnMut(&'static str, ShaderUniformValue) -> ())
    

    Calls f with the name and the value of each uniform of the shader of the effect by the convention of ShaderEffectDescription: layer_size (the area of the effect in device pixels), layer_scale (device pixels per device independent pixel), then the parameters in order (text skipped), named as CustomEffect::for_each_parameter names them. Without allocating: what a backend calls each frame to fill the uniforms of the program.

    Source

    shader_uniform_layout

    fn shader_uniform_layout(self: &Self) -> Vec<(String, ShaderUniformType)>
    

    The uniforms a program of the shader of this effect's type declares by the convention, in order: their names (a parameter's with every - written _) and types. What a backend checks a compiled program against, once.

    Source

    for_each_shader_child

    fn for_each_shader_child(self: &Self, f: &mut dyn FnMut(&str, &EffectImage) -> ())
    

    Calls f with the name and the image of each child of the shader of the effect (#455, E6), in the order of the description's children: the name of the image parameter (the child of the program is that name with every - written _) and its value in this snapshot, the empty image when the effect has no image parameter of that name. Without allocating: what a backend calls each frame to bind the children of the program. Nothing for an effect without a shader.

    Source

    check_shader_children

    fn check_shader_children(self: &Self) -> Result<(), String>
    

    Checks the children of the shader of the effect's type against its parameters (#455, E6): at most MAX_SHADER_CHILDREN, each the name of an image parameter of the effect, none twice and none content, and none for a program that samples the content (see ShaderEffectDescription::children). What both backends check once per type before they compile the program; the error says why not. Ok for an effect without a shader or without children.

    Source

    report_unhandled

    fn report_unhandled(self: &Self, backend: &'static str) -> bool
    

    Reports that backend has no factory for this effect, so that it draws the content of the effect unchanged. The first report of each backend and effect name is logged (a warning in the log area named by backend) and returns true; later ones return false. Called by the drawing contexts of the backends on the render thread.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ToString
    • ErasedDestructor
    • IntoEither
    • Clone
    • Debug
    • PartialEq
    • From<ImmutableCustomEffect>
    • Display
    • IEffect
    • IImmutableEffect

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.