Struct termwiz::color::LinearRgba
source · [−]Expand description
A pixel value encoded as linear RGBA values in f32 format (range: 0.0-1.0)
Tuple Fields
0: f32
1: f32
2: f32
3: f32
Implementations
sourceimpl LinearRgba
impl LinearRgba
sourcepub fn with_srgba(red: u8, green: u8, blue: u8, alpha: u8) -> LinearRgba
pub fn with_srgba(red: u8, green: u8, blue: u8, alpha: u8) -> LinearRgba
Convert SRGBA u8 components to LinearRgba. Note that alpha in SRGBA colorspace is already linear, so this only applies gamma correction to RGB.
sourcepub fn with_rgba(red: u8, green: u8, blue: u8, alpha: u8) -> LinearRgba
pub fn with_rgba(red: u8, green: u8, blue: u8, alpha: u8) -> LinearRgba
Convert linear RGBA u8 components to LinearRgba (f32)
sourcepub const fn with_components(
red: f32,
green: f32,
blue: f32,
alpha: f32
) -> LinearRgba
pub const fn with_components(
red: f32,
green: f32,
blue: f32,
alpha: f32
) -> LinearRgba
Create using the provided f32 components in the range 0.0-1.0
pub const TRANSPARENT: LinearRgba = Self::with_components(0., 0., 0., 0.)
sourcepub fn is_fully_transparent(self) -> bool
pub fn is_fully_transparent(self) -> bool
Returns true if this color is fully transparent
sourcepub fn when_fully_transparent(self, other: LinearRgba) -> LinearRgba
pub fn when_fully_transparent(self, other: LinearRgba) -> LinearRgba
Returns self, except when self is transparent, in which case returns other
sourcepub fn mul_alpha(self, alpha: f32) -> LinearRgba
pub fn mul_alpha(self, alpha: f32) -> LinearRgba
Returns self multiplied by the supplied alpha value
sourcepub fn srgba_pixel(self) -> SrgbaPixel
pub fn srgba_pixel(self) -> SrgbaPixel
Convert to an SRGB u32 pixel
sourcepub fn tuple(self) -> (f32, f32, f32, f32)
pub fn tuple(self) -> (f32, f32, f32, f32)
Returns the individual RGBA channels as f32 components 0.0-1.0
pub fn to_srgb(self) -> SrgbaTuple
Trait Implementations
sourceimpl Clone for LinearRgba
impl Clone for LinearRgba
sourcefn clone(&self) -> LinearRgba
fn clone(&self) -> LinearRgba
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for LinearRgba
impl Debug for LinearRgba
sourceimpl Default for LinearRgba
impl Default for LinearRgba
sourcefn default() -> LinearRgba
fn default() -> LinearRgba
Returns the “default value” for a type. Read more
sourceimpl PartialEq<LinearRgba> for LinearRgba
impl PartialEq<LinearRgba> for LinearRgba
sourcefn eq(&self, other: &LinearRgba) -> bool
fn eq(&self, other: &LinearRgba) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &LinearRgba) -> bool
fn ne(&self, other: &LinearRgba) -> bool
This method tests for !=
.
impl Copy for LinearRgba
impl StructuralPartialEq for LinearRgba
Auto Trait Implementations
impl RefUnwindSafe for LinearRgba
impl Send for LinearRgba
impl Sync for LinearRgba
impl Unpin for LinearRgba
impl UnwindSafe for LinearRgba
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