gml_TextRender.h File Reference


Detailed Description

Renders texts into bitmaps.

Uses Tcl/Tk text rendering services, which provides multi-platform, unicode text rendering. The Tcl/Tk interface is entirely hidden in the implementation (ie. it is not visible in this interface file).

#include "gml/base/gml_Errors.h"
#include "gml/image/gml_Bitmap.h"
#include "gml/image/gml_RGBColor.h"

Go to the source code of this file.


Typedefs

typedef void * gml_TTextRender
 An opaque type to represent the class of text rendering objects.

Enumerations

enum  gml_TTextRender_Justify { gml_cTextRender_JustifyLeft, gml_cTextRender_JustifyRight, gml_cTextRender_JustifyCenter, gml_cTextRender_JustifyFill }
 Possible ways to align texts to region borders.

Functions

GML_EXTERN_C gml_TError gml_TextRender_New (gml_TTextRender *tr, Tcl_Interp *tcl_interp)
 Create a new gml_TTextRender object and store a pointer to it in tr.
GML_EXTERN_C void gml_TextRender_Dispose (gml_TTextRender tr)
 Free any resources associated with the gml_TTextRender object tr and frees the object itself.
GML_EXTERN_C gml_TError gml_TextRender_Render (gml_TTextRender tr, char *text, char *font, int *wrapWidth, gml_TTextRender_Justify *justify, gml_TRGBColor *fgColor, gml_TRGBColor *bgColor)
 Render the text to the bitmap in tr.
GML_EXTERN_C gml_TBitmapgml_TextRender_Bitmap (gml_TTextRender tr)
 Return a reference to the gml_TTextRender bitmap.

Variables

char gml_gTextRender_DefaultText []
char gml_gTextRender_DefaultFont []
int gml_gTextRender_DefaultWrapWidth
gml_TTextRender_Justify gml_gTextRender_DefaultJustify
gml_TRGBColor gml_gTextRender_DefaultFgColor
gml_TRGBColor gml_gTextRender_DefaultBgColor

Function Documentation

GML_EXTERN_C gml_TError gml_TextRender_New ( gml_TTextRender tr,
Tcl_Interp *  tcl_interp 
)

Create a new gml_TTextRender object and store a pointer to it in tr.

The caller can pass a Tcl_Interp* in tcl_interp if it already has an initialized Tcl interpreter with Tk loaded. Otherwise, pass NULL.

GML_EXTERN_C gml_TError gml_TextRender_Render ( gml_TTextRender  tr,
char *  text,
char *  font,
int *  wrapWidth,
gml_TTextRender_Justify justify,
gml_TRGBColor fgColor,
gml_TRGBColor bgColor 
)

Render the text to the bitmap in tr.

Any parameter that is NULL will conserve its value from the previous call for this tr instance, or its default value if it is the first call.

Parameters:
tr  the text-rendering object
text  text to be rendered. Must exist during the lifetime of the gml_TTextRender object
font  string that names the font to be used (family and size, e.g. "Helvetica 12"). Refer to the Tk "font" command manual page for a description of accepted font names.
wrapWidth  width (pixels) of the bitmap in which to render the text. If 0, the bitmap will be large enough to hold the entire text on one single line.
justify  how to align the text on the bitmap's border.
fgColor  color of the foreground (letters of the text).
bgColor  color of the background.

Generated on Tue Jun 12 14:03:28 2007 for gml by Doxygen 1.5.2.