QPixelFormat Class▲
-
Header: QPixelFormat
-
Since: Qt 5.4
-
qmake: QT += gui
Detailed Description▲
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.
See Also▲
See also TypeInterpretation
Member Function Documentation▲
[default] QPixelFormat::QPixelFormat()▲
Creates a null pixelformat. This format maps to QImage::Format_Invalid.
[default] QPixelFormat::QPixelFormat(int colorModel, int firstSize, int secondSize, int thirdSize, int fourthSize, int fifthSize, int alphaSize, QPixelFormat::AlphaUsage alphaUsage, QPixelFormat::AlphaPosition alphaPosition, QPixelFormat::AlphaPremultiplied premultiplied, QPixelFormat::TypeInterpretation typeInterpretation, QPixelFormat::ByteOrder byteOrder = CurrentSystemEndian, int subEnum = 0)▲
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.