[−][src]Trait pix::Format
Pixel format determines bit depth (Channel), color components, alpha mode, and gamma mode.
The naming scheme for type aliases goes:
S
for sRGB gamma colorspace; linear gamma if omitted.Gray
/GrayAlpha
/Mask
/Rgb
/Rgba
for Gray, Mask, and Rgb.8
/16
/32
for 8-bit integer, 16-bit integer, and 32-bit floating-point channels.p
for premultiplied alpha.
The following types are defined:
- Opaque, linear gamma: Gray8, Gray16, Gray32, Rgb8, Rgb16, Rgb32
- Opaque, sRGB gamma: SGray8, SGray16, SGray32, SRgb8, SRgb16, SRgb32
- Translucent (straight alpha), linear gamma: GrayAlpha8, GrayAlpha16, GrayAlpha32 Rgba8, Rgba16, Rgba32
- Translucent (premultiplied alpha), linear gamma: GrayAlpha8p, GrayAlpha16p, GrayAlpha32p Rgba8p, Rgba16p, Rgba32p
- Translucent (straight alpha), sRGB gamma: SGrayAlpha8, SGrayAlpha16, SGrayAlpha32 SRgba8, SRgba16, SRgba32
- Translucent (premultiplied alpha), sRGB gamma: SGrayAlpha8p, SGrayAlpha16p, SGrayAlpha32p SRgba8p, SRgba16p, SRgba32p
- Alpha mask: Mask8, Mask16, Mask32
Associated Types
Loading content...Required methods
fn rgba(self) -> [Self::Chan; 4]
Get red, green, blue and alpha Channel
s
fn with_rgba(rgba: [Self::Chan; 4]) -> Self
Make a pixel with given RGBA Channel
s
fn difference(self, rhs: Self) -> Self
Get channel-wise difference
fn within_threshold(self, rhs: Self) -> bool
Check if all Channel
s are within threshold
Provided methods
fn convert<C, F>(self) -> F where
F: Format<Chan = C>,
C: Channel + From<Self::Chan>,
F: Format<Chan = C>,
C: Channel + From<Self::Chan>,
Convert a pixel from one Format
to another
p
Source pixel to convert.
Implementors
impl<C, A> Format for Mask<A> where
C: Channel,
A: Alpha<Chan = C> + From<C>,
[src]
C: Channel,
A: Alpha<Chan = C> + From<C>,
type Chan = C
fn rgba(self) -> [Self::Chan; 4]
[src]
Get red, green, blue and alpha Channel
s
fn with_rgba(rgba: [Self::Chan; 4]) -> Self
[src]
Make a pixel with given RGBA Channel
s
fn difference(self, rhs: Self) -> Self
[src]
Get channel-wise difference
fn within_threshold(self, rhs: Self) -> bool
[src]
Check if all Channel
s are within threshold
impl<C, A, M, G: GammaMode> Format for Rgb<C, A, M, G> where
C: Channel,
A: Alpha<Chan = C> + From<C>,
M: AlphaMode,
[src]
C: Channel,
A: Alpha<Chan = C> + From<C>,
M: AlphaMode,
type Chan = C
fn rgba(self) -> [Self::Chan; 4]
[src]
Get red, green, blue and alpha Channel
s
fn with_rgba(rgba: [Self::Chan; 4]) -> Self
[src]
Make a pixel with given RGBA Channel
s
fn difference(self, rhs: Self) -> Self
[src]
Get channel-wise difference
fn within_threshold(self, rhs: Self) -> bool
[src]
Check if all Channel
s are within threshold
impl<C, A, M: AlphaMode, G: GammaMode> Format for Gray<C, A, M, G> where
C: Channel,
A: Alpha<Chan = C> + From<C>,
[src]
C: Channel,
A: Alpha<Chan = C> + From<C>,
type Chan = C
fn rgba(self) -> [Self::Chan; 4]
[src]
Get red, green, blue and alpha Channel
s
fn with_rgba(rgba: [Self::Chan; 4]) -> Self
[src]
Make a pixel with given RGBA Channel
s
fn difference(self, rhs: Self) -> Self
[src]
Get channel-wise difference
fn within_threshold(self, rhs: Self) -> bool
[src]
Check if all Channel
s are within threshold