#[repr(C)]pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}Expand description
RGBA color with 32-bit floating point components
Fields§
§r: f32§g: f32§b: f32§a: f32Implementations§
Source§impl Color
impl Color
pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn rgb(r: f32, g: f32, b: f32) -> Self
pub fn from_rgba_bytes(r: u8, g: u8, b: u8, a: u8) -> Self
pub fn from_rgb_bytes(r: u8, g: u8, b: u8) -> Self
Sourcepub fn from_imgui_u32(abgr: u32) -> Self
pub fn from_imgui_u32(abgr: u32) -> Self
Construct from an ImGui-packed color (ImU32 ABGR order).
ImGui packs colors with IM_COL32(R,G,B,A) into (A<<24)|(B<<16)|(G<<8)|R.
This converts that ABGR-packed u32 into an RGBA float Color.
Sourcepub fn from_rgb_u32(rgb: u32) -> Self
pub fn from_rgb_u32(rgb: u32) -> Self
Construct from an opaque 24-bit RGB value (0xRRGGBB).
Sourcepub fn to_imgui_u32(self) -> u32
pub fn to_imgui_u32(self) -> u32
Pack to ImGui ImU32 ABGR order (A<<24)|(B<<16)|(G<<8)|R.
pub fn to_array(self) -> [f32; 4]
pub fn from_array(arr: [f32; 4]) -> Self
pub fn with_alpha(self, alpha: f32) -> Self
pub fn lerp(self, other: Self, t: f32) -> Self
pub fn to_hsv(self) -> (f32, f32, f32)
pub fn from_hsv(h: f32, s: f32, v: f32) -> Self
Trait Implementations§
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
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