Do you have the ability to draw to an offscreen bitmap, or are you drawing/printing straight to the screen?
My experience here has been with Direct3D which allows you to draw to (multiple) offscreen bitmaps, then blit one onto another until you have the full image (sort of like layering transparencies) which you render to the screen. Something like this:
rgb_bitmap alpha_layer[screen_width][screen_height];
rgb_bitmap background[screen_width][screen_height];
double alpha_level = .5; //this determines the transparency of the text. use 1.0 for opaque text, 0.0 for invisible text etc.
scene.render(background); //render the scene to the background bitmap
scene.render(alpha_layer); //render the scene to the alpha_layer as well so that the parts of the alpha_layer that are empty will not affect the background in the blend stage. Alternatively, copy the background to the alpha_layer
//have the font object render "hello world" at the desired x and y coordinates to the alpha_layer
font.display_text(alpha_layer, "hello world", text_x, text_y);
for ( i = 0; i < screen_width; i++ ) {
for ( j = 0; j < screen_height; j++ ) {
background[i][j].red = alpha_level * alpha_layer[i][j].red + (1-alpha_level) * background[i][j].red;
background[i][j].green = alpha_level * alpha_layer[i][j].green + (1-alpha_level) * background[i][j].green;
background[i][j].blue = alpha_level * alpha_layer[i][j].blue + (1-alpha_level) * background[i][j].blue;
}
}
of course, you can probably be quite a bit more efficient by only blending the part of the bitmaps that actually have text on them (use the vertical and horizontal extents of the text to get the rectangle)
[Edited by stigant at
Local Time:03-26-2005 at 02:08 AM]
____________________________
Progress Quest Progress