Enum bevy_render::color::Color
source · [−]pub enum Color {
Rgba {
red: f32,
green: f32,
blue: f32,
alpha: f32,
},
RgbaLinear {
red: f32,
green: f32,
blue: f32,
alpha: f32,
},
Hsla {
hue: f32,
saturation: f32,
lightness: f32,
alpha: f32,
},
}
Variants
Rgba
Fields
red: f32
Red component. [0.0, 1.0]
green: f32
Green component. [0.0, 1.0]
blue: f32
Blue component. [0.0, 1.0]
alpha: f32
Alpha component. [0.0, 1.0]
sRGBA color
RgbaLinear
Fields
red: f32
Red component. [0.0, 1.0]
green: f32
Green component. [0.0, 1.0]
blue: f32
Blue component. [0.0, 1.0]
alpha: f32
Alpha component. [0.0, 1.0]
RGBA color in the Linear sRGB colorspace (often colloquially referred to as “linear”, “RGB”, or “linear RGB”).
Hsla
Fields
hue: f32
Hue component. [0.0, 360.0]
saturation: f32
Saturation component. [0.0, 1.0]
lightness: f32
Lightness component. [0.0, 1.0]
alpha: f32
Alpha component. [0.0, 1.0]
HSL (hue, saturation, lightness) color with an alpha channel
Implementations
sourceimpl Color
impl Color
sourcepub const ALICE_BLUE: Color = _
pub const ALICE_BLUE: Color = _
sourcepub const ANTIQUE_WHITE: Color = _
pub const ANTIQUE_WHITE: Color = _
sourcepub const AQUAMARINE: Color = _
pub const AQUAMARINE: Color = _
sourcepub const DARK_GREEN: Color = _
pub const DARK_GREEN: Color = _
sourcepub const LIME_GREEN: Color = _
pub const LIME_GREEN: Color = _
sourcepub const MIDNIGHT_BLUE: Color = _
pub const MIDNIGHT_BLUE: Color = _
sourcepub const ORANGE_RED: Color = _
pub const ORANGE_RED: Color = _
sourcepub const YELLOW_GREEN: Color = _
pub const YELLOW_GREEN: Color = _
sourcepub const fn rgba_linear(r: f32, g: f32, b: f32, a: f32) -> Color
pub const fn rgba_linear(r: f32, g: f32, b: f32, a: f32) -> Color
New Color
from linear RGB colorspace.
sourcepub const fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
pub const fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
New Color
with HSL representation in sRGB colorspace.
sourcepub const fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
pub const fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
New Color
with HSL representation in sRGB colorspace.
sourcepub fn hex<T: AsRef<str>>(hex: T) -> Result<Color, HexColorError>
pub fn hex<T: AsRef<str>>(hex: T) -> Result<Color, HexColorError>
New Color
from sRGB colorspace.
sourcepub fn as_rgba_linear(self: &Color) -> Color
pub fn as_rgba_linear(self: &Color) -> Color
Converts a Color
to variant Color::RgbaLinear
sourcepub fn as_rgba_f32(self: Color) -> [f32; 4]
pub fn as_rgba_f32(self: Color) -> [f32; 4]
Converts a Color
to a [f32; 4]
from sRGB colorspace
sourcepub fn as_linear_rgba_f32(self: Color) -> [f32; 4]
pub fn as_linear_rgba_f32(self: Color) -> [f32; 4]
Converts a Color
to a [f32; 4]
from linear RGB colorspace
sourcepub fn as_rgba_u32(self: Color) -> u32
pub fn as_rgba_u32(self: Color) -> u32
Converts Color
to a u32
from sRGB colorspace.
Maps the RGBA channels in RGBA order to a little-endian byte array (GPUs are little-endian).
A
will be the most significant byte and R
the least significant.
sourcepub fn as_linear_rgba_u32(self: Color) -> u32
pub fn as_linear_rgba_u32(self: Color) -> u32
Converts Color to a u32 from linear RGB colorspace.
Maps the RGBA channels in RGBA order to a little-endian byte array (GPUs are little-endian).
A
will be the most significant byte and R
the least significant.
Trait Implementations
sourceimpl AddAssign<Color> for Color
impl AddAssign<Color> for Color
sourcefn add_assign(&mut self, rhs: Color)
fn add_assign(&mut self, rhs: Color)
Performs the +=
operation. Read more
sourceimpl AddAssign<Vec4> for Color
impl AddAssign<Vec4> for Color
sourcefn add_assign(&mut self, rhs: Vec4)
fn add_assign(&mut self, rhs: Vec4)
Performs the +=
operation. Read more
sourceimpl CreateFrom for Color
impl CreateFrom for Color
fn create_from<B>(reader: &mut Reader<B>) -> Self where
B: BufferRef,
sourceimpl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromReflect for Color
impl FromReflect for Color
sourcefn from_reflect(reflect: &dyn Reflect) -> Option<Self>
fn from_reflect(reflect: &dyn Reflect) -> Option<Self>
Constructs a concrete instance of Self
from a reflected value.
sourceimpl GetTypeRegistration for Color
impl GetTypeRegistration for Color
sourceimpl MulAssign<Vec3> for Color
impl MulAssign<Vec3> for Color
sourcefn mul_assign(&mut self, rhs: Vec3)
fn mul_assign(&mut self, rhs: Vec3)
Performs the *=
operation. Read more
sourceimpl MulAssign<Vec4> for Color
impl MulAssign<Vec4> for Color
sourcefn mul_assign(&mut self, rhs: Vec4)
fn mul_assign(&mut self, rhs: Vec4)
Performs the *=
operation. Read more
sourceimpl MulAssign<f32> for Color
impl MulAssign<f32> for Color
sourcefn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the *=
operation. Read more
sourceimpl Reflect for Color
impl Reflect for Color
sourcefn get_type_info(&self) -> &'static TypeInfo
fn get_type_info(&self) -> &'static TypeInfo
sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns the value as a &mut dyn Any
.
sourcefn as_reflect(&self) -> &dyn Reflect
fn as_reflect(&self) -> &dyn Reflect
Casts this type to a reflected value
sourcefn as_reflect_mut(&mut self) -> &mut dyn Reflect
fn as_reflect_mut(&mut self) -> &mut dyn Reflect
Casts this type to a mutable reflected value
sourcefn clone_value(&self) -> Box<dyn Reflect>
fn clone_value(&self) -> Box<dyn Reflect>
Clones the value as a Reflect
trait object. Read more
sourcefn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
Performs a type-checked assignment of a reflected value to this value. Read more
sourcefn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Returns an enumeration of “kinds” of type. Read more
sourcefn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Returns a mutable enumeration of “kinds” of type. Read more
sourcefn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
Returns a “partial equality” comparison result. Read more
sourcefn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type). Read more
sourcefn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Debug formatter for the value. Read more
sourcefn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
Returns a serializable version of the value. Read more
sourceimpl ShaderSize for Color
impl ShaderSize for Color
sourceconst SHADER_SIZE: NonZeroU64 =
const SHADER_SIZE: NonZeroU64 =
Represents WGSL Size (equivalent to ShaderType::min_size
)
sourceimpl ShaderType for Color
impl ShaderType for Color
sourcefn min_size() -> NonZeroU64
fn min_size() -> NonZeroU64
Represents the minimum size of Self
(equivalent to GPUBufferBindingLayout.minBindingSize) Read more
sourcefn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Returns the size of Self
at runtime Read more
sourcefn 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 more
impl Copy for Color
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn 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. Read more
sourcefn 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. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
sourcefn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using data from the given World
sourceimpl<T> GetPath for T where
T: Reflect,
impl<T> GetPath for T where
T: Reflect,
sourcefn path(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
fn path(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
Returns a reference to the value specified by path
. Read more
sourcefn path_mut(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn path_mut(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
Returns a mutable reference to the value specified by path
. Read more
sourcefn get_path<T>(&'r self, path: &'p str) -> Result<&'r T, ReflectPathError<'p>> where
T: Reflect,
fn get_path<T>(&'r self, path: &'p str) -> Result<&'r T, ReflectPathError<'p>> where
T: Reflect,
Returns a statically typed reference to the value specified by path
.
sourcefn get_path_mut<T>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>> where
T: Reflect,
fn get_path_mut<T>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>> where
T: Reflect,
Returns a statically typed mutable reference to the value specified by
path
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
sourceimpl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more