Jetson Inference
DNN Vision Library
cudaFont Class Reference

TTF font rasterization and image overlay rendering using CUDA. More...

#include <cudaFont.h>

Classes

struct  GlyphInfo
 

Public Member Functions

 ~cudaFont ()
 Destructor. More...
 
bool OverlayText (float4 *image, uint32_t width, uint32_t height, const char *str, int x, int y, const float4 &color=make_float4(0, 0, 0, 255), const float4 &background=make_float4(0, 0, 0, 0), int backgroundPadding=5)
 Render text overlay onto image. More...
 
bool OverlayText (float4 *image, uint32_t width, uint32_t height, const std::vector< std::pair< std::string, int2 > > &text, const float4 &color=make_float4(0, 0, 0, 255), const float4 &background=make_float4(0, 0, 0, 0), int backgroundPadding=5)
 Render text overlay onto image. More...
 

Static Public Member Functions

static cudaFontCreate (float size=32.0f)
 Create new CUDA font overlay object using baked fonts. More...
 
static cudaFontCreate (const char *font, float size)
 Create new CUDA font overlay object using baked fonts. More...
 
static cudaFontCreate (const std::vector< std::string > &fonts, float size)
 Create new CUDA font overlay object using baked fonts. More...
 

Protected Member Functions

 cudaFont ()
 
bool init (const char *font, float size)
 

Protected Attributes

uint8_t * mFontMapCPU
 
uint8_t * mFontMapGPU
 
int mFontMapWidth
 
int mFontMapHeight
 
void * mCommandCPU
 
void * mCommandGPU
 
int mCmdIndex
 
float4 * mRectsCPU
 
float4 * mRectsGPU
 
int mRectIndex
 
struct cudaFont::GlyphInfo mGlyphInfo [NumGlyphs]
 

Static Protected Attributes

static const uint32_t MaxCommands = 1024
 
static const uint32_t FirstGlyph = 32
 
static const uint32_t LastGlyph = 255
 
static const uint32_t NumGlyphs = LastGlyph - FirstGlyph
 

Detailed Description

TTF font rasterization and image overlay rendering using CUDA.

Constructor & Destructor Documentation

◆ ~cudaFont()

cudaFont::~cudaFont ( )

Destructor.

◆ cudaFont()

cudaFont::cudaFont ( )
protected

Member Function Documentation

◆ Create() [1/3]

static cudaFont* cudaFont::Create ( float  size = 32.0f)
static

Create new CUDA font overlay object using baked fonts.

Parameters
sizeThe desired height of the font, in pixels.

◆ Create() [2/3]

static cudaFont* cudaFont::Create ( const char *  font,
float  size 
)
static

Create new CUDA font overlay object using baked fonts.

Parameters
fontThe name of the TTF font to use.
sizeThe desired height of the font, in pixels.

◆ Create() [3/3]

static cudaFont* cudaFont::Create ( const std::vector< std::string > &  fonts,
float  size 
)
static

Create new CUDA font overlay object using baked fonts.

Parameters
fontA list of font names that are acceptable to use. If the first font isn't found on the system, then the next font from the list will be tried.
sizeThe desired height of the font, in pixels.

◆ init()

bool cudaFont::init ( const char *  font,
float  size 
)
protected

◆ OverlayText() [1/2]

bool cudaFont::OverlayText ( float4 *  image,
uint32_t  width,
uint32_t  height,
const char *  str,
int  x,
int  y,
const float4 &  color = make_float4(0, 0, 0, 255),
const float4 &  background = make_float4(0, 0, 0, 0),
int  backgroundPadding = 5 
)

Render text overlay onto image.

◆ OverlayText() [2/2]

bool cudaFont::OverlayText ( float4 *  image,
uint32_t  width,
uint32_t  height,
const std::vector< std::pair< std::string, int2 > > &  text,
const float4 &  color = make_float4(0, 0, 0, 255),
const float4 &  background = make_float4(0, 0, 0, 0),
int  backgroundPadding = 5 
)

Render text overlay onto image.

Member Data Documentation

◆ FirstGlyph

const uint32_t cudaFont::FirstGlyph = 32
staticprotected

◆ LastGlyph

const uint32_t cudaFont::LastGlyph = 255
staticprotected

◆ MaxCommands

const uint32_t cudaFont::MaxCommands = 1024
staticprotected

◆ mCmdIndex

int cudaFont::mCmdIndex
protected

◆ mCommandCPU

void* cudaFont::mCommandCPU
protected

◆ mCommandGPU

void* cudaFont::mCommandGPU
protected

◆ mFontMapCPU

uint8_t* cudaFont::mFontMapCPU
protected

◆ mFontMapGPU

uint8_t* cudaFont::mFontMapGPU
protected

◆ mFontMapHeight

int cudaFont::mFontMapHeight
protected

◆ mFontMapWidth

int cudaFont::mFontMapWidth
protected

◆ mGlyphInfo

struct cudaFont::GlyphInfo cudaFont::mGlyphInfo[NumGlyphs]
protected

◆ mRectIndex

int cudaFont::mRectIndex
protected

◆ mRectsCPU

float4* cudaFont::mRectsCPU
protected

◆ mRectsGPU

float4* cudaFont::mRectsGPU
protected

◆ NumGlyphs

const uint32_t cudaFont::NumGlyphs = LastGlyph - FirstGlyph
staticprotected

The documentation for this class was generated from the following file: