pub struct ColorOps;Expand description
Zero-sized type that hosts color utility functions.
All methods are static (no self receiver) and are used by the
#[goud_api] proc-macro to auto-generate #[no_mangle] extern "C"
FFI wrappers.
Implementations§
Source§impl ColorOps
impl ColorOps
Sourcepub fn transparent() -> FfiColor
pub fn transparent() -> FfiColor
Returns the transparent color constant.
Sourcepub fn rgb(r: f32, g: f32, b: f32) -> FfiColor
pub fn rgb(r: f32, g: f32, b: f32) -> FfiColor
Creates a color from RGB components with alpha = 1.0.
Sourcepub fn from_u8(r: u8, g: u8, b: u8, a: u8) -> FfiColor
pub fn from_u8(r: u8, g: u8, b: u8, a: u8) -> FfiColor
Creates a color from 8-bit RGBA values (0-255).
Sourcepub fn from_hex(hex: u32) -> FfiColor
pub fn from_hex(hex: u32) -> FfiColor
Creates a color from a hex value (0xRRGGBB or 0xRRGGBBAA).
Sourcepub fn lerp(from: FfiColor, to: FfiColor, t: f32) -> FfiColor
pub fn lerp(from: FfiColor, to: FfiColor, t: f32) -> FfiColor
Linearly interpolates between two colors.
Sourcepub fn with_alpha(color: FfiColor, alpha: f32) -> FfiColor
pub fn with_alpha(color: FfiColor, alpha: f32) -> FfiColor
Returns a new color with the specified alpha.
Auto Trait Implementations§
impl Freeze for ColorOps
impl RefUnwindSafe for ColorOps
impl Send for ColorOps
impl Sync for ColorOps
impl Unpin for ColorOps
impl UnsafeUnpin for ColorOps
impl UnwindSafe for ColorOps
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more