C (218/254)

From:andrewmarkwell
Date:12 Apr 00 at 13:32:20
Subject:Re: Swap bitmaps

>From: Andrea Cometa <ac76@l...>
>Date: Tue Apr 11, 2000 3:08am
>Subject: Swap bitmaps
>
>How could I swap two BitMaps in RastPort -> BitMap?
>I've tried to change BitMap pointer in RastPort after a vertical
>blank but nothing happens!

I had a similar problem recently, wherein I was using a superbitmap and
wanted to change it for a different sized one... I assume this is what
you mean? As it makes no sense to change the bitmap of a simple or
smart refresh window.

Instead of creating a superbitmap window, create a SmartRefresh one,
ask be notified for IDCMP_REFRESHWINDOW events.

Use AllocBitMap() to allocate a bitmap of your desired size.
Create a RastPort, and use InitRastPort() to initialize it before
pointing RastPort.BitMap at the bitmap you created above.

Whenever you want to draw anything into the window, pass your own
RastPort instead of window->RPort. Then just use BltBitMapRastPort()
to copy over the data into the windows RastPort.

When you find you want to swap bitmaps (i.e. for a larger one), then
just allocate your new bitmap, copy over the data from the old one,
point RastPort.BitMap at the new bitmap, and deallocate the old bitmap.

If you want to do any scrolling use ScrollWindowRaster(), you have to
track the position of the bitmap yourself, then just use
BltBitMapRastPort() to copy over the newly exposed areas from your own
bitmap into the windows rastport when you receieve a
IDCMP_REFRESHWINODW event.

I hope all this makes some sense!

Andrew Markwell

Save ship building on the Tyne

------------------------------------------------------------------------
Get your money connected @ OnMoney.com - the first Web site that lets
you see and manage all of your finances all in one place.
http://click.egroups.com/1/3012/1/_/451227/_/955543818/
------------------------------------------------------------------------