1. win32lib & a double buffer

I know how to double buffer...but i dont see how to do it with win32lib(at
least not correctly)

here's what i did

<code>

include Win32Lib.ew
without warning

--create the main window
global constant GW = create( Window,"Omega",0,0,0,0,0, 0)
global constant PW = create( Pixmap,"",GW,5,5,485,485, 0)

-- load the bitmaps
global constant Blank   = loadBitmapFromFile("d:/omega/gas01.bmp")
global constant Map     = loadBitmapFromFile("d:/omega/map.bmp")

--create the command buttons
<snip> removed all the buttons for working with just the pixmap

procedure paint_play_window()
-- fill with the 48x48 bitmaps
    for x = 5 to 485 by 48 do
        for y = 5 to 485 by 48 do
           drawBitmap(PW, Blank, x, y )

!~~~ Here is where it starts to go bad...drawBitmap doesn't seam draw to the
pixmap...

       end for
   end for
end procedure

procedure paint_scanner_window()
-- fill with the 48x48 bitmaps
    for x = 538 to 762 by 32 do
        for y = 5 to 230 by 32 do
           drawBitmap(GW, Map, x, y )
       end for
   end for
end procedure

procedure paint_map_window()
-- fill with the 48x48 bitmaps
    for x = 538 to 762 by 32 do
        for y = 266 to 490 by 32 do
           drawBitmap(GW, Map, x, y )
       end for
   end for
end procedure

procedure Main_Paint(integer x1, integer y1, integer x2, integer y2)

   paint_play_window()
   paint_scanner_window()
   paint_map_window()

bitBlt( GW, 5, 5, PW, 0, 0, 485, 485, 0)
!~~~ Just draws a big black square...
end procedure
onPaint[GW] = routine_id("Main_Paint")
<end code>

What little thing am i missing?(it has to be little...only the little things
get ya..you never see them coming...)


J Reeves
Grape Vine
ICQ# 13728824

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

2. Re: win32lib & a double buffer

GrapeVine wrote:

> bitBlt( GW, 5, 5, PW, 0, 0, 485, 485, 0)

The arguments to bitBlt look backwards - the first value should be the
destination, not the source. In this case, the destintation is the window
(GW) and the source is the pixmap (PW).

In addition, you need to specify a raster operation - probably SRCCOPY, if
you are just copying the image:

   bitBlt( PW, 0, 0, 485, 485, GW, 5, 5, SRCCOPY )

If you are copying the entire bitmap to some point in the destination, you
might try using the copyBlt() routine, which is a lot like drawBitmap.

Hope this helps!

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: win32lib & a double buffer

>GrapeVine wrote:
>
> > bitBlt( GW, 5, 5, PW, 0, 0, 485, 485, 0)
>
>The arguments to bitBlt look backwards - the first value should be the
>destination, not the source. In this case, the destintation is the window
>(GW) and the source is the pixmap (PW).
Its not backwards..GW is the main window and PW is the buffer
>
>In addition, you need to specify a raster operation - probably SRCCOPY, if
>you are just copying the image:

Ah..I looked for the ROP defines but could not find them...

>    bitBlt( PW, 0, 0, 485, 485, GW, 5, 5, SRCCOPY )
>
>If you are copying the entire bitmap to some point in the destination, you
>might try using the copyBlt() routine, which is a lot like drawBitmap.
I am going to copy the entire pixmap to the screen..Thanx for your help(i am
sure this will fix it)
>Hope this helps!
>
>-- David Cuny

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu