Skip to main content

EffectSpec

Struct EffectSpec 

Source
pub struct EffectSpec {
Show 13 fields pub id: u32, pub flags: u32, pub length_mask: u32, pub backdrop_radius_param: Option<u8>, pub bleed_param: Option<u8>, pub animated: bool, pub animated_param: Option<u8>, pub pointer_param: Option<u8>, pub pointer_times_param: Option<u8>, pub clock_mask: u32, pub clock_window: f32, pub params: [f32; 32], pub textures: [Option<EffectTextureParam>; 4],
}
Expand description

The --shading value that came out of the cascade, carried on crate::Style and painted by crate::Style::paint.

The params are the effect’s positional CSS arguments, already converted to floats (a colour occupies four consecutive slots), plus the slots the host fills at paint time. Everything else is schema metadata the painter needs and gpui must not have to look up: which params are lengths (so they scale with the device factor), which one drives the backdrop blur, which one dilates the quad, and which ones the host writes.

Fields§

§id: u32

One of effect_id.

§flags: u32§length_mask: u32

Bit i set means params[i] is a length in LOGICAL pixels, to be multiplied by the device scale factor at paint time.

§backdrop_radius_param: Option<u8>

Some(i): params[i] (a logical-pixel length) is the backdrop blur radius. Only meaningful with EFFECT_FLAG_NEEDS_BACKDROP.

§bleed_param: Option<u8>

Some(i): params[i] (a logical-pixel length) dilates the painted quad, giving an outer glow somewhere to land.

§animated: bool

Whether this effect’s output depends on time, i.e. whether the window must keep repainting for it to animate.

§animated_param: Option<u8>

Some(i): params[i] is a speed time is multiplied by, which the painter integrates per element so a change of it does not jump.

§pointer_param: Option<u8>

Some(i): the painter writes the pointer’s position in the element’s 0..1 box units into params[i..i + 2].

§pointer_times_param: Option<u8>

Some(i): the painter writes the pointer’s last move, entry into the window and exit from it, on the effect clock, into params[i..i + 3].

§clock_mask: u32

Bit i set means params[i] is a time on the effect clock; the element keeps repainting until clock_window seconds after the latest.

§clock_window: f32

Seconds an effect keeps repainting after the times in clock_mask.

§params: [f32; 32]

The positional parameters, in schema order.

§textures: [Option<EffectTextureParam>; 4]

The SkTexture parameters by binding: None past the ones the effect declares.

Implementations§

Source§

impl EffectSpec

Source

pub const NONE: EffectSpec

--shading: none — a value that clears an effect inherited from an earlier rule in the cascade.

Source

pub fn is_some(&self) -> bool

Whether this spec actually paints anything.

Source

pub fn interpolates_with(&self, other: &EffectSpec) -> bool

Whether a transition can interpolate from self to other slot by slot: the same effect sampling the same images. Otherwise it cross-fades, since an image does not interpolate.

Source

pub fn follows_pointer(&self) -> bool

Whether the painter fills a pointer parameter, so the element repaints when the pointer moves.

Source

pub fn clock_running(&self, now: f32) -> bool

Whether now (effect-clock seconds) is within clock_window of the latest time in a clock_mask slot.

Source

pub fn bleed(&self) -> f32

The quad dilation in logical pixels.

Source

pub fn backdrop_blur_radius(&self) -> f32

The backdrop blur radius in logical pixels.

Trait Implementations§

Source§

impl Clone for EffectSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EffectSpec

Source§

impl Debug for EffectSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EffectSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for EffectSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for EffectSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EffectSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more