libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OGLFT::Grayscale Class Reference

Render text as a grayscale raster image. More...

#include <moOGLFT.h>

Inheritance diagram for OGLFT::Grayscale:
OGLFT::Raster OGLFT::Face

Public Member Functions

 Grayscale (const char *filename, float point_size=12, FT_UInt resolution=100)
 
 Grayscale (FT_Face face, float point_size=12, FT_UInt resolution=100)
 
 ~Grayscale (void)
 
- Public Member Functions inherited from OGLFT::Raster
 Raster (const char *filename, float point_size=12, FT_UInt resolution=100)
 
 Raster (FT_Face face, float point_size=12, FT_UInt resolution=100)
 
virtual ~Raster (void)
 
void setCharacterRotationZ (GLfloat character_rotation_z)
 
GLfloat characterRotationZ (void) const
 
double height (void) const
 
BBox measure (unsigned char c)
 
BBox measure (const char *s)
 
- Public Member Functions inherited from OGLFT::Face
 Face (const char *filename, float point_size=12, FT_UInt resolution=100)
 
 Face (FT_Face face, float point_size=12, FT_UInt resolution=100)
 
virtual ~Face (void)
 
bool isValid (void) const
 
bool addAuxiliaryFace (const char *filename)
 
bool addAuxiliaryFace (FT_Face face)
 
void setCompileMode (enum GlyphCompileMode compile_mode)
 
enum GlyphCompileMode compileMode (void) const
 
void setPointSize (float point_size)
 
float pointSize (void)
 
void setResolution (FT_UInt resolution)
 
FT_UInt resolution (void)
 
void setAdvance (bool advance)
 
bool advance (void) const
 
void setForegroundColor (GLfloat red=0.0, GLfloat green=0.0, GLfloat blue=0.0, GLfloat alpha=1.0)
 
void setForegroundColor (const GLfloat foreground_color[4])
 
GLfloat foregroundRed (void) const
 
GLfloat foregroundGreen (void) const
 
GLfloat foregroundBlue (void) const
 
GLfloat foregroundAlpha (void) const
 
void setBackgroundColor (GLfloat red=1.0, GLfloat green=1.0, GLfloat blue=1.0, GLfloat alpha=0.0)
 
void setBackgroundColor (const GLfloat background_color[4])
 
GLfloat backgroundRed (void) const
 
GLfloat backgroundGreen (void) const
 
GLfloat backgroundBlue (void) const
 
GLfloat backgroundAlpha (void) const
 
void setCharacterRotationReference (unsigned char c)
 
void setStringRotation (GLfloat string_rotation)
 
GLfloat stringRotation (void) const
 
void setHorizontalJustification (enum HorizontalJustification horizontal_justification)
 
enum HorizontalJustification horizontalJustification (void) const
 
void setVerticalJustification (enum VerticalJustification vertical_justification)
 
enum VerticalJustification verticaljustification (void) const
 
void setCharacterDisplayLists (const DisplayLists &character_display_lists)
 
DisplayListscharacterDisplayLists (void)
 
virtual BBox measureRaw (const char *s)
 
GLuint compile (const char *s)
 
GLuint compile (unsigned char c)
 
void draw (const char *s)
 
void draw (unsigned char c)
 
void draw (GLfloat x, GLfloat y, unsigned char c)
 
void draw (GLfloat x, GLfloat y, GLfloat z, unsigned char c)
 
void draw (GLfloat x, GLfloat y, const char *s)
 
void draw (GLfloat x, GLfloat y, GLfloat z, const char *s)
 
int ascender (void)
 
int descender (void)
 

Additional Inherited Members

- Public Types inherited from OGLFT::Face
enum  HorizontalJustification { LEFT, ORIGIN, CENTER, RIGHT }
 
enum  VerticalJustification { BOTTOM, BASELINE, MIDDLE, TOP }
 
enum  GlyphCompileMode { COMPILE, IMMEDIATE }
 
- Protected Types inherited from OGLFT::Face
typedef std::map< FT_UInt, GLuint > GlyphDLists
 Type of the cache of defined glyph to display list mapping. More...
 
typedef GlyphDLists::const_iterator GDLCI
 
typedef GlyphDLists::iterator GDLI
 
- Protected Attributes inherited from OGLFT::Raster
GLfloat character_rotation_z_
 
- Protected Attributes inherited from OGLFT::Face
std::vector< FaceData > faces_
 
bool valid_
 Did a font load OK? More...
 
enum GlyphCompileMode compile_mode_
 Glyph display list creation mode. More...
 
float point_size_
 Nominal point size. More...
 
FT_UInt resolution_
 Display resolution in pixels per inch. More...
 
bool advance_
 Does rendering text affect the MODELVIEW matrix? More...
 
GLfloat foreground_color_ [4]
 
GLfloat background_color_ [4]
 Background color (what modes would use this?) More...
 
enum HorizontalJustification horizontal_justification_
 PHIGS-like horizontal positioning of text. More...
 
enum VerticalJustification vertical_justification_
 PHIGS-like vertical positioning of text. More...
 
GLfloat string_rotation_
 Rotate an entire string in the Z plane. More...
 
FT_UInt rotation_reference_glyph_
 
FT_Face rotation_reference_face_
 The rotation reference character could be in any face. More...
 
GLfloat rotation_offset_y_
 
GlyphDLists glyph_dlists_
 Cache of defined glyph display lists. More...
 
DisplayLists character_display_lists_
 

Detailed Description

Render text as a grayscale raster image.

grayscale_class.png

The Grayscale style is similar to the Monochrome style. FreeType is used to rasterize a glyph and this is then drawn on the screen using glDrawPixels. The FreeType rasterization is done in anti-aliased mode. When Grayscale draws the glyph image, the resulting text is blended smoothly from the foreground color to the background color. The background of the glyph is opaque, so this style works best over a solid background.

Note: you must call

glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );

before drawing in order for grayscale glyphs to be rendered properly.

Another note: It is helpful to have the option GL_RASTER_POSITION_UNCLIPPED_IBM available if you intend to draw text at MODELVIEW based positions, otherwise if the initial text position is off the screen, the entire image is clipped.

Definition at line 1861 of file moOGLFT.h.

Constructor & Destructor Documentation

OGLFT::Grayscale::Grayscale ( const char *  filename,
float  point_size = 12,
FT_UInt  resolution = 100 
)
Parameters
filenamethe filename which contains the font face.
point_sizethe initial point size of the font to generate. A point is essentially 1/72th of an inch. Defaults to 12.
resolutionthe pixel density of the display in dots per inch (DPI). Defaults to 100 DPI.

Definition at line 1684 of file moOGLFT.cpp.

OGLFT::Grayscale::Grayscale ( FT_Face  face,
float  point_size = 12,
FT_UInt  resolution = 100 
)
Parameters
faceopen FreeType FT_Face.
point_sizethe initial point size of the font to generate. A point is essentially 1/72th of an inch. Defaults to 12.
resolutionthe pixel density of the display in dots per inch (DPI). Defaults to 100 DPI.

Definition at line 1689 of file moOGLFT.cpp.

OGLFT::Grayscale::~Grayscale ( void  )

The destructor doesn't do anything in particular.

Definition at line 1693 of file moOGLFT.cpp.


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