Skip to main content

MbufTransfer

BoardSupported
Host SystemPartial
V4L2Partial
Clarity UHDPartial
Concord PoENo
GenTLPartial
GevIQPartial
GigE VisionPartial
IndioNo
Iris GTXPartial
Radient eV-CLPartial
Rapixo CLPartial
Rapixo CoFPartial
Rapixo CXPPartial
USB3 VisionPartial

Copy a two-dimensional region of one or all bands from the source buffer into a two-dimensional region of one or all bands in the destination buffer, using a specified transfer function and transfer type.

Syntax

void MbufTransfer(
AIL_ID SrcBufId, //in
AIL_ID DestBufId, //out
AIL_INT SrcOffX, //in
AIL_INT SrcOffY, //in
AIL_INT SrcSizeX, //in
AIL_INT SrcSizeY, //in
AIL_INT SrcBand, //in
AIL_INT DestOffX, //in
AIL_INT DestOffY, //in
AIL_INT DestSizeX, //in
AIL_INT DestSizeY, //in
AIL_INT DestBand, //in
AIL_INT64 TransferFunction, //in
AIL_INT64 TransferType, //in
AIL_INT64 OperationFlag, //in
void * ExtraParameterPtr //in
)

Description

This function copies a two-dimensional region of one or all bands of the source buffer to a two-dimensional region of one or all bands of the destination buffer, using a specified transfer function and transfer type.

If the size of the regions in the source and destination buffers differ, the size of the largest region is reduced so that the size of the source and destination regions become equal.

Parameters

SrcBufId (in, AIL_ID)

Specifies the identifier of the source buffer. When the TransferFunction parameter is set to M_CLEAR, you must set this parameter to M_NULL; when the TransferFunction parameter is set to M_BYTE_SWAP, you can set this parameter to M_NULL to swap bytes within the same buffer.

DestBufId (out, AIL_ID)

Specifies the identifier of the destination buffer.

SrcOffX (in, AIL_INT)

Specifies the horizontal offset of the source region, relative to the top-left coordinate of the source buffer.

For the horizontal offset of the source region

ValueDescription
M_DEFAULT
M_NULLSpecifies that the horizontal offset of the source region is ignored when the TransferFunction parameter is set to M_CLEAR.
Value (default)Specifies the horizontal offset of the source region, in pixels.

SrcOffY (in, AIL_INT)

Specifies the vertical offset of the source region, relative to the top-left coordinate of the source buffer.

For the vertical offset of the source region

ValueDescription
M_DEFAULT
M_NULLSpecifies that the vertical offset of the source region is ignored when the TransferFunction parameter is set to M_CLEAR.
Value (default)Specifies the vertical offset of the source region, in pixels.

SrcSizeX (in, AIL_INT)

Specifies the width of the source region.

For the width of the source region

ValueDescription
M_DEFAULTSpecifies the default width of the source region. The default is equal to the difference between the width of the source buffer and the horizontal offset of the source region.
M_NULLSpecifies that the width of the source region is ignored when the TransferFunction parameter is set to M_CLEAR.
ValueSpecifies the width of the source region, in pixels.

SrcSizeY (in, AIL_INT)

Specifies the height of the source region.

For the height of the source region

ValueDescription
M_DEFAULT (default)Specifies the default height of the source region. The default is equal to the difference between the height of the source buffer and the vertical offset of the source region.
M_NULLSpecifies that the height of the source region is ignored when the TransferFunction parameter is set to M_CLEAR.
ValueSpecifies the height of the source region, in pixels.

SrcBand (in, AIL_INT)

Specifies the band of the region from which to copy. This parameter can be set to one of the following values:

For the band of the region from which to copy

ValueDescription
M_DEFAULT (default)Same as M_ALL_BANDS.
M_NULLSpecifies that the band of the source region is ignored when the TransferFunction parameter is set to M_CLEAR.
M_ALL_BANDSSpecifies all bands (for multi-band buffers).
M_BLUESpecifies the blue band (for RGB buffers).
M_GREENSpecifies the green band (for RGB buffers).
M_HUESpecifies the hue band (for HSL buffers).
M_LUMINANCESpecifies the luminance band (for HSL buffers).
M_REDSpecifies the red band (for RGB buffers).
M_SATURATIONSpecifies the saturation band (for HSL buffers).
M_USpecifies the U band (for YUV buffers).
M_VSpecifies the V band (for YUV buffers).
M_YSpecifies the Y band (for YUV buffers).
0 <= Value < #bandsSpecifies the index of the band to copy.

The relationship between the index value and band for RGB and HSL buffers is the following:

0Corresponds to the red band for RGB buffers or the hue band for HSL buffers.
1Corresponds to the green band for RGB buffers or the saturation band for HSL buffers.
2Corresponds to the blue band for RGB buffers or the luminance band for HSL buffers.

DestOffX (in, AIL_INT)

Specifies the horizontal offset of the destination region, relative to the top-left coordinate of the destination buffer.

For the horizontal offset of the destination region

ValueDescription
M_DEFAULT (default)Specifies the default horizontal offset of the destination region. The default is equal to the horizontal offset of the source region.
ValueSpecifies the horizontal offset of the destination region, in pixels.

DestOffY (in, AIL_INT)

Specifies the vertical offset of the destination region, relative to the top-left coordinate of the destination buffer.

For the vertical offset of the destination region

ValueDescription
M_DEFAULT (default)Specifies the default vertical offset of the destination region. The default is equal to the vertical offset of the source region.
ValueSpecifies the value of the vertical offset of the destination region, in pixels.

DestSizeX (in, AIL_INT)

Specifies the width of the destination region.

For the width of the destination region

ValueDescription
M_DEFAULT (default)Specifies the default width of the destination region. The default is equal to the difference between the destination buffer width and the horizontal offset of the destination region.
ValueSpecifies the width of the destination region, in pixels.

DestSizeY (in, AIL_INT)

Specifies the height of the destination region.

For the height of the destination region

ValueDescription
M_DEFAULT (default)Specifies the default height of the destination region. The default is equal to the difference between the destination buffer height and the vertical offset of the destination region.
ValueSpecifies the height of the destination region, in pixels.

DestBand (in, AIL_INT)

Specifies the band of the destination region in which to copy.

For the band of the region in which to copy

ValueDescription
M_DEFAULT (default)Same as M_ALL_BANDS.
M_ALL_BANDSSpecifies all bands (for multi-band buffers).
M_BLUESpecifies the blue band (for RGB buffers).
M_GREENSpecifies the green band (for RGB buffers).
M_HUESpecifies the hue band (for HSL buffers).
M_LUMINANCESpecifies the luminance band (for HSL buffers).
M_REDSpecifies the red band (for RGB buffers).
M_SATURATIONSpecifies the saturation band (for HSL buffers).
M_USpecifies the U band (for YUV buffers).
M_VSpecifies the V band (for YUV buffers).
M_YSpecifies the Y band (for YUV buffers).
0 <= Value < #bandsSpecifies the index of the band in which to copy.

The relationship between the index value and band for RGB and HSL buffers is the following:

0Corresponds to the red band for RGB buffers or the hue band for HSL buffers.
1Corresponds to the green band for RGB buffers or the saturation band for HSL buffers.
2Corresponds to the blue band for RGB buffers or the luminance band for HSL buffers.

TransferFunction (in, AIL_INT64)

Specifies the function to use in the transfer. This parameter can be set to one of the following:

For specifying the function to use in the transfer

ValueDescription
M_BYTE_SWAPSpecifies a transfer function that extracts the bytes in each pixel of the source region, swaps them, and copies the new pixels into the destination region.

Note that M_BYTE_SWAP is only supported when the source and destination buffers are both either 1-band 16-bit buffers or 1-band 32-bit buffers and have the same internal storage specifiers.

When using 16-bit buffers, the first byte is swapped with the last byte. When using 32-bit buffers, the first byte is swapped with the last byte and the two middle bytes are swapped.

You can swap bytes within the same buffer. To do so, set the SrcBufId parameter to M_NULL. | | M_CLEAR | Specifies a transfer function that clears the destination region. Set all source buffer parameters to M_NULL. | | M_COMPOSITION | Specifies a transfer function that copies all pixels, except for pixels in the source region that are equal to the composition color specified by the OperationFlag parameter. | | M_COPY | Specifies a transfer function that copies the data from the source region into the destination region. If the source and destination buffers are of different data types, Aurora Imaging Library converts the data automatically. When copying from a floating-point buffer to an integer buffer, the values are truncated.

If the source is a 3-band region of a YUV buffer and the destination is a 1-band region, only the Y band (luminance) is copied. If the source is a 3-band region of an RGB buffer and the destination is a 1-band region, only the red band is copied. If both regions are multi-band, each source band is copied to the corresponding band of the destination.

Note that when copying from a non-binary buffer to a binary destination buffer, all non-zero pixels in the source buffer are represented as ones (1) in the binary destination buffer. When copying a binary buffer to a buffer of a different depth, each bit is copied into the least-significant bit of a different destination pixel using the specified transfer function. The remaining bits of the destination pixel are set to 0; to propagate the bit value to all bits, use MimBinarize. |

For specifying the scale of

ValueDescription
M_SCALESpecifies that the data of the source region must be scaled to fit in the destination region.

TransferType (in, AIL_INT64)

Specifies the type of transfer. If M_DEFAULT is not selected, then any combination of the transfer modes listed below can be specified for the TransferType parameter. From this combination of transfer modes, Aurora Imaging Library selects the most efficient mode to transfer data. If the most efficient transfer mode fails, then Aurora Imaging Library automatically selects the next most efficient transfer mode from the combination of transfer modes. If all selected transfer modes fail, an error is returned. The efficiency of the transfer mode depends on the internal format of the source and destination buffers, as well as the hardware available in your computer.

For specifying the type of transfer

ValueDescription
M_DEFAULT (default)Transfers data using the most efficient transfer mode among the transfer modes listed.
M_AIL_MODETransfers data using the standard Aurora Imaging Library mode.

This transfer mode is always possible. | | M_DIB_MODE | Transfers data using the DIB interface. Both the source and destination buffers must have theM_DIB attribute.

This transfer mode is only possible when the TransferFunction parameter is set to M_COPY. |

For specifying synchronous data transfer

ValueDescription
M_SYNCHRONOUSSpecifies that the transfer of data is synchronous.

OperationFlag (in, AIL_INT64)

Specifies the color value that is passed to the transfer function. If the TransferFunction parameter is set to M_COPY or M_BYTE_SWAP, this parameter must be set to M_NULL.

For specifying a color value

ValueDescription
M_RGB888Specifies an RGB value. Specify an RGB value when the source buffer is a 3-band buffer.
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.

ExtraParameterPtr *(in, void)

Specifies a pointer to the Aurora Imaging Library identifier of the overlay buffer, if applicable. Set this parameter to M_NULL in all other cases.

Copyright © 2026 Zebra Technologies.