Panda3D
Public Member Functions | Friends
PNMTextGlyph Class Reference

A single glyph in a PNMTextMaker. More...

#include "pnmTextGlyph.h"

List of all members.

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 27 of file pnmTextGlyph.h.


Member Function Documentation

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

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

int PNMTextGlyph::get_bottom ( ) const [inline]

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

Definition at line 56 of file pnmTextGlyph.I.

References PNMImageHeader::get_y_size().

int PNMTextGlyph::get_height ( ) const [inline]

Returns the height of the glyph in pixels.

Definition at line 77 of file pnmTextGlyph.I.

References PNMImageHeader::get_y_size().

Referenced by get_interior_flag(), and get_value().

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

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

Referenced by place().

int PNMTextGlyph::get_left ( ) const [inline]

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

Definition at line 34 of file pnmTextGlyph.I.

int PNMTextGlyph::get_right ( ) const [inline]

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

Definition at line 45 of file pnmTextGlyph.I.

References PNMImageHeader::get_x_size().

int PNMTextGlyph::get_top ( ) const [inline]

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

Definition at line 67 of file pnmTextGlyph.I.

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

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

Referenced by place().

int PNMTextGlyph::get_width ( ) const [inline]

Returns the width of the glyph in pixels.

Definition at line 87 of file pnmTextGlyph.I.

References PNMImageHeader::get_x_size().

Referenced by get_interior_flag(), and get_value().

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

References PNMImage::get_alpha(), get_value(), PNMImageHeader::get_x_size(), PNMImage::get_xel(), PNMImageHeader::get_y_size(), PNMImageHeader::has_alpha(), PNMImage::is_valid(), PNMImage::set_alpha(), and PNMImage::set_xel().

Referenced by PNMTextMaker::generate_into().

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

References PNMImage::get_alpha(), get_interior_flag(), get_value(), PNMImageHeader::get_x_size(), PNMImage::get_xel(), PNMImageHeader::get_y_size(), PNMImageHeader::has_alpha(), PNMImage::is_valid(), PNMImage::set_alpha(), and PNMImage::set_xel().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations