[−][src]Struct rltk::RGB
Represents an R/G/B triplet, in the range 0..1 (32-bit float)
Fields
r: f32
g: f32
b: f32
Methods
impl RGB
[src]
pub fn new() -> RGB
[src]
Constructs a new, zeroed (black) RGB triplet.
pub fn from_f32(r: f32, g: f32, b: f32) -> RGB
[src]
Constructs a new RGB color, from 3 32-bit floats in the range 0..1
pub fn from_u8(r: u8, g: u8, b: u8) -> RGB
[src]
Constructs a new RGB color, from 3 bytes in the range 0..255
pub fn named(col: (u8, u8, u8)) -> RGB
[src]
Construct an RGB color from a tuple of u8, or a named constant
pub fn from_hex<S: AsRef<str>>(code: S) -> Result<RGB, HtmlColorConversionError>
[src]
Constructs from an HTML color code (e.g. "#eeffee")
pub fn from_xp(col: XpColor) -> RGB
[src]
Converts an xp file color component to an RGB
pub fn to_xp(&self) -> XpColor
[src]
Converts an RGB to an xp file color component
pub fn to_hsv(&self) -> HSV
[src]
Converts an RGB triple to an HSV triple.
pub fn to_greyscale(&self) -> RGB
[src]
Applies a quick grayscale conversion to the color
pub fn desaturate(&self) -> RGB
[src]
Applies a lengthier desaturate (via HSV) to the color
pub fn lerp(&self, color: RGB, percent: f32) -> RGB
[src]
Lerps by a specified percentage (from 0 to 1) between this color and another
Trait Implementations
impl Clone for RGB
[src]
impl Copy for RGB
[src]
impl Default for RGB
[src]
impl PartialEq<RGB> for RGB
[src]
impl Debug for RGB
[src]
impl Sub<f32> for RGB
[src]
Support subtracting a float from a color. The result is clamped via the constructor.
type Output = RGB
The resulting type after applying the -
operator.
fn sub(self, rhs: f32) -> RGB
[src]
impl Sub<RGB> for RGB
[src]
Support subtracting an RGB from a color. The result is clamped via the constructor.
type Output = RGB
The resulting type after applying the -
operator.
fn sub(self, rhs: RGB) -> RGB
[src]
impl Add<f32> for RGB
[src]
Support adding a float to a color. The result is clamped via the constructor.
type Output = RGB
The resulting type after applying the +
operator.
fn add(self, rhs: f32) -> RGB
[src]
impl Add<RGB> for RGB
[src]
Support adding an RGB to a color. The result is clamped via the constructor.
type Output = RGB
The resulting type after applying the +
operator.
fn add(self, rhs: RGB) -> RGB
[src]
impl Mul<f32> for RGB
[src]
Support multiplying a color by a float. The result is clamped via the constructor.
type Output = RGB
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> RGB
[src]
impl Mul<RGB> for RGB
[src]
Support multiplying a color by another color. The result is clamped via the constructor.
type Output = RGB
The resulting type after applying the *
operator.
fn mul(self, rhs: RGB) -> RGB
[src]
impl StructuralPartialEq for RGB
[src]
Auto Trait Implementations
impl Send for RGB
impl Sync for RGB
impl Unpin for RGB
impl UnwindSafe for RGB
impl RefUnwindSafe for RGB
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,