Synopsis
Get data from one or all bands of a buffer and place it in a user-supplied array.
Format
void MbufGetColor(SrcBufId, DataFormat, Band, UserArrayPtr)
MIL_ID SrcBufId; | Source buffer identifier |
long DataFormat; | Data format |
long Band; | Color band of source buffer |
void *UserArrayPtr; | Destination user array |
Description
This function copies data from 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. 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, where Sx and Sy denote the source width and height, respectively. |
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), where Sx and Sy denote the source width and height, respectively. |
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), where Sx and Sy denote the source width and height, respectively. |
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, where Sx and Sy denote the source width and height, respectively. This format is to be used when copying from 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 UserArrayPtr parameter specifies the address of the user array in which to copy data from the source buffer. Ensure that the user array is large enough to accommodate the data from the source buffer in the format specified.
See also
MbufGet, MbufGet1d, MbufGet2d, MbufPut, MbufPut1d, MbufPut2d, MbufPutColor
《MbufGetColor()函数》上有6条评论
评论已关闭。