MbufGetColor2d()函数

Synopsis

Get data from a region of one or all bands of a buffer and place it in a user-supplied array.

Format

void MbufGetColor2d(SrcBufId, DataFormat, Band, OffX, OffY, SizeX, SizeY, UserArrayPtr)

MIL_ID SrcBufId; Source buffer identifier
long DataFormat; Data format
long Band; Color band of source buffer
long OffX; X pixel offset relative to the source buffer
long OffY; Y pixel offset relative to the source buffer
long SizeX; Source buffer region width
long SizeY; Source buffer region height
void *UserArrayPtr; Destination user array

Description

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

The SrcBufId parameter specifies the identifier of the source buffer.

The DataFormat parameter specifies the data format to use when copying the data. Note that Sx and Sy denote the source width and height, respectively. This parameter must be set to one of the following values:

DataFormat Description
M_SINGLE_BAND Copy a single color band. The user array must be of the same type as the source buffer and have a size of Sx x Sy.
M_RGB24+M_PACKED Copy three bands in an interleaved manner (RGBRGB). The source buffer must be a three-band, 8-bit buffer and the user array must have a size of Sx x Sy x 3 bytes (Sx x Sy x 3 char).
M_RGB32+M_PACKED Copy three bands in an interleaved manner (RGBXRGBX). The source buffer must be a three-band, 8-bit buffer and the user array must have a size of Sx x Sy x 4 bytes (Sx x Sy x long).
M_PLANAR Copy the bands one after the other (RRR…GGG…BBB…). The user array must be the same type as the source buffer and have a size of Sx x Sy x number of color band of the source buffer. This format is to be used when copying all color bands of the source buffer.

The Band parameter specifies the index of the color band to copy. This parameter can be set to any index from 0 to n-1 (number of bands of the source buffer – 1), or to one of the following values:

M_RED Copy from the red color band.
M_GREEN Copy from the green color band.
M_BLUE Copy from the blue color band.
M_ALL_BAND Copy from all color bands.

Note, M_ALL_BAND is to be used with data formats M_RGB24+M_PACKED, M_RGB32+M_PACKED, and M_PLANAR.

If the source buffer is in a HLS (hue, luminance, and saturation) format, the band can be set to: M_HUE, M_LUMINANCE, M_SATURATION, or M_ALL_BAND.

The OffX and OffY parameters specify, respectively, the horizontal and vertical pixel offset (in relation to the top-left source buffer coordinate) of the source buffer region in which to get the data.

The SizeX and SizeY parameters specify, respectively, the width and height of the source buffer region in which to get the data.

The UserArrayPtr parameter specifies the address of the user array in which to copy the data. Ensure that there are enough entries in the user array to receive the data of the specified source buffer region.

See also

MbufGet, MbufGet1d, MbufGet2d, MbufPut, MbufPut1d, MbufPut2d, MbufPutColor, MbufPutColor2d