tsCServer *myServer=NULL; // pointer to TypeServer instance
mgCBitmap *myBitmap=NULL; // pointer to Bitmap instance
tsCFont *myTTFont=NULL; // pointer to TrueType font instance
tsCStrike *myStrike=NULL; // pointer to Strike instance
FIXPOINT fxPoint; // fixed-point x,y-coordinate
// create a TypeServer, define a bitmap, open a font, create a strike
myStrike = new tsCServer();
myBitmap = new mgCBitmap( 1024, 768, 8, NULL );
myTTFont = new tsCFont( myServer, "arial.ttf", 0, 0 );
myStrike = new tsCStrike( myTTFont, myBitmap );
if ( (myServer==NULL) || (myBitmap==NULL) || (myTTFont==NULL) || (myStrike==NULL) )
{ /* handle error condition */ }
// set text size and color
myStrike->SetTypeSize( IntToFix(12), tsPixels );
myStrike->SetColorsRGB( RGB_Make(0,0,0), RGB_Make(255,255,255) );
// draw "Hello World" starting at pixel location (80.0, 100.0)
fxPoint.x = IntToFix(80);
fxPoint.y = IntToFix(100);
myStrike->DrawString( &fxPoint, "Hello World" );
// close strike, font, bitmap and TypeServer instances
delete myStrike;
delete myTTFont;
delete myBitmap;
delete myServer; |