Function

vImageRotate90_ARGB8888(_:_:_:_:_:)

Rotates an ARGB8888 source image by the provided factor of 90.

Declaration

func vImageRotate90_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ rotationConstant: UInt8, _ backColor: UnsafePointer<UInt8>, _ flags: vImage_Flags) -> vImage_Error

Parameters

src

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

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.

rotationConstant

A value specifying the angle of rotation.

backColor

A background color. Pass a pixel value only if you also set the kvImageBackgroundColorFill flag.

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 maps the center point of the source image to the center point of the destination image. It doesn't scale or resample; instead, the function copies individual pixels unchanged to new locations.

This function places certain restrictions on the pixel height and width of the source and destination buffers, so that it can precisely map the center of the source to the center of the destination precisely. The restrictions are:

  • If you're rotating the image 90 or 270 degrees, the height of the source image and the width of the destination image must both be even or both be odd.

  • The width of the source image and the height of the destination image must both be even or both be odd.

If your images don't meet these restrictions, you can use the general (high-level) rotate function instead, with an angle of 90 or 270 degrees.

Depending on the relative sizes of the source image and the destination buffer, parts of the source image may be clipped. Areas outside the source image may appear in the destination image as the background color.