Scales an ARGB16U source image to fit a destination buffer.
SDKs
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Accelerate
Declaration
func vImageScale_ARGB16U(_ src: Unsafe Pointer<v Image _Buffer>, _ dest: Unsafe Pointer<v Image _Buffer>, _ tempBuffer: Unsafe Mutable Raw Pointer!, _ flags: v Image _Flags) -> v Image _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
, androw
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.Bytes tempBuffer
A pointer to a temporary buffer. If you pass
NULL
, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you're responsible for deallocating it when you no longer need it.If you want to allocate the buffer yourself, see Allocating Temporary Buffer Memory for information on how to determine the minimum size that you must allocate.
flags
The options to use when applying the scaling.
To specify how vImage handles pixel locations beyond the edge of the source image, you must set exactly one of the following flags:
kv
orImage Background Color Fill kv
.Image Edge Extend If you want vImage to use a higher quality, but slower resampling filter, set the
kv
flag.Image High Quality Resampling If you plan to perform your own tiling or use multithreading, set the
kv
flag.Image Do Not Tile This function ignores the
kv
flag.Image Leave Alpha Unchanged
Return Value
kv
; otherwise, one of the error codes described in Data Types and Constants.
Discussion
The relative size of the source image and the destination buffer determine the scaling factors, which may be different in the X and Y directions.
Allocating Temporary Buffer Memory
If you want to allocate the memory for the temp
parameter yourself, call this function twice, as follows:
To determine the minimum size for the temporary buffer, the first time you call this function, pass the
kv
flag. Pass the same values for all other parameters that you intend to use for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) TheImage Get Temp Buffer Size kv
flag prevents the function from performing any processing other than to determine the minimum buffer size.Image Get Temp Buffer Size After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the
temp
parameter. This time, don't pass theBuffer kv
flag.Image Get Temp Buffer Size