News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Converting rgb array to HBITMAP

Started by arya, July 19, 2009, 08:10:01 AM

Previous topic - Next topic

arya

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.

akane

Hi, this should be the easiest way to do it:
invoke CreateBitmap, width, height, 1, 24, array

dedndave

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)