Skip to main content

MbufClear

BoardSupported
Host SystemYes
V4L2Yes
Clarity UHDYes
Concord PoENo
GenTLYes
GevIQYes
GigE VisionYes
IndioNo
Iris GTXYes
Radient eV-CLYes
Rapixo CLYes
Rapixo CoFYes
Rapixo CXPYes
USB3 VisionYes

Clears a buffer, or the components of a container, to a specified color.

Syntax

void MbufClear(
AIL_ID DstContainerOrBufId, //out
AIL_DOUBLE Color //in
)

Description

This function clears the specified buffer, or the components of the specified container, to the specified color.

To clear a 16-bit or 32-bit color image buffer to a color value, use MgraClear.

For an image buffer, the clear can be limited to a region of interest (ROI) set using MbufSetRegion.

Using this function with a container is equivalent to using it individually with each component of the container. An error will be generated if the container has a component that cannot be cleared (for example, because it has an ROI defined only in a vector format).

Using this function with a buffer always results in an uncalibrated image. Any previously associated camera calibration context is removed. You can use MgraClear to clear a buffer while preserving the camera calibration context associated with the empty image.

Parameters

DstContainerOrBufId (out, AIL_ID)

Specifies the identifier of the buffer or container to clear. If you specify an image buffer, it can have an ROI set using MbufSetRegion. The ROI must be defined in raster format (M_RASTER or M_VECTOR_AND_RASTER). An error is generated if the ROI is only in vector format (M_VECTOR).

Color (in, AIL_DOUBLE)

Specifies the color value with which to clear the buffer.

For specifying a color value

ValueDescription
M_RGB888Specifies an RGB value used to clear an 8-bit 3-band buffer to an RGB color. Each value (red, green or blue) must not exceed 8 bits.
M_COLOR_BLACKSpecifies the color black.
M_COLOR_BLUESpecifies the color blue.
M_COLOR_BRIGHT_GRAYSpecifies the color bright gray.
M_COLOR_CYANSpecifies the color cyan.
M_COLOR_DARK_BLUESpecifies the color dark blue.
M_COLOR_DARK_CYANSpecifies the color dark cyan.
M_COLOR_DARK_GREENSpecifies the color dark green.
M_COLOR_DARK_MAGENTASpecifies the color dark magenta.
M_COLOR_DARK_REDSpecifies the color dark red.
M_COLOR_DARK_YELLOWSpecifies the color dark yellow.
M_COLOR_GRAYSpecifies the color gray.
M_COLOR_GREENSpecifies the color green.
M_COLOR_LIGHT_BLUESpecifies the color light blue.
M_COLOR_LIGHT_GRAYSpecifies the color light gray.
M_COLOR_LIGHT_GREENSpecifies the color light green.
M_COLOR_LIGHT_WHITESpecifies the color light white.
M_COLOR_MAGENTASpecifies the color magenta.
M_COLOR_REDSpecifies the color red.
M_COLOR_WHITESpecifies the color white.
M_COLOR_YELLOWSpecifies the color yellow.

For specifying a grayscale value to be used with all bands

ValueDescription
ValueSpecifies a grayscale value used to clear the 1-band or multi-band buffer. This value is cast to the buffer type and depth. If the destination buffer is multi-band, this value will be replicated in each band.
Copyright © 2026 Zebra Technologies.