Skip to main content

Rgba32F

Struct Rgba32F 

Source
pub struct Rgba32F(/* private fields */);
Expand description

An RGBA color represented as 4 f32s.

Implementations§

Source§

impl Rgba32F

Source

pub const WHITE: Rgba32F

Full white (all channels maximum).

Source

pub const BLACK: Rgba32F

Full black (all channels zero, fully opaque).

Source

pub const RED: Rgba32F

Pure red.

Source

pub const GREEN: Rgba32F

Pure green.

Source

pub const BLUE: Rgba32F

Pure blue.

Source

pub const TRANSPARENT: Rgba32F

Fully transparent black.

Source

pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Self

Creates a new four-channel color from f32 red, green, blue, and alpha values.

Source

pub const fn r(&self) -> f32

Returns the red channel value.

Source

pub const fn g(&self) -> f32

Returns the green channel value.

Source

pub const fn b(&self) -> f32

Returns the blue channel value.

Source

pub const fn a(&self) -> f32

Returns the alpha channel value.

Source

pub const fn rgb(&self) -> Rgb32F

Returns only the RGB channels, discarding alpha.

Source

pub fn lerp(a: Self, b: Self, t: f32) -> Self

Linearly interpolates between two colors component-wise.

Trait Implementations§

Source§

impl Clone for Rgba32F

Source§

fn clone(&self) -> Rgba32F

Returns a duplicate 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 Debug for Rgba32F

Source§

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

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

impl FixedCode for Rgba32F

Source§

const SIZE: usize

Source§

type Array = [u8; 16]

Source§

type Error = Infallible

Source§

fn fix_encode(&self) -> Self::Array

Source§

fn fix_decode(input: &Self::Array) -> Result<Self, Self::Error>

Source§

fn fix_write(&self, write: &mut impl Write) -> Result<()>

Encodes self and writes the resulting bytes to write.
Source§

fn fix_read(read: &mut impl Read) -> Result<Self>

Reads exactly SIZE bytes from read and decodes them.
Source§

impl From<Rgba32F> for Vec4

Source§

fn from(value: Rgba32F) -> Self

Converts to this type from the input type.
Source§

impl From<Vec4> for Rgba32F

Source§

fn from(value: Vec4) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Rgba32F

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Rgba32F

Source§

impl StructuralPartialEq for Rgba32F

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<T> VarCode for T
where T: FixedCode,

Source§

fn var_bit_len(&self) -> usize

Source§

fn var_write(&self, write: &mut WriteBits<impl Write>) -> Result<(), Error>

Source§

fn var_read(read: &mut ReadBits<impl Read>) -> Result<T, Error>