---
title: "vImageOverwriteChannelsWithScalar_PlanarF(_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimageoverwritechannelswithscalar_planarf(_:_:_:)"
---

# vImageOverwriteChannelsWithScalar_PlanarF(_:_:_:)

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

## Declaration

```swift
func vImageOverwriteChannelsWithScalar_PlanarF(_ scalar: Pixel_F, _ 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 doc://com.apple.accelerate/documentation/Accelerate/vImage_Buffer/height, doc://com.apple.accelerate/documentation/Accelerate/vImage_Buffer/width, and doc://com.apple.accelerate/documentation/Accelerate/vImage_Buffer/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 doc://com.apple.accelerate/documentation/Accelerate/kvImageDoNotTile; otherwise, pass doc://com.apple.accelerate/documentation/Accelerate/kvImageNoFlags.

## Return Value

Return Value kvImageNoError; otherwise, one of the error codes in Data Types and Constants.

## Discussion

Discussion The following code fills pixelBuffer with scalar: let pixelBuffer = vImage.PixelBuffer<vImage.PlanarF>(     size: .init(width: 4, height: 1))

let scalar: Pixel_F = 101

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

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

## See Also

### Overwriting with scalar values

- [vImageOverwriteChannelsWithScalar_Planar8(_:_:_:)](accelerate/vimageoverwritechannelswithscalar_planar8(_:_:_:).md)
- [vImageOverwriteChannelsWithScalar_Planar16U(_:_:_:)](accelerate/vimageoverwritechannelswithscalar_planar16u(_:_:_:).md)
- [vImageOverwriteChannelsWithScalar_Planar16S(_:_:_:)](accelerate/vimageoverwritechannelswithscalar_planar16s(_:_:_:).md)
- [vImageOverwriteChannelsWithScalar_Planar16F(_:_:_:)](accelerate/vimageoverwritechannelswithscalar_planar16f(_:_:_:).md)
- [vImageOverwriteChannelsWithScalar_ARGB8888(_:_:_:_:_:)](accelerate/vimageoverwritechannelswithscalar_argb8888(_:_:_:_:_:).md)
- [vImageOverwriteChannelsWithScalar_ARGBFFFF(_:_:_:_:_:)](accelerate/vimageoverwritechannelswithscalar_argbffff(_:_:_:_:_:).md)
