back TypeServer QuickTour next
Step 2 - Define a Target Bitmap

TypeServer needs to know where you want rasterized text to be drawn.  TypeServer can draw either to an existing bitmap, such as a video frame buffer or an off-screen local memory bitmap previously created by your program, or can dynamically create a new bitmap that your application can also access.

Two constructors are provided for defining bitmaps: a basic constructor that handles most standard bitmap formats, and an advanced constructor for defining unique or special-case bitmap formats.  Here are the C++ prototypes for the two bitmap constructors:

 Header File Definition:
    mgCBitmap :: mgCBitmap(       // basic bitmap constructor
            int           pixWidth,     // input,  pixels wide                    
            int           pixHeight,    // input,  pixels high                    
            int           pixBits,      // input,  bits per pixel                 
            void         *surface );    // input,  ptr to existing bitmap surface 

    mgCBitmap :: mgCBitmap(       // advanced bitmap constructor
            MGBITMAPINFO *bitmapInfo ); // in/out, ptr to bitmap information struct

The basic constructor is easy to use and works with most standard bitmap formats.  Here is how we define a bitmap for TypeServer use:

  
    mgCBitmap *myBitmap=NULL;    // pointer to bitmap instance
    
    // define a bitmap instance
    myBitmap = new mgCBitmap( 1024, 768, 8, NULL );
    if ( myBitmap == NULL )
        { // handle error condition  }

The above example defines a 256-color, 8 bit-per-pixel bitmap that is 1024 pixels wide and 768 pixels high.  Since we passed a NULL pointer for the bitmap surface, the constructor will also dynamically allocate a new bitmap surface for us in local memory.  To define an existing bitmap, pass the "surface" pointer with the starting address of the frame buffer in memory.

The "advanced" bitmap constructor uses a bitmap information structure, MGBITMAPINFO, that allows you to define special or unique bitmap formats.

TypeServer Bitmap

next»


Home | Products | Order | Register | Support | Company | Contact | Feedback

Copyright © 1999-2001 - Metagraphics Software Corporation.