pub struct Hsva {
pub h: f32,
pub s: f32,
pub v: f32,
pub a: f32,
}
Expand description
Hue, saturation, value, alpha. All in the range [0, 1]. No premultiplied alpha.
Fields§
§h: f32
hue 0-1
s: f32
saturation 0-1
v: f32
value 0-1
a: f32
alpha 0-1. A negative value signifies an additive color (and alpha is ignored).
Implementations§
source§impl Hsva
impl Hsva
pub fn new(h: f32, s: f32, v: f32, a: f32) -> Self
sourcepub fn from_srgba_premultiplied([r, g, b, a]: [u8; 4]) -> Self
pub fn from_srgba_premultiplied([r, g, b, a]: [u8; 4]) -> Self
From sRGBA
with premultiplied alpha
sourcepub fn from_srgba_unmultiplied([r, g, b, a]: [u8; 4]) -> Self
pub fn from_srgba_unmultiplied([r, g, b, a]: [u8; 4]) -> Self
From sRGBA
without premultiplied alpha
sourcepub fn from_rgba_premultiplied(r: f32, g: f32, b: f32, a: f32) -> Self
pub fn from_rgba_premultiplied(r: f32, g: f32, b: f32, a: f32) -> Self
From linear RGBA with premultiplied alpha
sourcepub fn from_rgba_unmultiplied(r: f32, g: f32, b: f32, a: f32) -> Self
pub fn from_rgba_unmultiplied(r: f32, g: f32, b: f32, a: f32) -> Self
From linear RGBA without premultiplied alpha
pub fn from_additive_rgb(rgb: [f32; 3]) -> Self
pub fn from_additive_srgb([r, g, b]: [u8; 3]) -> Self
pub fn from_rgb(rgb: [f32; 3]) -> Self
pub fn from_srgb([r, g, b]: [u8; 3]) -> Self
pub fn to_opaque(self) -> Self
pub fn to_rgb(&self) -> [f32; 3]
pub fn to_srgb(&self) -> [u8; 3]
pub fn to_rgba_premultiplied(&self) -> [f32; 4]
sourcepub fn to_rgba_unmultiplied(&self) -> [f32; 4]
pub fn to_rgba_unmultiplied(&self) -> [f32; 4]
To linear space rgba in 0-1 range.
Represents additive colors using a negative alpha.
pub fn to_srgba_premultiplied(&self) -> [u8; 4]
sourcepub fn to_srgba_unmultiplied(&self) -> [u8; 4]
pub fn to_srgba_unmultiplied(&self) -> [u8; 4]
To gamma-space 0-255.
Trait Implementations§
impl Copy for Hsva
impl StructuralPartialEq for Hsva
Auto Trait Implementations§
impl Freeze for Hsva
impl RefUnwindSafe for Hsva
impl Send for Hsva
impl Sync for Hsva
impl Unpin for Hsva
impl UnwindSafe for Hsva
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)