You are viewing contents of an older version. Switch to the latest released version.

Type Alias slint_interpreter::Rgba8Pixel

pub type Rgba8Pixel = RGBA<u8>;
Expand description

Convenience alias for a pixel with four color channels (red, green, blue and alpha), each encoded as u8.

Aliased Type§

struct Rgba8Pixel {
    pub r: u8,
    pub g: u8,
    pub b: u8,
    pub a: u8,
}

Fields§

§r: u8

Red

§g: u8

Green

§b: u8

Blue

§a: u8

Alpha

Implementations

source§

impl<T> RGBA<T>
where T: Clone,

source

pub fn iter(&self) -> Cloned<Iter<'_, T>>

Iterate over all components (length=4)

source§

impl<T> RGBA<T>

source

pub const fn new(r: T, g: T, b: T, a: T) -> RGBA<T>

Convenience function for creating a new pixel The order of arguments is R,G,B,A

source§

impl<T, A> RGBA<T, A>

source

pub const fn new_alpha(r: T, g: T, b: T, a: A) -> RGBA<T, A>

Convenience function for creating a new pixel The order of arguments is R,G,B,A

source§

impl<T, A> RGBA<T, A>

source

pub fn rgb_mut(&mut self) -> &mut RGB<T>

Provide a mutable view of only RGB components (leaving out alpha). Useful to change color without changing opacity.

source§

impl<T, A> RGBA<T, A>
where T: Clone,

source

pub fn rgb(&self) -> RGB<T>

Copy RGB components out of the RGBA struct

Note: you can use .into() to convert between other types

source§

impl<T, A> RGBA<T, A>
where T: Clone,

source

pub fn bgr(&self) -> BGR<T>

Copy RGB components out of the RGBA struct

Note: you can use .into() to convert between other types

source§

impl<T, A> RGBA<T, A>
where T: Copy, A: Clone,

source

pub fn map_rgb<F, U, B>(&self, f: F) -> RGBA<U, B>
where F: FnMut(T) -> U, U: Clone, B: From<A> + Clone,

Create new RGBA with the same alpha value, but different RGB values

source

pub fn alpha(&self, a: A) -> RGBA<T, A>

Create a new RGBA with the new alpha value, but same RGB values

source

pub fn map_alpha<F, B>(&self, f: F) -> RGBA<T, B>
where F: FnOnce(A) -> B,

Create a new RGBA with a new alpha value created by the callback. Allows changing of the type used for the alpha channel.

Trait Implementations

source§

impl<T> Add<T> for RGBA<T>
where T: Copy + Add<Output = T>,

px + 1

§

type Output = RGBA<T>

The resulting type after applying the + operator.
source§

fn add(self, r: T) -> <RGBA<T> as Add<T>>::Output

Performs the + operation. Read more
source§

impl<T, A> Add for RGBA<T, A>
where T: Add, A: Add,

px + px

§

type Output = RGBA<<T as Add>::Output, <A as Add>::Output>

The resulting type after applying the + operator.
source§

fn add(self, other: RGBA<T, A>) -> <RGBA<T, A> as Add>::Output

Performs the + operation. Read more
source§

impl<T> AddAssign<T> for RGBA<T>
where T: Copy + Add<Output = T>,

px + 1

source§

fn add_assign(&mut self, r: T)

Performs the += operation. Read more
source§

impl<T, A> AddAssign for RGBA<T, A>
where T: Add<Output = T> + Copy, A: Add<Output = A> + Copy,

px + px

source§

fn add_assign(&mut self, other: RGBA<T, A>)

Performs the += operation. Read more
source§

impl<T> AsMut<[T]> for RGBA<T>

source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T> AsRef<[T]> for RGBA<T>

source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<ComponentType, AlphaComponentType> Clone for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Clone, AlphaComponentType: Clone,

source§

fn clone(&self) -> RGBA<ComponentType, AlphaComponentType>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T, A, B> ColorComponentMap<RGBA<B, A>, T, B> for RGBA<T, A>
where T: Copy, A: Copy,

source§

fn map_c<F>(&self, f: F) -> RGBA<B, A>
where F: FnMut(T) -> B,

Convenience function for applying the same formula to every rgb/gray component, but skipping the alpha component. Read more
source§

impl<T, B> ComponentMap<RGBA<B>, T, B> for RGBA<T>
where T: Copy,

source§

fn map<F>(&self, f: F) -> RGBA<B>
where F: FnMut(T) -> B,

Convenience function (equivalent of self.iter().map().collect()) for applying the same formula to every component. Read more
source§

impl<T> ComponentSlice<T> for RGBA<T>

source§

fn as_slice(&self) -> &[T]

The components interpreted as an array, e.g. one RGB expands to 3 elements. Read more
source§

fn as_mut_slice(&mut self) -> &mut [T]

The components interpreted as a mutable array, e.g. one RGB expands to 3 elements. Read more
source§

impl<ComponentType, AlphaComponentType> Debug for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Debug, AlphaComponentType: Debug,

source§

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

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

impl<ComponentType, AlphaComponentType> Default for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Default, AlphaComponentType: Default,

source§

fn default() -> RGBA<ComponentType, AlphaComponentType>

Returns the “default value” for a type. Read more
source§

impl<T, A> Display for RGBA<T, A>
where T: Display, A: Display,

source§

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

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

impl<T> Div<T> for RGBA<T>
where T: Copy + Div<Output = T>,

px / 1

§

type Output = RGBA<T>

The resulting type after applying the / operator.
source§

fn div(self, r: T) -> <RGBA<T> as Div<T>>::Output

Performs the / operation. Read more
source§

impl<T> DivAssign<T> for RGBA<T>
where T: Copy + Div<Output = T>,

px * 1

source§

fn div_assign(&mut self, r: T)

Performs the /= operation. Read more
source§

impl<T> From<[T; 4]> for RGBA<T>
where T: Copy,

source§

fn from(other: [T; 4]) -> RGBA<T>

Converts to this type from the input type.
source§

impl<T, A> From<(T, T, T, A)> for RGBA<T, A>

source§

fn from(other: (T, T, T, A)) -> RGBA<T, A>

Converts to this type from the input type.
source§

impl<T> From<BGR<T>> for RGBA<T, u8>
where T: Copy,

Assumes 255 is opaque

source§

fn from(other: BGR<T>) -> RGBA<T, u8>

Converts to this type from the input type.
source§

impl<T> From<BGRA<T>> for RGBA<T>
where T: Clone,

source§

fn from(other: BGRA<T>) -> RGBA<T>

Converts to this type from the input type.
source§

impl<T> From<Gray<T>> for RGBA<T, u8>
where T: Clone,

source§

fn from(other: Gray<T>) -> RGBA<T, u8>

Converts to this type from the input type.
source§

impl<T, A> From<GrayAlpha<T, A>> for RGBA<T, A>
where T: Clone,

source§

fn from(other: GrayAlpha<T, A>) -> RGBA<T, A>

Converts to this type from the input type.
source§

impl<T> From<RGB<T>> for RGBA<T, u8>
where T: Copy,

Assumes 255 is opaque

source§

fn from(other: RGB<T>) -> RGBA<T, u8>

Converts to this type from the input type.
source§

impl<T> FromIterator<T> for RGBA<T>

source§

fn from_iter<I>(into_iter: I) -> RGBA<T>
where I: IntoIterator<Item = T>,

Takes exactly 4 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.

source§

impl<ComponentType, AlphaComponentType> Hash for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Hash, AlphaComponentType: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> Into<[T; 4]> for RGBA<T>

source§

fn into(self) -> [T; 4]

Converts this type into the (usually inferred) input type.
source§

impl<T, A> Into<(T, T, T, A)> for RGBA<T, A>

source§

fn into(self) -> (T, T, T, A)

Converts this type into the (usually inferred) input type.
source§

impl<T> Mul<T> for RGBA<T>
where T: Copy + Mul<Output = T>,

px * 1

§

type Output = RGBA<T>

The resulting type after applying the * operator.
source§

fn mul(self, r: T) -> <RGBA<T> as Mul<T>>::Output

Performs the * operation. Read more
source§

impl<T> MulAssign<T> for RGBA<T>
where T: Copy + Mul<Output = T>,

px * 1

source§

fn mul_assign(&mut self, r: T)

Performs the *= operation. Read more
source§

impl<ComponentType, AlphaComponentType> Ord for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Ord, AlphaComponentType: Ord,

source§

fn cmp(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<ComponentType, AlphaComponentType> PartialEq for RGBA<ComponentType, AlphaComponentType>
where ComponentType: PartialEq, AlphaComponentType: PartialEq,

source§

fn eq(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<ComponentType, AlphaComponentType> PartialOrd for RGBA<ComponentType, AlphaComponentType>
where ComponentType: PartialOrd, AlphaComponentType: PartialOrd,

source§

fn partial_cmp( &self, other: &RGBA<ComponentType, AlphaComponentType> ) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Sub<T> for RGBA<T>
where T: Copy + Sub<Output = T>,

px - 1

§

type Output = RGBA<<T as Sub>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, r: T) -> <RGBA<T> as Sub<T>>::Output

Performs the - operation. Read more
source§

impl<T, A> Sub for RGBA<T, A>
where T: Sub, A: Sub,

px - px

§

type Output = RGBA<<T as Sub>::Output, <A as Sub>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, other: RGBA<T, A>) -> <RGBA<T, A> as Sub>::Output

Performs the - operation. Read more
source§

impl<T> SubAssign<T> for RGBA<T>
where T: Copy + Sub<Output = T>,

px - 1

source§

fn sub_assign(&mut self, r: T)

Performs the -= operation. Read more
source§

impl<T, A> SubAssign for RGBA<T, A>
where T: Sub<Output = T> + Copy, A: Sub<Output = A> + Copy,

px - px

source§

fn sub_assign(&mut self, other: RGBA<T, A>)

Performs the -= operation. Read more
source§

impl<T, A> Sum for RGBA<T, A>
where T: Default + Add<Output = T>, A: Default + Add<Output = A>,

source§

fn sum<I>(iter: I) -> RGBA<T, A>
where I: Iterator<Item = RGBA<T, A>>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<T, A> Zeroable for RGBA<T, A>
where T: Zeroable, A: Zeroable,

§

fn zeroed() -> Self

source§

impl<ComponentType, AlphaComponentType> Copy for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Copy, AlphaComponentType: Copy,

source§

impl<ComponentType, AlphaComponentType> Eq for RGBA<ComponentType, AlphaComponentType>
where ComponentType: Eq, AlphaComponentType: Eq,

source§

impl<T, A> Pod for RGBA<T, A>
where T: Pod, A: Pod,

source§

impl<ComponentType, AlphaComponentType> StructuralPartialEq for RGBA<ComponentType, AlphaComponentType>