The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: arya on July 19, 2009, 08:10:01 AM

Title: Converting rgb array to HBITMAP
Post by: arya on July 19, 2009, 08:10:01 AM
Hey ,
My problem is that I don't know much about bitmaps,and my English is not good so I am finding info about bitmaps with all that palette ,bits per pixel and all a little confusing.
ok so back to the problem now I have a RGB byte array of pixel data in the format R1G1B1R2G2B2...RnGnBn and I have to convert it to a Bitmap handle (HBITMAP).I google and found a few examples but nothing was fitting for my problem and I was not able to make them work.
Any help ?
A working code would be icing on the cakeĀ  :bg
Thanks in advance.
Title: Re: Converting rgb array to HBITMAP
Post by: akane on July 19, 2009, 09:49:37 AM
Hi, this should be the easiest way to do it:
invoke CreateBitmap, width, height, 1, 24, array
Title: Re: Converting rgb array to HBITMAP
Post by: dedndave on July 19, 2009, 11:39:47 AM
BMP is probably the simplest picture file format
for 24 bit images, the header is 54 bytes long
then it is followed by the bitmap
of course, ms put everything in there backwards - lol
the last line of the image is first in the file
and the color-levels are B, G, R, 0 (each pixel is padded with a 0 byte)