Struct buffer_graphics_lib::color::Color
source · [−]Expand description
This represents an RGBA color and is used to store a pixel by Image
and PixelsWrapper
Fields
r: u8
g: u8
b: u8
a: u8
Implementations
sourceimpl Color
impl Color
sourcepub fn new(r: f32, g: f32, b: f32, a: f32) -> Self
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self
Converts 0.0..=1.0 to 0..=255 Values outside 0.0..=1.0 are clamped
pub const fn rgba(r: u8, g: u8, b: u8, a: u8) -> Self
sourcepub const fn gray(value: u8) -> Self
pub const fn gray(value: u8) -> Self
Create a new color with red
, green
and blue
set to value
and alpha
set to 255
sourcepub const fn from_i32(value: i32) -> Self
pub const fn from_i32(value: i32) -> Self
Convert an i32 into a Color
where bytes match the format [R,G,B,A]
sourcepub fn from_f32_array(array: [f32; 4]) -> Self
pub fn from_f32_array(array: [f32; 4]) -> Self
Convert f32 array in the format [R,G,B,A] to color where 0.0 = 0, and 1.0 = 255
Trait Implementations
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 From<Color> for TextFormat
impl From<Color> for TextFormat
impl Copy for Color
impl Eq for Color
impl StructuralEq 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_big_endian()
.sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_native_endian()
.