The MASM Forum

General => The Campus => Topic started by: ragdog on January 05, 2013, 12:07:27 AM

Title: BitBlt
Post by: ragdog on January 05, 2013, 12:07:27 AM
Hi All

I have a question to a imagelist can i use this format for a Imagelist ?

(http://s7.directupload.net/images/130104/pe4wjoxz.png)

I use in my new toy Bitblt for draw images now must i add 3 images to the resource
but i have see i can add a one image (imagelist) in the resource and use ImageList_LoadImage

Can i use this in this format and have any an example?

Greets,
Title: Re: BitBlt
Post by: dedndave on January 05, 2013, 01:40:54 AM
you can use any order or organization that suits you
it makes it simple if the images are the same size, but they don't have to be   :biggrin:

http://masm32.com/board/index.php?topic=932.msg9410#msg9410 (http://masm32.com/board/index.php?topic=932.msg9410#msg9410)
Title: Re: BitBlt
Post by: Tedd on January 05, 2013, 01:44:00 AM
The images are arranged horizontally, so if you want to add multiple at once then make yours horizontal too (not vertical.)
If you add them one at a time then obviously it doesn't matter.

(Dave is using a bitmap and bitblt-ing directly, not an ImageList, in which case all organisation is up to you, including sizing large enough to add more images.)
Title: Re: BitBlt
Post by: dedndave on January 05, 2013, 01:47:31 AM
i used a vertical arrangement on that minesweeper thing
just because windows minesweeper did - and i wanted to try it that way
i had otherwise always arranged them horizontally

actually, there is a certain amount of logic behind that
when arranged vertically, the bytes for any given sub-image are in the same area of memory
when arranged horizontally, they are interlaced with bytes of the other sub-images
that probably makes little difference in 32-bit flat model, but interesting to note

as far as the code goes, it seems to make little difference
Title: Re: BitBlt
Post by: Tedd on January 05, 2013, 01:54:37 AM
I agree - bitmaps are stored by scanline, so it makes sense to arrange multiple images vertically; however, the ImageList_ functions require them to be arranged horizontally ::)
Title: Re: BitBlt
Post by: ragdog on January 05, 2013, 01:56:54 AM
Thank you both

@Dave yes exactly this is it :t

I use in my project many buttons a 3 different images and all buttons have a other image
and i use many many bmp files in my resource.  ::)

I have think with a imagelist is it better to use aka my first post

now must i only include 5 bmp files in my resource  :biggrin:

Ok i look in your source and try it and i hope this is easy  8)
Title: Re: BitBlt
Post by: dedndave on January 05, 2013, 02:08:52 AM
oh - gotcha, Tedd
i haven't used that function - seems like unnecessary overhead to seperate the images
i think it uses less memory if you keep it as one image, and index into it to get the sub-image
Title: Re: BitBlt
Post by: dedndave on January 05, 2013, 04:30:46 AM
here is a very simple example using BitBlt

i don't use the image list function
i don't double-buffer
that makes it very easy to understand   :P

now, if you want to set the individual images into a static control,
then the image list function may be a good alternative,
as you need individual bitmap handles for each sub-image

i would probably create my own compatible bitmaps and blit them in there   :biggrin:
Title: Re: BitBlt
Post by: ragdog on January 05, 2013, 04:34:47 AM
Yes nice this is it dank Dave :t :t

Bitblt was the question to split the bitmap from a imagelist picture  ::)
Title: Re: BitBlt
Post by: dedndave on January 05, 2013, 04:35:48 AM
it's pretty easy stuff   :t
Title: Re: BitBlt
Post by: dedndave on January 05, 2013, 04:40:06 AM
i made a mistake, though - lol

when i made the bitmap strip, i put the blue image at the top and the red image at the bottom
when i wrote the code, i thought i had them the other way around

so - my red and blue images are swapped   :P

i guess you wanted them in "3,2,1" order, so we are good   :lol:
Title: Re: BitBlt
Post by: ragdog on January 05, 2013, 05:59:58 AM
This is simply to change it my question was only how it work it :biggrin:
and this have you shown me :eusa_dance:

Works perfect


  .if ([edi].CtlID==1001)
      .if ([edi].itemState & ODS_SELECTED)
          mov ebx,1*SIZE_Y
        .else
               mov ebx,0*SIZE_Y
      .endif
   .endif
   invoke   SelectObject,hMemDC,hBmp
   invoke  BitBlt,[edi].hdc,0,0,[edi].rcItem.right,[edi].rcItem.bottom,hMemDC,0,ebx,SRCCOPY


Have i any problems about it i tll you ;-)
Title: Re: BitBlt
Post by: hfheatherfox07 on January 31, 2013, 09:46:38 AM
Quote from: dedndave on January 05, 2013, 04:30:46 AM
here is a very simple example using BitBlt

i don't use the image list function
i don't double-buffer
that makes it very easy to understand   :P

now, if you want to set the individual images into a static control,
then the image list function may be a good alternative,
as you need individual bitmap handles for each sub-image

i would probably create my own compatible bitmaps and blit them in there   :biggrin:


I love that example !
I had an idea , using invoke sleep , and delete object I thought I can animate the squares moving across the screen ( any direction)
Any idea why that failed?
All I did was add those things to your code
Title: Re: BitBlt
Post by: hfheatherfox07 on January 31, 2013, 06:34:04 PM
never mind ....
I need to sketch mask http://www.masmforum.com/board/index.php?topic=18800.0

I want to use that to animate the position off each image like it is walking