| MIL 10 Reference
| Customize Help
| Save Settings

MbufPutColor



See also
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Put data from a user-supplied array into one or all bands of a data buffer.
Syntax
void MbufPutColor(
MIL_ID DestBufId, //in
MIL_INT64 DataFormat, //in
MIL_INT Band, //in
const void *UserArrayPtr //in
)
Description

This function copies data from a user-supplied array to one or all bands of a specified MIL destination buffer.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
DestBufId

Specifies the identifier of the destination buffer.

If the specified buffer is an image buffer with an associated region of interest (ROI), an error will occur.

DataFormat

Specifies the data format of the user-supplied array. The internal data format of the user-supplied array need not match the data format of the MIL destination buffer (planar); an internal conversion will be performed if necessary. Note, however, if the formats do match, the operation will be much faster.

See the Parameter associations section for possible values that can be specified.

Band

Specifies the index of the band in which to copy. This parameter can be set to one of the values below.

function map For specifying the index of the band
CollapseValue Description
Collapse M_ALL_BANDS

Copies to all bands.

Collapse M_BLUE

Copies to the blue band (for RGB buffers).

Collapse M_GREEN

Copies to the green band (for RGB buffers).

Collapse M_HUE

Copies to the hue band (for HSL buffers).

Collapse M_LUMINANCE

Copies to the luminance band (for HSL buffers).

Collapse M_RED

Copies to the red band (for RGB buffers).

Collapse M_SATURATION

Copies to the saturation band (for HSL buffers).

Collapse 0 <= Value < #bands

Specifies the index of the band to copy.

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

0

Corresponds to the red band for RGB buffers or the hue band for HSL buffers.

1

Corresponds to the green band for RGB buffers or the saturation band for HSL buffers.

2

Corresponds to the blue band for RGB buffers or the luminance band for HSL buffers.

(summarize)
UserArrayPtr
Accepts the address of one of the following (see the Parameter associations section for specifics on which is expected):
  • array of same type as the buffer
  • array of type MIL_UINT8

Specifies the address of the user array from which to copy data into the destination buffer. Ensure that user array is large enough to contain the data to be copied to the destination buffer.

See the Parameter associations section for possible values that can be specified.

The table below lists possible values for the DataFormat and UserArrayPtr parameters.

Note that SizeX and SizeY denote the destination buffer's width and height, respectively.

function map For specifying the data format
CollapseDataFormat Description
UserArrayPtr
Collapse M_PACKED +

Copies the bands in an interleaved manner (for example, RGB RGB RGB...). This format is only valid when the Band parameter is set to M_ALL_BANDS.


You must specify a combination value from the following table:
(summarize)
Collapse UserArrayPtr data type info

Data type: array of type MIL_UINT8
Array size: SizeX x SizeY x n bytes (unsigned char)
Note: For the number of bytes (n), refer to the combination constants For setting the packed data format.

Collapse M_PLANAR

Copies the bands one after the other (RRR...GGG...BBB...). This format is to be used when copying to all bands (M_ALL_BANDS) of the destination buffer.

(summarize)
Collapse UserArrayPtr data type info

Data type: array of same type as the buffer
Array size: SizeX x SizeY x number of band of the destination buffer

Collapse M_SINGLE_BAND

Copies to a single band.

(summarize)
Collapse UserArrayPtr data type info

Data type: array of same type as the buffer
Array size: SizeX x SizeY

Combination constants for M_PACKED.

You must add one of the following values to the above-mentioned value to set the packed data format.

For more information on these formats, see the RGB buffers section of Chapter 19: Data buffers.

function map For setting the packed data format
CollapseDataFormat Description
UserArrayPtr
Collapse M_BGR24

Stores the data in a BGR24 packed format. In this format, each pixel is internally stored as three consecutive bytes.

(summarize)
Collapse UserArrayPtr data type info

Data type: array of type MIL_UINT8
Array size: SizeX x SizeY x 3 bytes (unsigned char)

Collapse M_BGR32

Stores the data in a BGR32 packed format. In this format, each pixel is internally stored as four consecutive bytes. Every fourth byte is a "don't care" byte.

(summarize)
Collapse UserArrayPtr data type info

Data type: array of type MIL_UINT8
Array size: SizeX x SizeY x 4 bytes (unsigned char)

Collapse M_RGB15

Stores the data in a RGB15 packed format. In this format, each pixel is internally stored as a 16-bit word with a 5-bit blue value (least significant), a 5-bit green value, a 5-bit red value, and a "don't care" bit (most significant), in little-endian order (RGB 5:5:5).

(summarize)
Collapse UserArrayPtr data type info

Data type: array of type MIL_UINT8
Array size: SizeX x SizeY x 2 bytes (unsigned char)

Collapse M_RGB16

Stores the data in a RGB16 packed format. In this format, each pixel is internally stored as a 16-bit word with a 5-bit blue value (least significant), a 6-bit green value, and a 5-bit red value (most significant), in little-endian order (RGB 5:6:5).

(summarize)
Collapse UserArrayPtr data type info

Data type: array of type MIL_UINT8
Array size: SizeX x SizeY x 2 bytes (unsigned char)

Collapse M_RGB24

Stores the data in a RGB24 packed format. In this format, each pixel is internally stored as three consecutive bytes.

(summarize)
Collapse UserArrayPtr data type info

Data type: array of type MIL_UINT8
Array size: SizeX x SizeY x 3 bytes (unsigned char)

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
NONE ALL BANDS BLUE GREEN HUE LUMINANCE RED SATURATION PACKED PLANAR SINGLE BAND BGR24 BGR32 RGB15 RGB16 RGB24