 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Niels Munk Guest
|
Posted: Wed Oct 08, 2003 12:46 pm Post subject: Drawing text to off-screen buffer. |
|
|
I need to write text (and create graphics...) in an off screen bitmap
buffer, and this gives me a little headache.
My buffet is 3x8 bits deep (RGB) and e.g. 1280x1024 pixels in width
and height.
I try to use simple code:
BITMAP bm;
bm.bmType = 0;
bm.bmWidth = 1280; //buffer width
bm.bmHeight = 1024; //buffer height
bm.bmWidthBytes = 3 * bm.bmWidth;
bm.bmPlanes = 1;
bm.bmBitsPixel = 24;
bm.bmBits = malloc( bm.bmWidthBytes * bm.bmHeight );
memset(bm.bmBits, 128, bm.bmWidthBytes * bm.bmHeight ); // Init to
soemthing sane....
HBITMAP hbm = CreateBitmapIndirect(&bm);
HDC dc = CreateCompatibleDC(NULL);
SelectObject(dc, hbm);
TextOut(dc,10,10,"Hello",strlen("Hello"));
But nothing really happens to the buffer? Do I miss something basic?
Thanks for using a split-second on this.
Niels
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|