Copy one or all bands of an image buffer.
void MbufCopyColor(SrcBufId, DestBufId, Band)
|MIL_ID SrcBufId;||Source buffer identifier|
|MIL_ID DestBufId;||Destination buffer identifier|
|long Band;||Index of the color band to copy|
This function copies one or all color bands of the specified source buffer to the specified destination buffer. It can also be used to insert or extract a color component from a color image.
The SrcBufId and DestBufId parameters specify the identifiers of the source and destination data buffers.
The Band parameter specifies the index of the color band to copy. This parameter can be set to any index from 0 to (number of bands of the buffer – 1), or to one of the following:
|M_RED||Copy to/from the red color band.|
|M_GREEN||Copy to/from the green color band.|
|M_BLUE||Copy to/from the blue color band.|
|M_ALL_BAND||Copy all color bands.|
The Band parameter gives the index of the color band to extract or insert. If the source is a monochrome buffer and the destination is a multi-band (color) buffer, the unique source buffer band is inserted into the specified band of the destination buffer. If the source is a multi-band buffer and the destination is a monochrome buffer, the specified source buffer band is extracted from the source buffer and written to the destination buffer. If both are multi-band buffers, the specified band(s) is copied from the source to the destination.
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.
If the source buffer depth is greater than that of the destination, the most significant bits are truncated when the data is copied to the destination. If the destination depth is greater than that of the source, the source data is zero or sign-extended (depending on the type of the source) when copied to the destination. Also, the buffers must have the same number of bands if all bands are to be copied.
Note, when copying from a non-binary buffer to a binary buffer, all non-zero pixels in the source buffer are represented as ones (1) in the binary buffer.