MemoryFormat
Description:
[ CCode ( cprefix = "GDK_MEMORY_" , type_id = "gdk_memory_format_get_type ()" ) ]
public enum MemoryFormat
Describes formats that image data can have in memory.
It describes formats by listing the contents of the memory passed to it. So `GDK_MEMORY_A8R8G8B8` will be 1 byte (8 bits) of alpha,
followed by a byte each of red, green and blue. It is not endian-dependent, so `CAIRO_FORMAT_ARGB32` is represented by different
`GdkMemoryFormats` on architectures with different endiannesses.
A note on naming
The format names are roughly modelled after
VkFormat. A name follows
`GDK_MEMORY_<CHANNELS>_<DATA_TYPE>_<SUBSAMPLING> <PREMULTIPLIED>` where CHANNELS describe how the RGBA channels
are layed out in memory, with an X denoting padding. DATA_TYPE is unsigned normalized integer if not present, or otherwise FLOAT. The
optional SUBSAMPLING defines the subsampling method used. The optional ENDIAN term describes the endianness if it is not host-endian.
Finally, an optional PREMULTIPLIED term indicates that the color channels are premultiplied with the alpha value, if it is omitted, the
data is not premultiplied or there is no alpha channel.
The CHANNELS are given as a list of planes seperated by underscores where each plane is split into multiple elements describing one or
more bytes of memory. Each element is given as the list of channels folowed by the amount of bits taken up.
So the fictional format `RGB565_A8_PREMULTIPLIED` would describe a format with 2 planes where the first plane is an unsigned 16 bit
integer containing the RGB channels with 5, 6, and 5 bits respectively while the 2nd plane contains the alpha channel as an unisnged 8bit
integer.
Content:
Enum values:
- A16 - One guint16 value; for alpha.
- A16_FLOAT - One half-float value; for
alpha.
- A32_FLOAT - One float value; for alpha.
- A8 - One byte; for alpha.
- A8B8G8R8 - 4 bytes; for alpha, blue,
green, red.
- A8B8G8R8_PREMULTIPLIED - 4
bytes; for alpha, blue, green, red, The color values are premultiplied with the alpha value.
- A8R8G8B8 - 4 bytes; for alpha, red,
green, blue.
- A8R8G8B8_PREMULTIPLIED - 4
bytes; for alpha, red, green, blue.
- B8G8R8 - 3 bytes; for blue, green, red.
- B8G8R8A8 - 4 bytes; for blue, green, red,
alpha.
- B8G8R8A8_PREMULTIPLIED - 4
bytes; for blue, green, red, alpha.
- B8G8R8G8_422 - Packed format with
subsampled channels.
- B8G8R8X8 - 4 bytes; for blue, green, red,
unused.
- G10X6_B10X6R10X6_420 -
Multiplane format with 2 planes.
- G12X4_B12X4R12X4_420 -
Multiplane format with 2 planes.
- G16 - One guint16 value; for grayscale.
- G16A16 - 2 guint16 values; for grayscale,
alpha.
- G16A16_PREMULTIPLIED - 2
guint16 values; for grayscale, alpha.
- G16_B16R16_420 - Multiplane format
with 2 planes.
- G16_B16_R16_420 - Multiplane
format with 3 planes.
- G16_B16_R16_422 - Multiplane
format with 3 planes.
- G16_B16_R16_444 - Multiplane
format with 3 planes.
- G8 - One byte; for grayscale.
- G8A8 - 2 bytes; for grayscale, alpha.
- G8A8_PREMULTIPLIED - 2 bytes;
for grayscale, alpha.
- G8B8G8R8_422 - Packed format with
subsampled channels.
- G8R8G8B8_422 - Packed format with
subsampled channels.
- G8_B8R8_420 - Multiplane format with 2
planes.
- G8_B8R8_422 - Multiplane format with 2
planes.
- G8_B8R8_444 - Multiplane format with 2
planes.
- G8_B8_R8_410 - Multiplane format with
3 planes.
- G8_B8_R8_411 - Multiplane format with
3 planes.
- G8_B8_R8_420 - Multiplane format with
3 planes.
- G8_B8_R8_422 - Multiplane format with
3 planes.
- G8_B8_R8_444 - Multiplane format with
3 planes.
- G8_R8B8_420 - Multiplane format with 2
planes.
- G8_R8B8_422 - Multiplane format with 2
planes.
- G8_R8B8_444 - Multiplane format with 2
planes.
- G8_R8_B8_410 - Multiplane format with
3 planes.
- G8_R8_B8_411 - Multiplane format with
3 planes.
- G8_R8_B8_420 - Multiplane format with
3 planes.
- G8_R8_B8_422 - Multiplane format with
3 planes.
- G8_R8_B8_444 - Multiplane format with
3 planes.
- N_FORMATS - The number of formats.
- R16G16B16 - 3 guint16 values; for red,
green, blue.
- R16G16B16A16 - 4 guint16 values; for
red, green, blue, alpha.
- R16G16B16A16_FLOAT - 4
half-float values; for red, green, blue and alpha.
- R16G16B16A16_FLOAT_PREMULTIPLIED -
4 half-float values; for red, green, blue and alpha.
- R16G16B16A16_PREMULTIPLIED -
4 guint16 values; for red, green, blue, alpha.
- R16G16B16_FLOAT - 3 half-float
values; for red, green, blue.
- R32G32B32A32_FLOAT - 4 float
values; for red, green, blue and alpha.
- R32G32B32A32_FLOAT_PREMULTIPLIED -
4 float values; for red, green, blue and alpha.
- R32G32B32_FLOAT - 3 float values;
for red, green, blue.
- R8G8B8 - 3 bytes; for red, green, blue.
- R8G8B8A8 - 4 bytes; for red, green, blue,
alpha.
- R8G8B8A8_PREMULTIPLIED - 4
bytes; for red, green, blue, alpha The color values are premultiplied with the alpha value.
- R8G8B8G8_422 - Packed format with
subsampled channels.
- R8G8B8X8 - 4 bytes; for red, green, blue,
unused.
- X4G12_X4B12_X4R12_420 -
Multiplane format with 3 planes.
- X4G12_X4B12_X4R12_422 -
Multiplane format with 3 planes.
- X4G12_X4B12_X4R12_444 -
Multiplane format with 3 planes.
- X6G10_X6B10_X6R10_420 -
Multiplane format with 3 planes.
- X6G10_X6B10_X6R10_422 -
Multiplane format with 3 planes.
- X6G10_X6B10_X6R10_444 -
Multiplane format with 3 planes.
- X8B8G8R8 - 4 bytes; for unused, blue,
green, red.
- X8R8G8B8 - 4 bytes; for unused, red,
green, blue.