pub trait ColorFmt:
ColorFmt
+ Debug
+ Copy
+ Hash
+ Eq
+ Ord
+ Display
+ Sized {
type Raw: Copy + Hash + Eq + Ord + Default + Debug + Display + Send + Sync + Sized;
type Component: Copy + Hash + Eq + Ord + Default + Debug + Display + Send + Sync + Sized;
const RGB_BIT_WIDTH: u8;
const ALPHA_BIT_WIDTH: u8;
// Required methods
fn decode(
&self,
) -> (Self::Component, Self::Component, Self::Component, Self::Component);
fn encode(
red: Self::Component,
green: Self::Component,
blue: Self::Component,
alpha: Self::Component,
) -> Self;
fn invert_alpha(&mut self);
}Expand description
Common interface for all suitable color formats within libplum.
This trait is sealed, so that it cannot be implemented on types other than those provided by this crate. It is provided as a convenience, for applications that wish to handle images of various formats.
Required Associated Constants§
Sourceconst RGB_BIT_WIDTH: u8
const RGB_BIT_WIDTH: u8
Number of bits allocated to red, green, and blue channels.
Sourceconst ALPHA_BIT_WIDTH: u8
const ALPHA_BIT_WIDTH: u8
Number of bits allocated to the alpha channel.
Required Associated Types§
Required Methods§
Sourcefn decode(
&self,
) -> (Self::Component, Self::Component, Self::Component, Self::Component)
fn decode( &self, ) -> (Self::Component, Self::Component, Self::Component, Self::Component)
Breaks self down into its individual components.
Sourcefn encode(
red: Self::Component,
green: Self::Component,
blue: Self::Component,
alpha: Self::Component,
) -> Self
fn encode( red: Self::Component, green: Self::Component, blue: Self::Component, alpha: Self::Component, ) -> Self
Gathers individual components into Self.
Sourcefn invert_alpha(&mut self)
fn invert_alpha(&mut self)
Inverts the alpha channel.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.