Struct qt_gui::QPixelFormat

source ·
#[repr(C)]
pub struct QPixelFormat { /* private fields */ }
Expand description

QPixelFormat is a class for describing different pixel layouts in graphics buffers

C++ class: QPixelFormat.

C++ documentation:

QPixelFormat is a class for describing different pixel layouts in graphics buffers

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.

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.

Implementations§

source§

impl QPixelFormat

source

pub unsafe fn alpha_position(&self) -> AlphaPosition

Accessor function for alphaPosition.

Calls C++ function: QPixelFormat::AlphaPosition QPixelFormat::alphaPosition() const.

C++ documentation:

Accessor function for alphaPosition.

source

pub unsafe fn alpha_size(&self) -> c_uchar

Accessor function for the alpha channel size.

Calls C++ function: unsigned char QPixelFormat::alphaSize() const.

C++ documentation:

Accessor function for the alpha channel size.

source

pub unsafe fn alpha_usage(&self) -> AlphaUsage

Accessor function for alphaUsage.

Calls C++ function: QPixelFormat::AlphaUsage QPixelFormat::alphaUsage() const.

C++ documentation:

Accessor function for alphaUsage.

source

pub unsafe fn bits_per_pixel(&self) -> c_uchar

Accessor function for the bits used per pixel. This function returns the sum of the color channels + the size of the alpha channel.

Calls C++ function: unsigned char QPixelFormat::bitsPerPixel() const.

C++ documentation:

Accessor function for the bits used per pixel. This function returns the sum of the color channels + the size of the alpha channel.

source

pub unsafe fn black_size(&self) -> c_uchar

Accessor function for the black/key color channel.

Calls C++ function: unsigned char QPixelFormat::blackSize() const.

C++ documentation:

Accessor function for the black/key color channel.

source

pub unsafe fn blue_size(&self) -> c_uchar

Accessor function for the size of the blue color channel.

Calls C++ function: unsigned char QPixelFormat::blueSize() const.

C++ documentation:

Accessor function for the size of the blue color channel.

source

pub unsafe fn brightness_size(&self) -> c_uchar

Accessor function for the brightness channel size.

Calls C++ function: unsigned char QPixelFormat::brightnessSize() const.

C++ documentation:

Accessor function for the brightness channel size.

source

pub unsafe 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.

Calls C++ function: QPixelFormat::ByteOrder QPixelFormat::byteOrder() const.

C++ documentation:

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.

source

pub unsafe fn channel_count(&self) -> c_uchar

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.

Calls C++ function: unsigned char QPixelFormat::channelCount() const.

C++ documentation:

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.

source

pub unsafe fn color_model(&self) -> ColorModel

Accessor function for getting the colorModel.

Calls C++ function: QPixelFormat::ColorModel QPixelFormat::colorModel() const.

C++ documentation:

Accessor function for getting the colorModel.

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QPixelFormat>> ) -> Ref<QPixelFormat>

QPixelFormat is a class for describing different pixel layouts in graphics buffers

Calls C++ function: QPixelFormat& QPixelFormat::operator=(const QPixelFormat& other).

C++ documentation:

QPixelFormat is a class for describing different pixel layouts in graphics buffers

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.

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.

source

pub unsafe fn cyan_size(&self) -> c_uchar

Accessor function for the cyan color channel.

Calls C++ function: unsigned char QPixelFormat::cyanSize() const.

C++ documentation:

Accessor function for the cyan color channel.

source

pub unsafe fn green_size(&self) -> c_uchar

Accessor function for the size of the green color channel.

Calls C++ function: unsigned char QPixelFormat::greenSize() const.

C++ documentation:

Accessor function for the size of the green color channel.

source

pub unsafe fn hue_size(&self) -> c_uchar

Accessor function for the hue channel size.

Calls C++ function: unsigned char QPixelFormat::hueSize() const.

C++ documentation:

Accessor function for the hue channel size.

source

pub unsafe fn lightness_size(&self) -> c_uchar

Accessor function for the lightness channel size.

Calls C++ function: unsigned char QPixelFormat::lightnessSize() const.

C++ documentation:

Accessor function for the lightness channel size.

source

pub unsafe fn magenta_size(&self) -> c_uchar

Accessor function for the megenta color channel.

Calls C++ function: unsigned char QPixelFormat::magentaSize() const.

C++ documentation:

Accessor function for the megenta color channel.

source

pub unsafe fn new_0a() -> CppBox<QPixelFormat>

Creates a null pixelformat. This format maps to QImage::Format_Invalid.

Calls C++ function: [constructor] void QPixelFormat::QPixelFormat().

C++ documentation:

Creates a null pixelformat. This format maps to QImage::Format_Invalid.

source

pub unsafe fn new_13a( color_model: ColorModel, first_size: c_uchar, second_size: c_uchar, third_size: c_uchar, fourth_size: c_uchar, fifth_size: c_uchar, alpha_size: c_uchar, alpha_usage: AlphaUsage, alpha_position: AlphaPosition, premultiplied: AlphaPremultiplied, type_interpretation: TypeInterpretation, byte_order: ByteOrder, sub_enum: c_uchar ) -> CppBox<QPixelFormat>

Creates a QPixelFormat which assigns its data to the attributes. colorModel will be put into a buffer which is 4 bits long.

Calls C++ function: [constructor] void QPixelFormat::QPixelFormat(QPixelFormat::ColorModel colorModel, unsigned char firstSize, unsigned char secondSize, unsigned char thirdSize, unsigned char fourthSize, unsigned char fifthSize, unsigned char alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied, QPixelFormat::TypeInterpretation typeInterpretation, QPixelFormat::ByteOrder byteOrder = …, unsigned char subEnum = …).

C++ documentation:

Creates a QPixelFormat which assigns its data to the attributes. colorModel will be put into a buffer which is 4 bits long.

firstSize secondSize thirdSize fourthSize fifthSize alphaSize are all meant to represent the size of a channel. The channels will be used for different uses dependent on the colorModel. For RGB the firstSize will represent the Red channel. On CMYK it will represent the value of the Cyan channel.

alphaUsage represents if the alpha channel is used or not.

alphaPosition is the position of the alpha channel.

premultiplied represents if the alpha channel is already multiplied with the color channels.

typeInterpretation is how the pixel is interpreted.

byteOrder represents the endianness of the pixelformat. This defaults to CurrentSystemEndian.

subEnum is used for colorModels that have to store some extra information with supplying an extra enum. This is used by YUV to store the YUV type The default value is 0.

source

pub unsafe fn new_12a( color_model: ColorModel, first_size: c_uchar, second_size: c_uchar, third_size: c_uchar, fourth_size: c_uchar, fifth_size: c_uchar, alpha_size: c_uchar, alpha_usage: AlphaUsage, alpha_position: AlphaPosition, premultiplied: AlphaPremultiplied, type_interpretation: TypeInterpretation, byte_order: ByteOrder ) -> CppBox<QPixelFormat>

Creates a QPixelFormat which assigns its data to the attributes. colorModel will be put into a buffer which is 4 bits long.

Calls C++ function: [constructor] void QPixelFormat::QPixelFormat(QPixelFormat::ColorModel colorModel, unsigned char firstSize, unsigned char secondSize, unsigned char thirdSize, unsigned char fourthSize, unsigned char fifthSize, unsigned char alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied, QPixelFormat::TypeInterpretation typeInterpretation, QPixelFormat::ByteOrder byteOrder = …).

C++ documentation:

Creates a QPixelFormat which assigns its data to the attributes. colorModel will be put into a buffer which is 4 bits long.

firstSize secondSize thirdSize fourthSize fifthSize alphaSize are all meant to represent the size of a channel. The channels will be used for different uses dependent on the colorModel. For RGB the firstSize will represent the Red channel. On CMYK it will represent the value of the Cyan channel.

alphaUsage represents if the alpha channel is used or not.

alphaPosition is the position of the alpha channel.

premultiplied represents if the alpha channel is already multiplied with the color channels.

typeInterpretation is how the pixel is interpreted.

byteOrder represents the endianness of the pixelformat. This defaults to CurrentSystemEndian.

subEnum is used for colorModels that have to store some extra information with supplying an extra enum. This is used by YUV to store the YUV type The default value is 0.

source

pub unsafe fn new_11a( color_model: ColorModel, first_size: c_uchar, second_size: c_uchar, third_size: c_uchar, fourth_size: c_uchar, fifth_size: c_uchar, alpha_size: c_uchar, alpha_usage: AlphaUsage, alpha_position: AlphaPosition, premultiplied: AlphaPremultiplied, type_interpretation: TypeInterpretation ) -> CppBox<QPixelFormat>

Creates a QPixelFormat which assigns its data to the attributes. colorModel will be put into a buffer which is 4 bits long.

Calls C++ function: [constructor] void QPixelFormat::QPixelFormat(QPixelFormat::ColorModel colorModel, unsigned char firstSize, unsigned char secondSize, unsigned char thirdSize, unsigned char fourthSize, unsigned char fifthSize, unsigned char alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied, QPixelFormat::TypeInterpretation typeInterpretation).

C++ documentation:

Creates a QPixelFormat which assigns its data to the attributes. colorModel will be put into a buffer which is 4 bits long.

firstSize secondSize thirdSize fourthSize fifthSize alphaSize are all meant to represent the size of a channel. The channels will be used for different uses dependent on the colorModel. For RGB the firstSize will represent the Red channel. On CMYK it will represent the value of the Cyan channel.

alphaUsage represents if the alpha channel is used or not.

alphaPosition is the position of the alpha channel.

premultiplied represents if the alpha channel is already multiplied with the color channels.

typeInterpretation is how the pixel is interpreted.

byteOrder represents the endianness of the pixelformat. This defaults to CurrentSystemEndian.

subEnum is used for colorModels that have to store some extra information with supplying an extra enum. This is used by YUV to store the YUV type The default value is 0.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QPixelFormat>> ) -> CppBox<QPixelFormat>

QPixelFormat is a class for describing different pixel layouts in graphics buffers

Calls C++ function: [constructor] void QPixelFormat::QPixelFormat(const QPixelFormat& other).

C++ documentation:

QPixelFormat is a class for describing different pixel layouts in graphics buffers

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.

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.

source

pub unsafe fn premultiplied(&self) -> AlphaPremultiplied

Accessor function for the AlphaPremultiplied enum. This indicates if the alpha channel is multiplied in to the color channels.

Calls C++ function: QPixelFormat::AlphaPremultiplied QPixelFormat::premultiplied() const.

C++ documentation:

Accessor function for the AlphaPremultiplied enum. This indicates if the alpha channel is multiplied in to the color channels.

source

pub unsafe fn red_size(&self) -> c_uchar

Accessor function for the size of the red color channel.

Calls C++ function: unsigned char QPixelFormat::redSize() const.

C++ documentation:

Accessor function for the size of the red color channel.

source

pub unsafe fn saturation_size(&self) -> c_uchar

Accessor function for the saturation channel size.

Calls C++ function: unsigned char QPixelFormat::saturationSize() const.

C++ documentation:

Accessor function for the saturation channel size.

source

pub unsafe fn sub_enum(&self) -> c_uchar

Calls C++ function: unsigned char QPixelFormat::subEnum() const.

source

pub unsafe fn type_interpretation(&self) -> TypeInterpretation

Accessor function for the type representation of a color channel or a pixel.

Calls C++ function: QPixelFormat::TypeInterpretation QPixelFormat::typeInterpretation() const.

C++ documentation:

Accessor function for the type representation of a color channel or a pixel.

See also TypeInterpretation.

source

pub unsafe fn yellow_size(&self) -> c_uchar

Accessor function for the yellow color channel.

Calls C++ function: unsigned char QPixelFormat::yellowSize() const.

C++ documentation:

Accessor function for the yellow color channel.

source

pub unsafe 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.

Calls C++ function: QPixelFormat::YUVLayout QPixelFormat::yuvLayout() const.

C++ documentation:

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.

Trait Implementations§

source§

impl CppDeletable for QPixelFormat

source§

unsafe fn delete(&self)

QPixelFormat is a class for describing different pixel layouts in graphics buffers

Calls C++ function: [destructor] void QPixelFormat::~QPixelFormat().

C++ documentation:

QPixelFormat is a class for describing different pixel layouts in graphics buffers

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.

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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.