pub struct Colour { /* private fields */ }Expand description
A struct containing RGBA Colours (spelled properly) with some predefind colour consts
Implementations§
Source§impl Colour
impl Colour
pub const WHITE: Self
pub const BLACK: Self
pub const RED: Self
pub const GREEN: Self
pub const BLUE: Self
pub const YELLOW: Self
pub const ORANGE: Self
pub const PINK: Self
pub const BROWN: Self
Sourcepub fn from_hex(hex_str: &str) -> Result<Self, ParseIntError>
pub fn from_hex(hex_str: &str) -> Result<Self, ParseIntError>
Takes a hex string like #805E4E and turns into a colour. Can fail if an
invaild string is provided
Sourcepub fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self
pub fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self
Creates a colour from seperate values beteen 0.0 and 255.0 and an alpha value of 0 to 1.
Sourcepub fn linear_interpolation(start: Colour, end: Colour, fraction: f32) -> Self
pub fn linear_interpolation(start: Colour, end: Colour, fraction: f32) -> Self
Interpolates between two colours by the specified fraction which should be between 1.0 and 0.0
Trait Implementations§
Source§impl CreateFrom for Colourwhere
Self: ShaderType<ExtraMetadata = StructMetadata<4usize>>,
for<'__, '__, '__, '__> f32: CreateFrom,
impl CreateFrom for Colourwhere
Self: ShaderType<ExtraMetadata = StructMetadata<4usize>>,
for<'__, '__, '__, '__> f32: CreateFrom,
fn create_from<B: BufferRef>(reader: &mut Reader<B>) -> Self
Source§impl ReadFrom for Colourwhere
Self: ShaderType<ExtraMetadata = StructMetadata<4usize>>,
for<'__, '__, '__, '__> f32: ReadFrom,
impl ReadFrom for Colourwhere
Self: ShaderType<ExtraMetadata = StructMetadata<4usize>>,
for<'__, '__, '__, '__> f32: ReadFrom,
Source§impl ShaderSize for Colourwhere
f32: ShaderSize,
impl ShaderSize for Colourwhere
f32: ShaderSize,
Source§const SHADER_SIZE: NonZero<u64> = _
const SHADER_SIZE: NonZero<u64> = _
Represents WGSL Size (equivalent to
ShaderType::min_size)Source§impl ShaderType for Colour
impl ShaderType for Colour
Source§fn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Returns the size of
Self at runtime Read moreSource§fn assert_uniform_compat()
fn assert_uniform_compat()
Asserts that
Self meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints Read moreSource§impl WriteInto for Colourwhere
Self: ShaderType<ExtraMetadata = StructMetadata<4usize>>,
for<'__, '__, '__, '__> f32: WriteInto,
impl WriteInto for Colourwhere
Self: ShaderType<ExtraMetadata = StructMetadata<4usize>>,
for<'__, '__, '__, '__> f32: WriteInto,
fn write_into<B: BufferMut>(&self, writer: &mut Writer<B>)
impl Copy for Colour
impl StructuralPartialEq for Colour
Auto Trait Implementations§
impl Freeze for Colour
impl RefUnwindSafe for Colour
impl Send for Colour
impl Sync for Colour
impl Unpin for Colour
impl UnwindSafe for Colour
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn 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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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.Source§fn as_any(&self) -> &(dyn Any + 'static)
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.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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