add alpha component
parent
77bcbcd78d
commit
f39d0dbed8
|
@ -62,6 +62,7 @@ pub trait Color
|
|||
fn r(&self) -> Self::Output;
|
||||
fn g(&self) -> Self::Output;
|
||||
fn b(&self) -> Self::Output;
|
||||
fn a(&self) -> Self::Output;
|
||||
}
|
||||
|
||||
impl Image16
|
||||
|
@ -126,7 +127,7 @@ impl Color16
|
|||
{
|
||||
pub const fn new(r: u16, g: u16, b: u16) -> Color16
|
||||
{
|
||||
Color16(r, g, b)
|
||||
Color16(r, g, b, u16::max_value())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,13 +150,18 @@ impl Color for Color16
|
|||
{
|
||||
self.2
|
||||
}
|
||||
|
||||
fn a(&self) -> u16
|
||||
{
|
||||
self.3
|
||||
}
|
||||
}
|
||||
|
||||
impl Color8
|
||||
{
|
||||
pub const fn new(r: u8, g: u8, b: u8) -> Color8
|
||||
{
|
||||
Color8(r, g, b)
|
||||
Color8(r, g, b, u8::max_value())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,15 +184,20 @@ impl Color for Color8
|
|||
{
|
||||
self.2
|
||||
}
|
||||
|
||||
fn a(&self) -> u8
|
||||
{
|
||||
self.3
|
||||
}
|
||||
}
|
||||
|
||||
/// A RGB16 color.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Color16(u16, u16, u16);
|
||||
pub struct Color16(u16, u16, u16, u16);
|
||||
|
||||
/// A RGB8 color.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Color8(u8, u8, u8);
|
||||
pub struct Color8(u8, u8, u8, u8);
|
||||
|
||||
/// RGB16 image.
|
||||
pub struct Image16
|
||||
|
|
Loading…
Reference in New Issue