EffectParameterValue
enum · ferroui-base · v0.5.0
enum EffectParameterValue
The value of a parameter of a custom effect.
The parameters are what parsing reads and writes (tint(color=#0F9D8E, strength=0.55)), what the default interpolation interpolates, and what a
backend factory hands to its GPU program as uniforms (an image as a
child).
Members
BoolIntFloatColorPointVectorSizeRectTextImageas_boolas_intas_floatas_coloras_pointas_vectoras_sizeas_rectas_textas_imageinterpolateparse_like
Bool
Bool(bool)
true or false. Steps when interpolated.
Int
Int(i32)
An integer, also the value of an enumeration. Interpolated and rounded.
Float
Float(f64)
A number.
Color
Color(crate::media::Color)
A colour: #AARRGGBB, #RRGGBB or a colour name.
Point
Point(crate::Point)
A point: x,y.
Vector
Vector(crate::Vector)
A vector: x,y.
Size
Size(crate::Size)
A size: width,height.
Rect
Rect(crate::Rect)
A rectangle: x,y,width,height.
Text
Text(std::sync::Arc<str>)
A name or other text. Steps when interpolated.
Image
Image(super::EffectImage)
An image (#455, E6): a handle of a bitmap, compared by identity, that
the program of a shader effect samples as a child (see
ShaderEffectDescription). Switches at half when interpolated; an
empty handle takes the image of the other side.
An effect string cannot name an image (markup has no resource context in an effect string): parsing a value for an image parameter fails, and the effect string of a snapshot leaves its images out, so that it parses back to the effect with empty images. An image is set from code, on the value or on the snapshot of a mutable effect class.
as_bool
fn as_bool(self: &Self) -> Option<bool>
The value as a boolean.
as_int
fn as_int(self: &Self) -> Option<i32>
The value as an integer.
as_float
fn as_float(self: &Self) -> Option<f64>
The value as a number; an integer converts.
as_color
fn as_color(self: &Self) -> Option<Color>
The value as a colour.
as_point
fn as_point(self: &Self) -> Option<Point>
The value as a point; a vector converts.
as_vector
fn as_vector(self: &Self) -> Option<Vector>
The value as a vector; a point converts.
as_size
fn as_size(self: &Self) -> Option<Size>
The value as a size.
as_rect
fn as_rect(self: &Self) -> Option<Rect>
The value as a rectangle.
as_text
fn as_text(self: &Self) -> Option<&str>
The value as text.
as_image
fn as_image(self: &Self) -> Option<&EffectImage>
The value as an image.
interpolate
fn interpolate(self: &Self, to: &Self, progress: f64) -> Option<Self>
The value at progress (0 to 1) of the way from self to to, or
None when the two are of different kinds or the kind does not
interpolate (booleans and text step). Two images switch at half; an
empty image is the other image all the way (a transition from no
effect keeps the images of the effect it goes to).
parse_like
fn parse_like(self: &Self, text: &str) -> Option<Self>
Parses text as a value of the same kind as self (the kind of a
parameter is that of its current value), in the invariant format
Display writes. Composite values may be wrapped in
parentheses and separate their numbers with commas or spaces. An
image is never parsed: an effect string cannot name one.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherCloneDebugStructuralPartialEqPartialEqDisplayFrom<bool>From<i32>From<f64>From<Color>From<Point>From<Vector>From<Size>From<Rect>From<&str>From<String>From<Arc<str>>From<EffectImage>From<&EffectImage>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.