Struct let_engine::objects::Color

source ·
pub struct Color { /* private fields */ }

Implementations§

source§

impl Color

Declaration

source

pub const WHITE: Self = _

source

pub const BLACK: Self = _

source

pub const fn from_rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self

Makes a color from red, green, blue and alpha.

source

pub const fn from_rgb(red: f32, green: f32, blue: f32) -> Self

Makes a color from red, green and blue.

source

pub const fn from_rg(red: f32, green: f32) -> Self

Makes a color from red and green.

source

pub const fn from_rb(red: f32, blue: f32) -> Self

Makes a color from red and blue.

source

pub const fn from_r(red: f32) -> Self

Makes a color from red.

source

pub const fn from_gb(green: f32, blue: f32) -> Self

Makes a color from green and blue.

source

pub const fn from_g(green: f32) -> Self

Makes a color from green.

source

pub const fn from_b(blue: f32) -> Self

Makes a color from blue.

source§

impl Color

Usage

source

pub fn rgba(&self) -> [f32; 4]

Returns the red green blue and alpha of this color.

source

pub fn rgb(&self) -> [f32; 3]

Returns the red green and blue of this color.

source

pub fn r(&self) -> f32

Returns the red of this color.

source

pub fn g(&self) -> f32

Returns the green of this color.

source

pub fn b(&self) -> f32

Returns the blue of this color.

source

pub fn alpha(&self) -> f32

Returns the alpha or transparency of this color.

source

pub fn set_r(&mut self, red: f32)

Sets the red channel of this color.

source

pub fn set_g(&mut self, green: f32)

Sets the green channel of this color.

source

pub fn set_b(&mut self, blue: f32)

Sets the blue channel of this color.

source

pub fn set_a(&mut self, alpha: f32)

Sets the alpha channel of this color.

source

pub fn lerp(self, rhs: Self, s: f32) -> Self

Interpolates to the next color.

Trait Implementations§

source§

impl Add<f32> for Color

§

type Output = Color

The resulting type after applying the + operator.
source§

fn add(self, rhs: f32) -> Self::Output

Performs the + operation. Read more
source§

impl Add for Color

§

type Output = Color

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<f32> for Color

source§

fn add_assign(&mut self, rhs: f32)

Performs the += operation. Read more
source§

impl AddAssign for Color

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl Clone for Color

source§

fn clone(&self) -> Color

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 Debug for Color

source§

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

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

impl Div<f32> for Color

§

type Output = Color

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl Div for Color

§

type Output = Color

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<f32> for Color

source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
source§

impl DivAssign for Color

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl From<[f32; 3]> for Color

source§

fn from(value: [f32; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[f32; 4]> for Color

source§

fn from(value: [f32; 4]) -> Self

Converts to this type from the input type.
source§

impl From<Color> for [f32; 3]

source§

fn from(value: Color) -> [f32; 3]

Converts to this type from the input type.
source§

impl From<Color> for [f32; 4]

source§

fn from(value: Color) -> [f32; 4]

Converts to this type from the input type.
source§

impl From<Color> for Vec3

source§

fn from(value: Color) -> Vec3

Converts to this type from the input type.
source§

impl From<Color> for Vec4

source§

fn from(value: Color) -> Vec4

Converts to this type from the input type.
source§

impl From<Color> for f32

source§

fn from(value: Color) -> f32

Converts to this type from the input type.
source§

impl From<f32> for Color

source§

fn from(value: f32) -> Self

Converts to this type from the input type.
source§

impl Mul<f32> for Color

§

type Output = Color

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for Color

§

type Output = Color

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<f32> for Color

source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
source§

impl MulAssign for Color

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl PartialEq for Color

source§

fn eq(&self, other: &Color) -> 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 Sub<f32> for Color

§

type Output = Color

The resulting type after applying the - operator.
source§

fn sub(self, rhs: f32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Color

§

type Output = Color

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<f32> for Color

source§

fn sub_assign(&mut self, rhs: f32)

Performs the -= operation. Read more
source§

impl SubAssign for Color

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl Copy for Color

source§

impl StructuralPartialEq for Color

Auto Trait Implementations§

§

impl RefUnwindSafe for Color

§

impl Send for Color

§

impl Sync for Color

§

impl Unpin for Color

§

impl UnwindSafe for Color

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

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

§

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
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

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

§

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>,

§

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.
§

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

§

fn vzip(self) -> V

§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,