iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Text Drawing

Methods for drawing text on Images

See Also
Image Drawing

Classes

class  nrt::SimpleFont
 A simple font class. More...
 

Enumerations

enum  nrt::TextAnchor { nrt::TextAnchor::TOP_LEFT, nrt::TextAnchor::TOP_RIGHT, nrt::TextAnchor::BOTTOM_LEFT, nrt::TextAnchor::BOTTOM_RIGHT }
 Where text should be anchored with respect to an anchor point location. More...
 

Functions

template<class T , template< typename > class PixDest, class U = byte, template< typename > class FGColorT = PixRGB, class V = byte, template< typename > class BGColorT = PixRGB>
void nrt::drawText (Image< PixDest< T > > &image, Point2D< int32 > const &pt, std::string const &text, FGColorT< U > const &foreground=FGColorT< U >(255), BGColorT< U > const &background=BGColorT< V >(0), SimpleFont const &font=SimpleFont::FIXED(10), TextAnchor const anchor=TextAnchor::TOP_LEFT, bool transparentBG=false)
 Write some text in an Image using a SimpleFont. More...
 

Enumeration Type Documentation

enum nrt::TextAnchor
strong

Where text should be anchored with respect to an anchor point location.

Enumerator
TOP_LEFT 

Anchor the text by the top-left corner.

TOP_RIGHT 

Anchor the text by the top-right corner.

BOTTOM_LEFT 

Anchor the text by the bottom-left corner.

BOTTOM_RIGHT 

Anchor the text by the bottom-right corner.

Definition at line 54 of file Text.H.

Function Documentation

template<class T , template< typename > class PixDest, class U = byte, template< typename > class FGColorT = PixRGB, class V = byte, template< typename > class BGColorT = PixRGB>
void nrt::drawText ( nrt::Image< PixDest< T > > &  image,
Point2D< int32 > const &  pt,
std::string const &  text,
FGColorT< U > const &  foreground = FGColorT<U>(255),
BGColorT< U > const &  background = BGColorT<V>(0),
nrt::SimpleFont const &  font = SimpleFont::FIXED(10),
nrt::TextAnchor const  anchor = TextAnchor::TOP_LEFT,
bool  transparentBG = false 
)

Write some text in an Image using a SimpleFont.

Parameters
imagethe Image to write into
ptthe anchor point
textthe text string to write
foregroundthe foreground color (can include alpha blending, e.g., using type PixRGBA<T>)
backgroundthe background color (can include alpha blending, e.g., using type PixRGBA<T>)
fontthe font to use (see SimpleFont)
anchorhow to anchor the text string relative to the anchor point pt
transparentBGwhether to use a transparent background instead of the background color
Note
Currently, only ASCII chars 32 .. 126 are supported (see SimpleFont)
Examples:
tests/test-Geometry.C, tests/test-stream.C, and tests/test-UKF.C.

Definition at line 43 of file TextImpl.H.

References nrt::Point< T, Dimensions >::begin(), nrt::BOTTOM_LEFT, nrt::BOTTOM_RIGHT, nrt::SimpleFont::charptr(), nrt::SimpleFont::h(), nrt::TOP_LEFT, nrt::TOP_RIGHT, nrt::SimpleFont::w(), nrt::Point2D< T >::x(), and nrt::Point2D< T >::y().

Referenced by main().