Panda3D
Public Member Functions | Friends | List of all members
PNMTextGlyph Class Reference

A single glyph in a PNMTextMaker. More...

#include "pnmTextGlyph.h"

Public Member Functions

 PNMTextGlyph (double advance)
 
int get_advance () const
 Returns the number of pixels by which the pen should be advanced after rendering this glyph. More...
 
int get_bottom () const
 Returns the y coordinate of the bottommost pixel in the glyph. More...
 
int get_height () const
 Returns the height of the glyph in pixels. More...
 
bool get_interior_flag (int x, int y) const
 Returns true if the indicated pixel represents a pixel in the interior of a hollow font, false otherwise. More...
 
int get_left () const
 Returns the x coordinate of the leftmost pixel in the glyph. More...
 
int get_right () const
 Returns the x coordinate of the rightmost pixel in the glyph. More...
 
int get_top () const
 Returns the y coordinate of the topmost pixel in the glyph. More...
 
double get_value (int x, int y) const
 Returns the value of the indicated pixel of the glyph. More...
 
int get_width () const
 Returns the width of the glyph in pixels. More...
 
void place (PNMImage &dest_image, int xp, int yp, const LColor &fg)
 Copies the glyph to the indicated destination image at the indicated origin. More...
 
void place (PNMImage &dest_image, int xp, int yp, const LColor &fg, const LColor &interior)
 This flavor of place() also fills in the interior color. More...
 

Friends

class PNMTextMaker
 

Detailed Description

A single glyph in a PNMTextMaker.

Definition at line 25 of file pnmTextGlyph.h.

Member Function Documentation

◆ get_advance()

int PNMTextGlyph::get_advance ( ) const
inline

Returns the number of pixels by which the pen should be advanced after rendering this glyph.

Definition at line 19 of file pnmTextGlyph.I.

Referenced by PNMTextMaker::calc_width(), and PNMTextMaker::generate_into().

◆ get_bottom()

int PNMTextGlyph::get_bottom ( ) const
inline

Returns the y coordinate of the bottommost pixel in the glyph.

Definition at line 43 of file pnmTextGlyph.I.

References PNMImageHeader::get_y_size().

◆ get_height()

int PNMTextGlyph::get_height ( ) const
inline

Returns the height of the glyph in pixels.

Definition at line 59 of file pnmTextGlyph.I.

References PNMImageHeader::get_y_size().

◆ get_interior_flag()

bool PNMTextGlyph::get_interior_flag ( int  x,
int  y 
) const
inline

Returns true if the indicated pixel represents a pixel in the interior of a hollow font, false otherwise.

Definition at line 89 of file pnmTextGlyph.I.

◆ get_left()

int PNMTextGlyph::get_left ( ) const
inline

Returns the x coordinate of the leftmost pixel in the glyph.

Definition at line 27 of file pnmTextGlyph.I.

◆ get_right()

int PNMTextGlyph::get_right ( ) const
inline

Returns the x coordinate of the rightmost pixel in the glyph.

Definition at line 35 of file pnmTextGlyph.I.

◆ get_top()

int PNMTextGlyph::get_top ( ) const
inline

Returns the y coordinate of the topmost pixel in the glyph.

Definition at line 51 of file pnmTextGlyph.I.

◆ get_value()

double PNMTextGlyph::get_value ( int  x,
int  y 
) const
inline

Returns the value of the indicated pixel of the glyph.

The result is in the range [0, 1], where 0 indicates the pixel is not part of the glyph, and 1 indicates it is. Intermediate values are used to represent antialiasing.

Definition at line 77 of file pnmTextGlyph.I.

◆ get_width()

int PNMTextGlyph::get_width ( ) const
inline

Returns the width of the glyph in pixels.

Definition at line 67 of file pnmTextGlyph.I.

References PNMImageHeader::get_x_size().

◆ place() [1/2]

void PNMTextGlyph::place ( PNMImage dest_image,
int  xp,
int  yp,
const LColor &  fg 
)

Copies the glyph to the indicated destination image at the indicated origin.

It colors the glyph pixels the indicated foreground color, blends antialiased pixels with the appropriate amount of the foreground color and the existing background color, and leaves other pixels alone.

Definition at line 46 of file pnmTextGlyph.cxx.

References PNMImage::is_valid().

Referenced by PNMTextMaker::generate_into().

◆ place() [2/2]

void PNMTextGlyph::place ( PNMImage dest_image,
int  xp,
int  yp,
const LColor &  fg,
const LColor &  interior 
)

This flavor of place() also fills in the interior color.

This requires that determine_interior was called earlier.

Definition at line 84 of file pnmTextGlyph.cxx.

References PNMImage::is_valid().


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