OverlayBitmap::setColorMode Method

Set the color mode of this OverlayBitmap. The color mode determines, whether the overlay bitmap is painted in color or grayscale. The images provided by the video capture device are converted into the selected format before drawing the overlay.
Syntax:
bool setColorMode( tOVBColorMode newMode );
Parameter Description
newMode

Specifies the new color mode. Possible values are members of OverlayBitmap::tOVBColorMode:

Value Description
eCOLOR Forces the overlay bitmap to operate in color mode. If the source frame type (video format or output of a filter) is a grayscale format, the images are converted into a colored format (e.g. RGB24), so that colored texts and lines can be drawn on image data.
eGRAYSCALE Forces the overlay bitmap to operate in grayscale mode. If the source frame type (video format or output of a filter) is a color format, the images are converted into a grayscale format (e.g. Y800). If colored lines or texts are drawn onto the overlay bitmap, their color will be converted to the nearest matching color of the gray image.
eBESTFIT This mode lets the overlay bitmap accept colored and grayscale images. It will select the mode at which preferably no color format conversions are necessary. Call OverlayBitmap::getColorformat to find out which format was actually chosen after live mode has been prepared or started. When drawing lines or texts onto the overlay bitmap, the drawing color is converted to its nearest equivalent in the actually used format.

Return value:

Value Description
true The color mode was set successfully.
false The color mode could not be set.

Remarks:

The color mode can only be changed, if the Grabber which owns this OverlayBitmap is not in live or prepared mode.

Information:

Introduced in version 3.0

Example:

The following example shows how to enable the overlay bitmap for the display path and force it to color mode:

// Check whether the OverlayBitmap object can be inserted in front of the
// display.
if( !m_Grabber.setOverlayBitmapPathPosition(ePP_DISPLAY) )
{
    MessageBox( m_Grabber.getLastError().toStringW().c_str(),L"Error",MB_ICONERROR);
}
else
{
    smart_ptr<DShowLib::OverlayBitmap> pOverlayBitmap;
    pOverlayBitmap = m_Grabber.getOverlay(ePP_DISPLAY);
    // Set the color mode to grayscale.
    pOverlayBitmap->setColorMode( OverlayBitmap::eCOLOR );
}

After this initialization, colored drawings can be placed onto the live display. The original, grayscale image data is sent to the sink in its original form.

See also: OverlayBitmap, OverlayBitmap::getColorMode, OverlayBitmap::tOVBColorMode, OverlayBitmap::getColorformat

<< OverlayBitmap