News:

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

BitBlt Motion

Started by masitecno, May 23, 2012, 03:22:15 AM

Previous topic - Next topic

masitecno

Hi everybody.

I'm trying to scroll an image like a cilinder, i had an idea using bitblt but i think something was wrong in the implementation:


Paint_Proc proc hWin:DWORD, hDC:DWORD, movit:DWORD
    LOCAL hOld :DWORD
    LOCAL hNew :DWORD
    LOCAL memDC:DWORD
    LOCAL memDCBack:DWORD
    invoke CreateCompatibleDC,hDC
    mov memDC, eax                   
    invoke SelectObject,memDC,hBmp
    mov hOld, eax                         
    invoke CreateCompatibleDC,hDC   
    mov memDCBack, eax
    invoke SelectObject,memDC,hBmp
    mov hNew, eax
    .if movit == 0
      invoke BitBlt,hDC,10,10,768,576,memDC,0,0,SRCCOPY
    .else
    mov var3, 0
    .while var3 < 2     ;<< set the number of times image is looped
      mov var1, 0
      .while var1 < 768 ;<<  Bitmap width
         invoke BitBlt,memDCBack,0,0,767,576,memDC,1,0,SRCCOPY     ;take from pixel 1 to width
         invoke BitBlt,memDCBack,767,0,1,576,memDC,767,0,SRCCOPY  ;take pixel 1 to  last column
         invoke BitBlt,hDC,10,10,768,576,memDCBack,var1,0,SRCCOPY    ;draw the image

        inc var1
      .endw

    inc var3
    .endw
    .endif
    invoke SelectObject,hDC,hOld
    invoke DeleteDC,memDC
    invoke SelectObject,hDC,hNew
    invoke DeleteDC,memDCBack
    return 0
Paint_Proc endp

(The original code was taken from a masm32 example)

I think bitblt can copy from the second column to the end of the bitmap, then copy the first column to the last column then paint that in the window but.
It just doesnt work.

I would appreciate some help. Thanks.

dedndave

this loop will kill you   :P
      .while var1 < 768 ;<<  Bitmap width
         invoke BitBlt,memDCBack,0,0,767,576,memDC,1,0,SRCCOPY     ;take from pixel 1 to width
         invoke BitBlt,memDCBack,767,0,1,576,memDC,767,0,SRCCOPY  ;take pixel 1 to  last column
         invoke BitBlt,hDC,10,10,768,576,memDCBack,var1,0,SRCCOPY    ;draw the image

        inc var1
      .endw

i would think you can do it with 3 BitBlt's and no loop - if the "split" offset is 0, only 2
all you have to have as a variable is the x-offset of the "split" - which could change with a timer or something

dedndave

remember those old beer signs ???   :bg

It's Miller Time !

dedndave

#3
what ?
no one likes my beer sign   :red
maybe a pic would help...


RHL

lol very nice dave!  :clap: I like it  :bg

Bill Cravener

Quote from: dedndave on May 24, 2012, 04:49:18 AM
what ?
no one likes my beer sign   :red
maybe a pic would help...



Thats pretty neat Dave. I do Flash banners for websites that have scrolling backgrounds like that (usually the sky) but this is the first time I've seen an ad banner done in asm.

How come you guys are still posting in the old forum? You should post your example over in the new forum. The only reason I found your example is I accidentally clicked on the old Masm32 link.

My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

dedndave

yah - the guy is a newbie
if i moved to the other forum, he might not find it   :P
anyways - it is on an external host

the miller beer signs came to mind when he mentioned "cylinder" scrolling
hamm's beer used to have some, too
i wish i could get a look at some of the old ones
they worked by having areas in the front with holes in it
then - the water and/or beer looked like it flowed from the scrolling back

we could do a player piano, too   :bg
my mom probably has about 100 scrolls of music
we could have a keyboard with keys moving up and down - lol
of course - we give them the program for free - then sell them the music scroll files   :bdg

masitecno

Thank's I've moved to the new Forum.

could you please continue helping? I didn't undestand about the offset.

Yes i'm a newbie.