Function

vImageConvert_ARGB8888toARGB1555_dithered(_:_:_:_:_:)

Converts an ARGB8888 image to an ARGB1555 image with dithering.

Declaration

func vImageConvert_ARGB8888toARGB1555_dithered(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutableRawPointer!, _ dither: Int32, _ flags: vImage_Flags) -> vImage_Error

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.

tempBuffer

A pointer to a region of memory that vImage can use as a scratch space for storing temporary data.

dither
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

This function is similar to vImageConvert_ARGB8888toARGB1555(_:_:_:), except the result is dithered instead of rounded to nearest. It should provide more accurate overall color reproduction and less banding in low-frequency regions of the image.

This function supports the following dithering options:

kvImageConvert_DitherOrdered

Precomputed blue noise is added to the image before the values are rounded to the destination format. The offset into the blue noise is randomized per call to avoid visible artifacts if you do your own tiling or call the function on sequential frames of video.

kvImageConvert_DitherOrderedReproducible

Precomputed blue noise is added to the image before the values are rounded to the destination format. The offset into the blue noise is the same for every call to allow users to get reproducible results.

This function can work in place provided the following are true:

  • For each buffer, buf, that overlaps with dest, buf->data is equal to dest->data and buf->rowBytes >= dest->rowBytes.

  • If an overlapping buffer has a different rowBytes from dest, kvImageDoNotTile is also passed in the flags.

See Also

Converting from ARGB Formats

func vImageConvert_ARGBFFFFtoRGBFFF(UnsafePointer<vImage_Buffer>!, UnsafePointer<vImage_Buffer>!, vImage_Flags) -> vImage_Error

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

func vImageConvert_ARGB8888toRGB888(UnsafePointer<vImage_Buffer>, UnsafePointer<vImage_Buffer>, vImage_Flags) -> vImage_Error

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