SatDump 2.0.0-alpha-520736c72
Loading...
Searching...
No Matches
satdump::image::TextDrawer Class Reference

Text image drawer, used to draw arbitrary text onto an image. This needs to be its own class as the font needs to be loaded and kept around as a pointer. More...

#include <text.h>

Classes

struct  char_el
struct  font_info

Public Member Functions

void init_font (std::string font_path)
 Init the font.
void init_font ()
 Init with the default font.
bool font_ready ()
 Is the font ready?
int draw_text (Image &img, int xs0, int ys0, std::vector< double > color, int size, std::string text)
 Draw text onto an image.

Protected Attributes

font_info font
bool has_font = false
uint8_t * ttf_buffer

Detailed Description

Text image drawer, used to draw arbitrary text onto an image. This needs to be its own class as the font needs to be loaded and kept around as a pointer.

Member Function Documentation

◆ draw_text()

int satdump::image::TextDrawer::draw_text ( Image & img,
int xs0,
int ys0,
std::vector< double > color,
int size,
std::string text )

Draw text onto an image.

Parameters
imgto draw onto
xs0start X position
ys0start Y position
colorof the text
sizesize/height (in pixels) of the text to draw
textstring the draw
Returns
text length on X axis in pixels

◆ font_ready()

bool satdump::image::TextDrawer::font_ready ( )
inline

Is the font ready?

Returns
true if the font is ready

◆ init_font()

void satdump::image::TextDrawer::init_font ( std::string font_path)

Init the font.

Parameters
font_pathpath to a .ttf file

The documentation for this class was generated from the following files:
  • src-core/image/text.h
  • src-core/image/text.cpp