#[repr(C)]pub struct NiColor {
pub red: f32,
pub green: f32,
pub blue: f32,
}
Expand description
Represents an RGB color with f32
components for red, green, and blue.
§Example
let color = NiColor::new(0.5, 0.3, 0.8);
Fields§
§red: f32
Red component (range: 0.0..=1.0)
green: f32
Green component (range: 0.0..=1.0)
blue: f32
Blue component (range: 0.0..=1.0)
Implementations§
Source§impl NiColor
impl NiColor
Sourcepub const fn new(red: f32, green: f32, blue: f32) -> Self
pub const fn new(red: f32, green: f32, blue: f32) -> Self
Creates a new NiColor
with the specified RGB values.
§Example
let color = NiColor::new(0.5, 0.3, 0.8);
Sourcepub const fn from_hex(hex: u32) -> Self
pub const fn from_hex(hex: u32) -> Self
Creates a NiColor
from a 32-bit hex value in the format 0xRRGGBB
.
§Example
let color = NiColor::from_hex(0xFF5733);
Trait Implementations§
Source§impl AddAssign for NiColor
impl AddAssign for NiColor
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl DivAssign<f32> for NiColor
impl DivAssign<f32> for NiColor
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/=
operation. Read moreSource§impl MulAssign<f32> for NiColor
impl MulAssign<f32> for NiColor
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*=
operation. Read moreSource§impl SubAssign for NiColor
impl SubAssign for NiColor
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for NiColor
impl StructuralPartialEq for NiColor
Auto Trait Implementations§
impl Freeze for NiColor
impl RefUnwindSafe for NiColor
impl Send for NiColor
impl Sync for NiColor
impl Unpin for NiColor
impl UnwindSafe for NiColor
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