Function

vImageConvert_ARGB8888toRGB565

Converts an ARGB8888 image into an RGB565 image.

Declaration

vImage_Error vImageConvert_ARGB8888toRGB565(const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags);

Parameters

src

A pointer to a vImage buffer structure that contains the source image whose data you want to convert.

dest

A pointer to a vImage buffer data structure. You're responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer this structure points to contains the destination image data. When you no longer need the data buffer, you must deallocate the memory.

flags

The options to use when performing the operation. If you plan to perform your own tiling or use multithreading, pass kvImageDoNotTile.

Return Value

kvImageNoError; otherwise, one of the error codes described in Data Types and Constants.

Discussion

The alpha channel in the ARGB8888 image is ignored. (The RGB565 format has 16-bit pixels with 5 bits for red, 6 for green, and 5 for blue.) The function calculates the pixels in the destination image as follows:

    uint32_t red   = (8bitRedChannel   * (31*2) + 255) / (255*2)
    uint32_t green = (8bitGreenChannel * 63 + 127) / 255
    uint32_t blue  = (8bitBlueChannel  * 31 + 127) / 255
    uint16_t RGB565pixel = (red << 11) | (green <<  5) | blue

See Also

Converting from ARGB Formats

vImageConvert_ARGBFFFFtoARGB8888_dithered

Converts and permutes an ARGBFFFF image to an ARGB8888 image with dithering.

vImageConvert_ARGBFFFFtoRGBFFF

Converts a four-channel ARGBFFFF image to a three-channel RGBFFF image by removing the alpha channel.

vImageConvert_ARGBFFFFtoPlanar8

Separates an ARGBFFFF image into four Planar8 images.

vImageConvert_ARGBFFFFtoPlanarF

Separates an ARGBFFFF image into four PlanarF images.

vImageConvert_ARGBFFFFToARGB2101010

Converts an ARGBFFFF format image to an ARGB2101010 format image.

vImageConvert_ARGBFFFFToXRGB2101010

Converts an ARGBFFFF format image to an XRGB2101010 format image.

vImageConvert_ARGB1555toARGB8888

Converts an ARGB1555 image to an ARGB8888 image.

vImageConvert_ARGB1555toRGB565

Converts an ARGB1555 image to an RGB565 image, with loss of alpha.

vImageConvert_ARGB1555toPlanar8

Separates an ARGB1555 image into four Planar8 images.

vImageConvert_ARGB16UtoRGB16U

Converts an ARGB16U image to an RGB16U image.

vImageConvert_ARGB16UtoARGB8888_dithered

Converts and permutes an ARGB16U image to an ARGB8888 image with dithering.

vImageConvert_ARGB16UToARGB2101010

Converts an ARGB16U format image to an ARGB2101010 format image.

vImageConvert_ARGB16UToRGBA1010102

Converts an ARGB16U format image to an RGBA1010102 format image.

vImageConvert_ARGB16UToXRGB2101010

Converts an ARGB16U format image to an XRGB2101010 format image.

vImageConvert_ARGB16UToARGB8888

Converts and permutes an ARGB16U image to an ARGB8888 image.

vImageConvert_ARGB16UtoPlanar16U

Separates an ARGB16U image into four Planar16U images.

vImageConvert_ARGB16Q12ToARGB2101010

Converts an ARGB16Q12 format image to an ARGB2101010 format image.

vImageConvert_ARGB16Q12ToXRGB2101010

Converts an ARGB16Q12 format image to an XRGB2101010 format image.

vImageConvert_ARGB16Q12ToRGBA1010102

Converts an ARGB16Q12 format image to an RGBA1010102 format image.

vImageConvert_ARGB2101010ToARGB16F

Converts an ARGB2101010 format image to an ARGB16F format image.

vImageConvert_ARGB2101010ToARGB16Q12

Converts an ARGB2101010 format image to an ARGB16Q12 format image.

vImageConvert_ARGB2101010ToARGB16U

Converts an ARGB2101010 format image to an ARGB16U format image.

vImageConvert_ARGB2101010ToARGB8888

Converts an ARGB2101010 format image to an ARGB8888 format image.

vImageConvert_ARGB2101010ToARGBFFFF

Converts an ARGB2101010 format image to an ARGBFFFF format image.

vImageConvert_ARGB8888toARGB1555

Converts an ARGB8888 image into an ARGB1555 image.

vImageConvert_ARGB8888ToRGB16U

Converts and permutes an ARGB8888 image into an RGB16U image.

vImageConvert_ARGB8888toPlanar8

Separates an ARGB8888 image into four Planar8 images.

vImageConvert_ARGB8888toPlanarF

Separates an ARGB8888 image into four PlanarF images.

vImageConvert_ARGB8888toRGB888

Converts a four-channel ARGB8888 image to a three-channel RGB888 image by removing the alpha channel..

vImageConvert_ARGB8888toPlanar16Q12

Separates an ARGB8888 image into four Planar16Q12 images.

vImageConvert_ARGB8888toARGB1555_dithered

Converts an ARGB8888 image to an ARGB1555 image with dithering.

vImageConvert_ARGB8888toRGB565_dithered

Converts an ARGB8888 image to an RGB565 image with dithering.

vImageConvert_ARGB8888ToRGBA1010102

Converts an ARGB8888 format image to an RGBA1010102 format image.

vImageConvert_ARGB8888ToARGB2101010

Converts an ARGB8888 format image to an ARGB2101010 format image.

vImageConvert_ARGB8888ToXRGB2101010

Converts an ARGB8888 format image to an XRGB2101010 format image.

vImageConvert_ARGB8888ToARGB16U

Converts and permutes an ARGB8888 image to an ARGB16U image.