Jump to content

  • Log In with Google      Sign In   
  • Create Account

How do I pass an array to an hbitmap?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 SikCiv   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 December 1999 - 01:57 PM

I have a normal array of data (malloc used) and it contains graphical data at 640x480.
How do I create an HBITMAP out of this array?

I have tried using CreateBitmap but it doesnt work properly.

Any ideas?


Sponsor:

#2 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 December 1999 - 10:37 AM

Not sure exactly what you are trying to do, but I think you should look at CreateDIBSection instead. I used this for a project once.

Give that a shot and let me know if you need more help.

------------------

-Kentamanos


#3 SikCiv   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 December 1999 - 01:45 PM

OK im using CreateDIBSection.
But I am having crashes when I run the program.


I have a pointer which contains my 640x480x24bit data, (BYTE* imageData).
I need to create an HBITMAP to pass on to DDCopyBitmap so I can load the image data onto a DDraw surface.

I have filled out a BITMAPINFO called lpbi,
then i make an HDC and the bits pointer, then create the hbitmap...

HDC hDC = GetDC( NULL );
BYTE* BitmapBits = NULL;

HBITMAP hBitmap = CreateDIBSection(hDC,lpbi,
DIB_RGB_COLORS,(void**)&BitmapBits,
NULL, 0)

ok i have an hbitmap with empty data,

?? what next ??

should I memcpy the imageData to the BitmapBits, then do a DDCopyBitmap(..)

Or can I assign the 4th param in CreateDibSection to my imageData?
(preffered to save memory space)


#4 SikCiv   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 December 1999 - 01:57 PM

flash update...


the memcpy way worked, but still I am allocating too much memory, can I assign the 4th param to the imageData (already contains the bitmap data)?

Also,

my image files are 24bit, but my surfaces are 16bit. Does DDraw (DDCopyBitmap) altomatically convert the bitmaps to 16bit when dumping them to the surface? Or are the surfaces actually 24bit, but when blitted convert to 16bit?







Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS