### Enumeration

# Gdk MemoryFormat

#### Declaration

    enum Gdk.MemoryFormat

#### Description [src]

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.

#### Members

`GDK_MEMORY_B8G8R8A8_PREMULTIPLIED`

  4 bytes; for blue, green, red, alpha. The color values are premultiplied with the alpha value.

  - Value: `0`
  - Available since: 4.0
`GDK_MEMORY_A8R8G8B8_PREMULTIPLIED`

  4 bytes; for alpha, red, green, blue. The color values are premultiplied with the alpha value.

  - Value: `1`
  - Available since: 4.0
`GDK_MEMORY_R8G8B8A8_PREMULTIPLIED`

  4 bytes; for red, green, blue, alpha The color values are premultiplied with the alpha value.

  - Value: `2`
  - Available since: 4.0
`GDK_MEMORY_B8G8R8A8`

  4 bytes; for blue, green, red, alpha.

  - Value: `3`
  - Available since: 4.0
`GDK_MEMORY_A8R8G8B8`

  4 bytes; for alpha, red, green, blue.

  - Value: `4`
  - Available since: 4.0
`GDK_MEMORY_R8G8B8A8`

  4 bytes; for red, green, blue, alpha.

  - Value: `5`
  - Available since: 4.0
`GDK_MEMORY_A8B8G8R8`

  4 bytes; for alpha, blue, green, red.

  - Value: `6`
  - Available since: 4.0
`GDK_MEMORY_R8G8B8`

  3 bytes; for red, green, blue. The data is opaque.

  - Value: `7`
  - Available since: 4.0
`GDK_MEMORY_B8G8R8`

  3 bytes; for blue, green, red. The data is opaque.

  - Value: `8`
  - Available since: 4.0
`GDK_MEMORY_R16G16B16`

  3 guint16 values; for red, green, blue.

  - Value: `9`
  - Available since: 4.6
`GDK_MEMORY_R16G16B16A16_PREMULTIPLIED`

  4 guint16 values; for red, green, blue, alpha. The color values are premultiplied with the alpha value.

  - Value: `10`
  - Available since: 4.6
`GDK_MEMORY_R16G16B16A16`

  4 guint16 values; for red, green, blue, alpha.

  - Value: `11`
  - Available since: 4.6
`GDK_MEMORY_R16G16B16_FLOAT`

  3 half-float values; for red, green, blue. The data is opaque.

  - Value: `12`
  - Available since: 4.6
`GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED`

  4 half-float values; for red, green, blue and alpha. The color values are premultiplied with the alpha value.

  - Value: `13`
  - Available since: 4.6
`GDK_MEMORY_R16G16B16A16_FLOAT`

  4 half-float values; for red, green, blue and alpha.

  - Value: `14`
  - Available since: 4.6
`GDK_MEMORY_R32G32B32_FLOAT`

  3 float values; for red, green, blue.

  - Value: `15`
  - Available since: 4.0
`GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED`

  4 float values; for red, green, blue and alpha. The color values are premultiplied with the alpha value.

  - Value: `16`
  - Available since: 4.6
`GDK_MEMORY_R32G32B32A32_FLOAT`

  4 float values; for red, green, blue and alpha.

  - Value: `17`
  - Available since: 4.6
`GDK_MEMORY_G8A8_PREMULTIPLIED`

  2 bytes; for grayscale, alpha. The color values are premultiplied with the alpha value.

  - Value: `18`
  - Available since: 4.12
`GDK_MEMORY_G8A8`

  2 bytes; for grayscale, alpha.

  - Value: `19`
  - Available since: 4.12
`GDK_MEMORY_G8`

  One byte; for grayscale. The data is opaque.

  - Value: `20`
  - Available since: 4.12
`GDK_MEMORY_G16A16_PREMULTIPLIED`

  2 guint16 values; for grayscale, alpha. The color values are premultiplied with the alpha value.

  - Value: `21`
  - Available since: 4.12
`GDK_MEMORY_G16A16`

  2 guint16 values; for grayscale, alpha.

  - Value: `22`
  - Available since: 4.12
`GDK_MEMORY_G16`

  One guint16 value; for grayscale. The data is opaque.

  - Value: `23`
  - Available since: 4.12
`GDK_MEMORY_A8`

  One byte; for alpha.

  - Value: `24`
  - Available since: 4.12
`GDK_MEMORY_A16`

  One guint16 value; for alpha.

  - Value: `25`
  - Available since: 4.12
`GDK_MEMORY_A16_FLOAT`

  One half-float value; for alpha.

  - Value: `26`
  - Available since: 4.12
`GDK_MEMORY_A32_FLOAT`

  One float value; for alpha.

  - Value: `27`
  - Available since: 4.12
`GDK_MEMORY_A8B8G8R8_PREMULTIPLIED`

  4 bytes; for alpha, blue, green, red, The color values are premultiplied with the alpha value.

  - Value: `28`
  - Available since: 4.14
`GDK_MEMORY_B8G8R8X8`

  4 bytes; for blue, green, red, unused.

  - Value: `29`
  - Available since: 4.14
`GDK_MEMORY_X8R8G8B8`

  4 bytes; for unused, red, green, blue.

  - Value: `30`
  - Available since: 4.14
`GDK_MEMORY_R8G8B8X8`

  4 bytes; for red, green, blue, unused.

  - Value: `31`
  - Available since: 4.14
`GDK_MEMORY_X8B8G8R8`

  4 bytes; for unused, blue, green, red.

  - Value: `32`
  - Available since: 4.14
`GDK_MEMORY_G8_B8R8_420`

  Multiplane format with 2 planes.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cb followed by Cr. Subsampled in both the X and Y direction.

  Commonly known by the fourcc “NV12”.

  - Value: `33`
  - Available since: 4.20
`GDK_MEMORY_G8_R8B8_420`

  Multiplane format with 2 planes.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. Subsampled in both the X and Y direction.

  Commonly known by the fourcc “NV21”.

  - Value: `34`
  - Available since: 4.20
`GDK_MEMORY_G8_B8R8_422`

  Multiplane format with 2 planes.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cb followed by Cr. Subsampled in the X direction.

  Commonly known by the fourcc “NV16”.

  - Value: `35`
  - Available since: 4.20
`GDK_MEMORY_G8_R8B8_422`

  Multiplane format with 2 planes.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. Subsampled in the X direction.

  Commonly known by the fourcc “NV61”.

  - Value: `36`
  - Available since: 4.20
`GDK_MEMORY_G8_B8R8_444`

  Multiplane format with 2 planes.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cb followed by Cr. This format is not subsampled.

  Commonly known by the fourcc “NV24”.

  - Value: `37`
  - Available since: 4.20
`GDK_MEMORY_G8_R8B8_444`

  Multiplane format with 2 planes.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

  Commonly known by the fourcc “NV42”.

  - Value: `38`
  - Available since: 4.20
`GDK_MEMORY_G10X6_B10X6R10X6_420`

  Multiplane format with 2 planes.

  Each channel is a 16 bit integer, but only the highest 10 bits are used.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

  Commonly known by the fourcc “P010”.

  - Value: `39`
  - Available since: 4.20
`GDK_MEMORY_G12X4_B12X4R12X4_420`

  Multiplane format with 2 planes.

  Each channel is a 16 bit integer, but only the highest 10 bits are used.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

  Commonly known by the fourcc “P012”.

  - Value: `40`
  - Available since: 4.20
`GDK_MEMORY_G16_B16R16_420`

  Multiplane format with 2 planes.

  Each channel is a 16 bit integer.

  The first plane contains the first channel, usually containing luma values. The second plane with interleaved chroma values, Cr followed by Cb. This format is not subsampled.

  Commonly known by the fourcc “P016”.

  - Value: `41`
  - Available since: 4.20
`GDK_MEMORY_G8_B8_R8_410`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 1st channel.

  Commonly known by the fourcc “YUV410”.

  - Value: `42`
  - Available since: 4.20
`GDK_MEMORY_G8_R8_B8_410`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the second chroma chanel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 1st channel.

  The third plane usually contains the first chroma channel. Subsampled in both the X and Y direction with 4:1 ratio. It is mapped into the 3rd channel.

  Commonly known by the fourcc “YVU410”.

  - Value: `43`
  - Available since: 4.20
`GDK_MEMORY_G8_B8_R8_411`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 1st channel.

  Commonly known by the fourcc “YUV411”.

  - Value: `44`
  - Available since: 4.20
`GDK_MEMORY_G8_R8_B8_411`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the second chroma chanel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 1st channel.

  The third plane usually contains the first chroma channel. Subsampled in the X direction with 4:1 ratio. It is mapped into the 3rd channel.

  Commonly known by the fourcc “YVU411”.

  - Value: `45`
  - Available since: 4.20
`GDK_MEMORY_G8_B8_R8_420`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “YUV420”.

  - Value: `46`
  - Available since: 4.20
`GDK_MEMORY_G8_R8_B8_420`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the second chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

  The third plane usually contains the first chroma channel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

  Commonly known by the fourcc “YVU420”.

  - Value: `47`
  - Available since: 4.20
`GDK_MEMORY_G8_B8_R8_422`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in the X direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in the X direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “YUV422”.

  - Value: `48`
  - Available since: 4.20
`GDK_MEMORY_G8_R8_B8_422`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the second chroma chanel. Subsampled in the X direction. It is mapped into the 1st channel.

  The third plane usually contains the first chroma channel. Subsampled in the X direction. It is mapped into the 3rd channel.

  Commonly known by the fourcc “YVU422”.

  - Value: `49`
  - Available since: 4.20
`GDK_MEMORY_G8_B8_R8_444`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. It is mapped into the 1st channel.

  Commonly known by the fourcc “YUV444”.

  - Value: `50`
  - Available since: 4.20
`GDK_MEMORY_G8_R8_B8_444`

  Multiplane format with 3 planes.

  Each channel is a 8 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the second chroma chanel. Subsampled in the X direction. It is mapped into the 1st channel.

  The third plane usually contains the first chroma channel. Subsampled in the X direction. It is mapped into the 3rd channel.

  Commonly known by the fourcc “YVU444”.

  - Value: `51`
  - Available since: 4.20
`GDK_MEMORY_G8B8G8R8_422`

  Packed format with subsampled channels.

  Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

  Each block contains 2 pixels, so the width must be a multiple of 2.

  Commonly known by the fourcc “YUYV”.

  - Value: `52`
  - Available since: 4.20
`GDK_MEMORY_G8R8G8B8_422`

  Packed format with subsampled channels.

  Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

  Each block contains 2 pixels, so the width must be a multiple of 2.

  Commonly known by the fourcc “YVYU”.

  - Value: `53`
  - Available since: 4.20
`GDK_MEMORY_R8G8B8G8_422`

  Packed format with subsampled channels.

  Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

  Each block contains 2 pixels, so the width must be a multiple of 2.

  Commonly known by the fourcc “VYUY”.

  - Value: `54`
  - Available since: 4.20
`GDK_MEMORY_B8G8R8G8_422`

  Packed format with subsampled channels.

  Each channel is a 8 bit integer. The red and blue/chroma channels are subsampled and interleaved with the green/luma channel.

  Each block contains 2 pixels, so the width must be a multiple of 2.

  Commonly known by the fourcc “UYVY”.

  - Value: `55`
  - Available since: 4.20
`GDK_MEMORY_X6G10_X6B10_X6R10_420`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  Only the 10 lower bits are used. The remaining ones must be set to 0 by the producer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “S010”.

  - Value: `56`
  - Available since: 4.20
`GDK_MEMORY_X6G10_X6B10_X6R10_422`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  Only the 10 lower bits are used. The remaining ones must be set to 0 by the producer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in the X direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in the X direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “S210”.

  - Value: `57`
  - Available since: 4.20
`GDK_MEMORY_X6G10_X6B10_X6R10_444`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  Only the 10 lower bits are used. The remaining ones must be set to 0 by the producer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. It is mapped into the 1st channel.

  Commonly known by the fourcc “S410”.

  - Value: `58`
  - Available since: 4.20
`GDK_MEMORY_X4G12_X4B12_X4R12_420`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  Only the 12 lower bits are used. The remaining ones must be set to 0 by the producer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “S012”.

  - Value: `59`
  - Available since: 4.20
`GDK_MEMORY_X4G12_X4B12_X4R12_422`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  Only the 12 lower bits are used. The remaining ones must be set to 0 by the producer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in the X direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in the X direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “S212”.

  - Value: `60`
  - Available since: 4.20
`GDK_MEMORY_X4G12_X4B12_X4R12_444`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  Only the 12 lower bits are used. The remaining ones must be set to 0 by the producer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. It is mapped into the 1st channel.

  Commonly known by the fourcc “S412”.

  - Value: `61`
  - Available since: 4.20
`GDK_MEMORY_G16_B16_R16_420`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in both the X and Y direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in both the X and Y direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “S016”.

  - Value: `62`
  - Available since: 4.20
`GDK_MEMORY_G16_B16_R16_422`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. Subsampled in the X direction. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. Subsampled in the X direction. It is mapped into the 1st channel.

  Commonly known by the fourcc “S216”.

  - Value: `63`
  - Available since: 4.20
`GDK_MEMORY_G16_B16_R16_444`

  Multiplane format with 3 planes.

  Each channel is a 16 bit integer.

  The first plane usually contains the luma channel. It is mapped into the 2nd channel.

  The second plane usually contains the first chroma chanel. It is mapped into the 3rd channel.

  The third plane usually contains the second chroma channel. It is mapped into the 1st channel.

  Commonly known by the fourcc “S416”.

  - Value: `64`
  - Available since: 4.20
`GDK_MEMORY_ARGB2101010_PREMULTIPLIED`

  4 bytes per pixel

  Bits 31..30 contain the alpha channel, 29..20 red, 19..10 green and 9..0 blue.

  The color values are premultiplied with the alpha value.

  - Value: `65`
  - Available since: 4.24
`GDK_MEMORY_ARGB2101010`

  4 bytes per pixel

  Bits 31..30 contain the alpha channel, 29..20 red, 19..10 green and 9..0 blue.

  - Value: `66`
  - Available since: 4.24
`GDK_MEMORY_XRGB2101010`

  4 bytes per pixel

  Bits 31..30 are padding, bits 29..20 contain red, 19..10 green and 9..0 blue.

  The format is opaque.

  - Value: `67`
  - Available since: 4.24
`GDK_MEMORY_ABGR2101010_PREMULTIPLIED`

  4 bytes per pixel

  Bits 31..30 contain the alpha channel, 29..20 blue, 19..10 green and 9..0 red.

  The color values are premultiplied with the alpha value.

  - Value: `68`
  - Available since: 4.24
`GDK_MEMORY_ABGR2101010`

  4 bytes per pixel

  Bits 31..30 contain the alpha channel, 29..20 blue, 19..10 green and 9..0 red.

  - Value: `69`
  - Available since: 4.24
`GDK_MEMORY_XBGR2101010`

  4 bytes per pixel

  Bits 31..30 are padding, bits 29..20 contain blue, 19..10 green and 9..0 red.

  The format is opaque.

  - Value: `70`
  - Available since: 4.24
`GDK_MEMORY_N_FORMATS`

  The number of formats. This value will change as more formats get added, so do not rely on its concrete integer.

  - Value: `71`
  - Available since: 4.0