Contents

vImageOverwriteChannelsWithScalar_Planar16F(_:_:_:)

Overwrites a floating-point 16-bit planar buffer with the specified scalar value in place.

Declaration

func vImageOverwriteChannelsWithScalar_Planar16F(_ scalar: Pixel_16F, _ dest: UnsafePointer<vImage_Buffer>, _ flags: vImage_Flags) -> vImage_Error

Parameters

  • 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.Planar16F>(
    size: .init(width: 4, height: 1))

let scalar: Pixel_16F = 101

pixelBuffer.withUnsafePointerToVImageBuffer { buf in
    _ = vImageOverwriteChannelsWithScalar_Planar16F(scalar,
                                                    buf,
                                                    vImage_Flags(kvImageNoFlags))
}

// Prints "[101, 101, 101, 101]".
print(pixelBuffer.array)

See Also

Overwriting with scalar values