IC Imaging Control C++

OverlayBitmap::getFont Method

OverlayBitmap::getFont Method

Retrieves a pointer to an IFont COM font object pointer.
Syntax:
IFont* getFont() const;
Return value:

A pointer to an IFont COM font object pointer.

Remarks:

An IFont COM font object is an object wrapper around a Windows font object. For more information about the IFont COM font please refer to the MSDN Library.

Important: The IFont COM object pointer retrieved by getFont() must be stored in a local IFont pointer variable. For example, getFont()->put_Underline(TRUE) is not allowed.

If the IFont interface is not used anymore, the IFont::Release() method must be called to avoid memory leaks.

Sample:

This example demonstrates how to draw underlined, bold text.

smart_ptr<DShowLib::OverlayBitmap> pOverlayBitmap;
IFont *piFont = NULL;
 
pOverlayBitmap = m_Grabber.getOverlay();
 
// Make sure, the overlay bitmap is enabled.
pOverlayBitmap->setEnable(true);
 
// Set a font.
pOverlayBitmap->setFont("Arial",20);
 
// Retrieve the IFont interface pointer.
piFont = pOverlayBitmap->getFont();
 
piFont->put_Underline( TRUE );
piFont->put_Bold( TRUE );
 
// If the retrieved IFont interface is no longer used,
// Release() must be called.
piFont->Release();
 
// Now, draw the text.
pOverlayBitmap->drawText( RGB(255,0,0),  5, 0, "Underlined text" );
See also: OverlayBitmap, OverlayBitmap::getFont, OverlayBitmap::drawText

<< OverlayBitmap

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us