News:

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

Bitmap array

Started by Mr Earl, November 28, 2005, 12:39:47 PM

Previous topic - Next topic

Mr Earl

How do you concatenate several bitmaps into a single bitmap?

u

I don't know enough about GDI+, but the normal method is:

Load the .bmp files into separate memory buffers, and then copy segments (lines) of them onto one big buffer. Finally, save it into a .bmp file. But you should learn the .bmp file format (find it at www.wotsit.org)
Please use a smaller graphic in your signature.

Grincheux

Create a bitmap in a memory DC. It size is the size of the two bitmaps
Select the new bitmap into the memory DC
Select the first orginal bitmap into a DC
copy with BitBlt or StretchBlt form the hDC to the memory DC
Select the second original bitmap into a DC
copy with BitBlt or StretchBlt form the hDC to the memory DC

Example :

The first bitmap is 256 * 384.
The second has the same size.

The resulting bitmap will be 512 * 384

INVOKE GetDC,hWnd
mov hDC,eax
INVOKE CreateCompatibleDC,hDC
mov hDCMem,eax
invoke CreateCompatibleBitmap,hDC,512,384
mov hBmpResult,eax
invoke SelectObject,hDCMem,eax
mov hBmpMem,eax
invoke SelectObject,hDC,hBmp_1
mov hBmpOld,eax
invoke BitBlt,hDCMem,0,0,256,384,hDC,0,0,SRCCOPY
invoke SelectObject,hDC,hBmp_2
invoke BitBlt,hDCMem,256,0,256,384,hDC,0,0,SRCCOPY
invoke SelectObject,hDC,hBmpOld
invoke SelectObject,hDCMem,hBmpMem

; Now initialize a BITMAPINFO Structure
; Only the 6 first parameter are required
; Call GetDIBits to get all the bitmap bits

After that you can write the bitmap to the file
The BITMAPFILEINFOHEADER has to be initialized before.



Kenavo

Grincheux
_____________________________________________________
http://www.phrio.biz