Struct rute::auto::pixel_format::PixelFormat
source · pub struct PixelFormat<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
In Qt there is a often a need to represent the layout of the pixels in a graphics buffer. Internally QPixelFormat stores everything in a 64 bit datastructure. This gives performance but also some limitations.
QPixelFormat can describe 5 color channels and 1 alpha channel, each can use 6 bits to describe the size of the color channel.
The position of the alpha channel is described with a separate enum. This is to make it possible to describe QImage formats like ARGB32, and also describe typical OpenGL formats like RBGA8888.
How pixels are suppose to be read is determined by the TypeInterpretation enum. It describes if color values are suppose to be read byte per byte, or if a pixel is suppose to be read as a complete int and then masked. See also: TypeInterpretation
There is no support for describing YUV’s macro pixels. Instead a list of YUV formats has been made. When a QPixelFormat is describing a YUV format, the bitsPerPixel value has been deduced by the YUV Layout enum. Also, the color channels should all be set to zero except the fifth color channel that should store the bitsPerPixel value.
Licence
The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Implementations
sourceimpl<'a> PixelFormat<'a>
impl<'a> PixelFormat<'a>
pub fn new() -> PixelFormat<'a>
sourcepub fn color_model(&self) -> ColorModel
pub fn color_model(&self) -> ColorModel
Accessor function for getting the colorModel.
sourcepub fn channel_count(&self) -> u8
pub fn channel_count(&self) -> u8
Accessor function for getting the channelCount. Channel Count is deduced by color channels with a size > 0 and if the size of the alpha channel is > 0.
sourcepub fn green_size(&self) -> u8
pub fn green_size(&self) -> u8
Accessor function for the size of the green color channel.
sourcepub fn magenta_size(&self) -> u8
pub fn magenta_size(&self) -> u8
Accessor function for the megenta color channel.
sourcepub fn yellow_size(&self) -> u8
pub fn yellow_size(&self) -> u8
Accessor function for the yellow color channel.
sourcepub fn black_size(&self) -> u8
pub fn black_size(&self) -> u8
Accessor function for the black/key color channel.
sourcepub fn saturation_size(&self) -> u8
pub fn saturation_size(&self) -> u8
Accessor function for the saturation channel size.
sourcepub fn lightness_size(&self) -> u8
pub fn lightness_size(&self) -> u8
Accessor function for the lightness channel size.
sourcepub fn brightness_size(&self) -> u8
pub fn brightness_size(&self) -> u8
Accessor function for the brightness channel size.
sourcepub fn alpha_size(&self) -> u8
pub fn alpha_size(&self) -> u8
Accessor function for the alpha channel size.
sourcepub fn bits_per_pixel(&self) -> u8
pub fn bits_per_pixel(&self) -> u8
Accessor function for the bits used per pixel. This function returns the sum of the color channels + the size of the alpha channel.
sourcepub fn alpha_usage(&self) -> AlphaUsage
pub fn alpha_usage(&self) -> AlphaUsage
Accessor function for alphaUsage.
sourcepub fn alpha_position(&self) -> AlphaPosition
pub fn alpha_position(&self) -> AlphaPosition
Accessor function for alphaPosition.
sourcepub fn premultiplied(&self) -> AlphaPremultiplied
pub fn premultiplied(&self) -> AlphaPremultiplied
Accessor function for the AlphaPremultiplied enum. This indicates if the alpha channel is multiplied in to the color channels.
sourcepub fn type_interpretation(&self) -> TypeInterpretation
pub fn type_interpretation(&self) -> TypeInterpretation
Accessor function for the type representation of a color channel or a pixel.
See also: TypeInterpretation
sourcepub fn byte_order(&self) -> ByteOrder
pub fn byte_order(&self) -> ByteOrder
The byte order is almost always set the the byte order of the current system. However, it can be useful to describe some YUV formats. This function should never return QPixelFormat::CurrentSystemEndian as this value is translated to a endian value in the constructor.
sourcepub fn yuv_layout(&self) -> YUVLayout
pub fn yuv_layout(&self) -> YUVLayout
Accessor function for the YUVLayout. It is difficult to describe the color channels of a YUV pixel format since YUV color model uses macro pixels. Instead the layout of the pixels are stored as an enum.
pub fn sub_enum(&self) -> u8
pub fn build(&self) -> Self
Trait Implementations
sourceimpl<'a> Clone for PixelFormat<'a>
impl<'a> Clone for PixelFormat<'a>
sourcefn clone(&self) -> PixelFormat<'a>
fn clone(&self) -> PixelFormat<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more