Struct ori_graphics::Color

source ·
#[repr(C)]
pub struct Color { pub r: f32, pub g: f32, pub b: f32, pub a: f32, }

Fields§

§r: f32§g: f32§b: f32§a: f32

Implementations§

source§

impl Color

source

pub const TRANSPARENT: Self = _

source

pub const BLACK: Self = _

source

pub const WHITE: Self = _

source

pub const RED: Self = _

source

pub const GREEN: Self = _

source

pub const BLUE: Self = _

source

pub const YELLOW: Self = _

source

pub const CYAN: Self = _

source

pub const MAGENTA: Self = _

source

pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self

source

pub const fn rgb(r: f32, g: f32, b: f32) -> Self

source

pub fn rgba8(r: u8, g: u8, b: u8, a: u8) -> Self

source

pub fn rgb8(r: u8, g: u8, b: u8) -> Self

source

pub fn try_hex(hex: &str) -> Option<Self>

source

pub fn hex(hex: &str) -> Self

source

pub fn to_hex(self) -> String

source

pub fn is_translucent(self) -> bool

source

pub fn to_linear(self) -> [f32; 4]

Trait Implementations§

source§

impl Add<Color> for Color

§

type Output = Color

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<Color> for Color

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl Clone for Color

source§

fn clone(&self) -> Color

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Color

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Color

source§

fn default() -> Color

Returns the “default value” for a type. Read more
source§

impl Display for Color

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<[f32; 4]> for Color

source§

fn from([r, g, b, a]: [f32; 4]) -> Self

Converts to this type from the input type.
source§

impl Into<[f32; 4]> for Color

source§

fn into(self) -> [f32; 4]

Converts this type into the (usually inferred) input type.
source§

impl Mul<Color> for Color

§

type Output = Color

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f32> for Color

§

type Output = Color

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl PartialEq<Color> for Color

source§

fn eq(&self, other: &Color) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Zeroable for Color

source§

fn zeroed() -> Self

source§

impl Copy for Color

source§

impl Pod for Color

source§

impl StructuralPartialEq for Color

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,