Panda3D
Loading...
Searching...
No Matches
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.
 
int get_bottom () const
 Returns the y coordinate of the bottommost pixel in the glyph.
 
int get_height () const
 Returns the height of the glyph in pixels.
 
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.
 
int get_left () const
 Returns the x coordinate of the leftmost pixel in the glyph.
 
int get_right () const
 Returns the x coordinate of the rightmost pixel in the glyph.
 
int get_top () const
 Returns the y coordinate of the topmost pixel in the glyph.
 
double get_value (int x, int y) const
 Returns the value of the indicated pixel of the glyph.
 
int get_width () const
 Returns the width of the glyph in pixels.
 
void place (PNMImage &dest_image, int xp, int yp, const LColor &fg)
 Copies the glyph to the indicated destination image at the indicated origin.
 
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.
 

Friends

class PNMTextMaker
 

Detailed Description

A single glyph in a PNMTextMaker.

Definition at line 25 of file pnmTextGlyph.h.

Constructor & Destructor Documentation

◆ PNMTextGlyph()

PNMTextGlyph::PNMTextGlyph ( double advance)
explicit

Definition at line 23 of file pnmTextGlyph.cxx.

◆ ~PNMTextGlyph()

PNMTextGlyph::~PNMTextGlyph ( )

Definition at line 35 of file pnmTextGlyph.cxx.

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 18 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 42 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 58 of file pnmTextGlyph.I.

References PNMImageHeader::get_y_size().

Referenced by get_interior_flag(), and get_value().

◆ 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 88 of file pnmTextGlyph.I.

References get_height(), PNMImage::get_red_val(), and get_width().

Referenced by place().

◆ get_left()

int PNMTextGlyph::get_left ( ) const
inline

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

Definition at line 26 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 34 of file pnmTextGlyph.I.

References PNMImageHeader::get_x_size().

◆ get_top()

int PNMTextGlyph::get_top ( ) const
inline

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

Definition at line 50 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 76 of file pnmTextGlyph.I.

References PNMImage::get_blue(), get_height(), and get_width().

Referenced by place(), and place().

◆ get_width()

int PNMTextGlyph::get_width ( ) const
inline

Returns the width of the glyph in pixels.

Definition at line 66 of file pnmTextGlyph.I.

References PNMImageHeader::get_x_size().

Referenced by get_interior_flag(), and get_value().

◆ 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 45 of file pnmTextGlyph.cxx.

References get_value(), PNMImageHeader::get_x_size(), PNMImage::get_xel_a(), PNMImageHeader::get_y_size(), PNMImage::is_valid(), and PNMImage::set_xel_a().

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 83 of file pnmTextGlyph.cxx.

References get_interior_flag(), get_value(), PNMImageHeader::get_x_size(), PNMImage::get_xel_a(), PNMImageHeader::get_y_size(), PNMImage::is_valid(), and PNMImage::set_xel_a().

Friends And Related Symbol Documentation

◆ PNMTextMaker

friend class PNMTextMaker
friend

Definition at line 60 of file pnmTextGlyph.h.


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