Skip to main content

ColorToPacked

Trait ColorToPacked 

Source
pub trait ColorToPacked {
    // Required methods
    fn to_u8_array(self) -> [u8; 4];
    fn to_u8_array_no_alpha(self) -> [u8; 3];
    fn from_u8_array(color: [u8; 4]) -> Self;
    fn from_u8_array_no_alpha(color: [u8; 3]) -> Self;
}
Expand description

Trait with methods for converting colors to packed non-color types

Required Methods§

Source

fn to_u8_array(self) -> [u8; 4]

Convert to [u8; 4] where that makes sense (Srgba is most relevant)

Source

fn to_u8_array_no_alpha(self) -> [u8; 3]

Convert to [u8; 3] where that makes sense (Srgba is most relevant)

Source

fn from_u8_array(color: [u8; 4]) -> Self

Convert from [u8; 4] where that makes sense (Srgba is most relevant)

Source

fn from_u8_array_no_alpha(color: [u8; 3]) -> Self

Convert to [u8; 3] where that makes sense (Srgba is most relevant)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§