BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Drawing text to off-screen buffer.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Niels Munk
Guest





PostPosted: Wed Oct 08, 2003 12:46 pm    Post subject: Drawing text to off-screen buffer. Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.