This class implements a standard font similar to a code-block like font.
More...
|
class | Character |
| This class implements one character of a font for which each pixel has as size of at most 16x16. More...
|
|
|
bool | drawText (Frame &frame, const std::string &text, const int left, const int top, const uint8_t *foregroundColor, const uint8_t *backgroundColor=nullptr) const |
| Paints a given text into a given frame using this font. More...
|
|
bool | textExtent (const std::string &text, unsigned int &width, unsigned int &height) const |
| Returns the bounding box a given text will occupy in pixel space when using this font. More...
|
|
|
static Font & | get () |
| Returns a reference to the unique object. More...
|
|
This class implements a standard font similar to a code-block like font.
◆ Characters
Definition of a vector holding characters.
◆ Font()
Ocean::CV::Canvas::Font::Font |
( |
| ) |
|
|
protected |
The protected constructor creating a new font.
◆ drawText()
bool Ocean::CV::Canvas::Font::drawText |
( |
Frame & |
frame, |
|
|
const std::string & |
text, |
|
|
const int |
left, |
|
|
const int |
top, |
|
|
const uint8_t * |
foregroundColor, |
|
|
const uint8_t * |
backgroundColor = nullptr |
|
) |
| const |
Paints a given text into a given frame using this font.
The given location can be partially outside of the frame.
- Parameters
-
frame | The frame in which the text will be painted, must have a generic pixel format like e.g., FORMAT_Y8 or FORMAT_RGB24, must be valid |
text | The text to be painted, the text can contain end-of-line characters to paint the remaining the following characters in the next line, can be empty |
left | The horizontal start position of the text within the frame, in pixel, with range (-infinity, infinity) |
top | The vertical start position of the text within the frame, in pixel, with range (-infinity, infinity) |
foregroundColor | The foreground color to be used when painting the character, must be valid |
backgroundColor | The optional background color to be used when paining the character, nullptr to paint the foreground pixels only |
- Returns
- True, if succeeded
◆ textExtent()
bool Ocean::CV::Canvas::Font::textExtent |
( |
const std::string & |
text, |
|
|
unsigned int & |
width, |
|
|
unsigned int & |
height |
|
) |
| const |
Returns the bounding box a given text will occupy in pixel space when using this font.
- Parameters
-
text | The text for which the extent will be determined, can be empty |
width | The width of the bounding box, in pixel, with range [0, infinity) |
height | The height of the bounding box, in pixel, with range [0, infinity) |
- Returns
- True, if succeeded
◆ Singleton< Font >
◆ characters_
The characters of this font.
The documentation for this class was generated from the following file: