pub trait ColorDescriptor: Sized + Copy + Default {
    fn component_type() -> ColorComponentType;
    fn layout() -> ColorLayoutFormat;
}
Expand description

A trait to describe size and layout of color components.

Example

// This is an example for how to implement ColorDescriptor for a simple type.
use storm::color::*;

#[repr(C)]
#[derive(Copy, Clone)]
pub struct BGRA8 {
    pub b: u8,
    pub r: u8,
    pub g: u8,
    pub a: u8,
}

// This allows for bytes to represent single channel resources.
impl ColorDescriptor for BGRA8 {
    fn component_type() -> ColorComponentType {
        ColorComponentType::U8
    }
    fn layout() -> ColorLayoutFormat {
        ColorLayoutFormat::BGRA
    }
}

Required Methods

Gets the component type of the color.

Gets the layout of the color.

Implementations on Foreign Types

Implementors