vImageOverwriteChannelsWithScalar_Planar16U(_:_:_:)
Overwrites an unsigned 16-bit planar buffer with the specified scalar value in place.
Declaration
func vImageOverwriteChannelsWithScalar_Planar16U(_ scalar: Pixel_16U, _ dest: UnsafePointer<vImage_Buffer>, _ flags: vImage_Flags) -> vImage_ErrorParameters
- scalar:
The scalar value that provides the new pixel values.
- dest:
A pointer to the destination vImage buffer 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, deallocate the memory to prevent memory leaks.
- flags:
The options to use when performing the operation. If your code implements its own tiling or its own multithreading, pass Kvimagedonottile; otherwise, pass Kvimagenoflags.
Return Value
kvImageNoError; otherwise, one of the error codes in Data Types and Constants.
Discussion
The following code fills pixelBuffer with scalar:
let pixelBuffer = vImage.PixelBuffer<vImage.Planar16U>(
size: .init(width: 4, height: 1))
let scalar: Pixel_16U = 101
pixelBuffer.withUnsafePointerToVImageBuffer { buf in
_ = vImageOverwriteChannelsWithScalar_Planar16U(scalar,
buf,
vImage_Flags(kvImageNoFlags))
}
// Prints "[101, 101, 101, 101]".
print(pixelBuffer.array)See Also
Overwriting with scalar values
vImageOverwriteChannelsWithScalar_Planar8(_:_:_:)vImageOverwriteChannelsWithScalar_Planar16S(_:_:_:)vImageOverwriteChannelsWithScalar_Planar16F(_:_:_:)vImageOverwriteChannelsWithScalar_PlanarF(_:_:_:)vImageOverwriteChannelsWithScalar_ARGB8888(_:_:_:_:_:)vImageOverwriteChannelsWithScalar_ARGBFFFF(_:_:_:_:_:)