Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub | SourceForge

The Font class provides text drawing. More...

Public Types

typedef std::string String
 
typedef Simd::Point< ptrdiff_t > Point
 
typedef Simd::View< Simd::AllocatorView
 

Public Member Functions

 Font (size_t height=16)
 
bool Resize (size_t height)
 
size_t Height () const
 
Point Measure (const String &text) const
 
template<class Color >
bool Draw (View &canvas, const String &text, const Point &position, const Color &color) const
 
template<class Color >
bool Draw (View &canvas, const String &text, const View::Position &position, const Color &color) const
 
template<class Color >
bool Draw (View &canvas, const String &text, const View::Position &position, const Color &color, const Color &background) const
 

Detailed Description

The Font class provides text drawing.

Member Typedef Documentation

◆ String

typedef std::string String

String type definition.

◆ Point

typedef Simd::Point<ptrdiff_t> Point

Point type definition.

◆ View

Image time definition.

Constructor & Destructor Documentation

◆ Font()

Font ( size_t  height = 16)

Creates a new Font class with given height.

Note
The font is generated on the base of the generic monospace font from Gdiplus.
Parameters
[in]height- initial height value. By default it is equal to 16.

Member Function Documentation

◆ Resize()

bool Resize ( size_t  height)

Sets a new height value to font.

Parameters
[in]height- a new height value.
Returns
a result of the operation.

◆ Height()

size_t Height ( ) const

Gets height of the font.

Returns
current height of the font.

◆ Measure()

Point Measure ( const String text) const

Measures a size of region is need to draw given text.

Parameters
[in]text- a text to draw.
Returns
measured size.

◆ Draw() [1/3]

bool Draw ( View canvas,
const String text,
const Point position,
const Color &  color 
) const

Draws a text at the image.

Parameters
[out]canvas- a canvas (image where we draw text).
[in]text- a text to draw.
[in]position- a start position to draw text.
[in]color- a color of the text.
Returns
a result of the operation.

◆ Draw() [2/3]

bool Draw ( View canvas,
const String text,
const View::Position position,
const Color &  color 
) const

Draws a text at the image.

Parameters
[out]canvas- a canvas (image where we draw text).
[in]text- a text to draw.
[in]position- a position to draw text (see Simd::View::Position).
[in]color- a color of the text.
Returns
a result of the operation.

◆ Draw() [3/3]

bool Draw ( View canvas,
const String text,
const View::Position position,
const Color &  color,
const Color &  background 
) const

Draws a text at the image. Fills the text background by given color.

Parameters
[out]canvas- a canvas (image where we draw text).
[in]text- a text to draw.
[in]position- a position to draw text (see Simd::View::Position).
[in]color- a color of the text.
[in]background- background color.
Returns
a result of the operation.