[comp.sys.amiga] SUPER_BITMAP Windows

billk@crash.UUCP (04/18/87)

Gack!  Another little prob. here.   I've written some nifty little
text-display words that are as fast as/faster than Blitz.  Type a screen full
of characters and they just appear there to the eye.  Well, that's all very
neat and nice and nifty, but it interferes with things like gadgets and menus,
etc.  I don't want to do a locklayerrom() before my call (and that woiuld only
solve a tiny part of the problem, anyway.)  so, I decided to open a
SUPER_BITMAP, GIMMEZEROZERO window (in a customscreen) so that I could draw
my text into it's own bitmap without disturbing anybody.  The problem is that
I am drawing into the bitmap, but the bitmap isn't being displayed on the
screen.  Is there any trick to doing this?  The window is a BACKDROP,
BORDERLESS, GIMMEZEROZERO, SUPER_BITMAP window in a screen with a depth of
one.  My words draw into the bitplane in the BitMap of my window (which is the
only one open on the screen) but nothing (as I said) is being displayed on the
screen.

Help! Please? ... Thanks!  ;-)
                                                Bill Kelly
{akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk

avery@puff.UUCP (04/18/87)

In article <1013@crash.CTS.COM>, billk@pnet01.CTS.COM (Bill Kelly) writes:
> SUPER_BITMAP, GIMMEZEROZERO window (in a customscreen) so that I could draw
> my text into it's own bitmap without disturbing anybody.  The problem is that
> I am drawing into the bitmap, but the bitmap isn't being displayed on the
> screen.  Is there any trick to doing this?  The window is a BACKDROP,
> BORDERLESS, GIMMEZEROZERO, SUPER_BITMAP window in a screen with a depth of
> one.  My words draw into the bitplane in the BitMap of my window (which is the
> only one open on the screen) but nothing (as I said) is being displayed on the
> screen.
>
What you want to do is have the Screen and Window share the same bitmap. I
have usually done this by letting Intuition allocate the bitmap during the
OpenScreen() call, and then linking it into my NewWindow structure before
doing my OpenWindow. This should give you an idea of how to do it:
NewWindow.Flags = BACKDROP | BORDERLESS | GIMMEZEROZERO | SUPER_BITMAP;
NewWindow.Type = CUSTOMSCREEN;
NewWindow.Screen = myscreen;
NewWindow.BitMap = myscreen->ViewPort.RasInfo->BitMap;

I have used this with success. You can also fill NewWindow.BitMap with
&(myscreen->BitMap), but this is only a copy, and since you're passing
a pointer to it, I think the above is right. Someone at Commodore is
invited to correct me if I'm wrong, but I think you're safe having them
share that BitMap structure. Now your window, screen, viewport, layer, and
rastport are all using the same BitMap structure, so, hopefully, there's no
memory waste and any changes in the structure will affect all of the above.

Aaron Avery ({caip,seismo,allegra,harvard,ihnp4}!uwvax!puff!avery)
	    (avery@puff.wisc.edu)

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner CATS) (04/20/87)

In article <1013@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:
>[]
>                                            ...  so, I decided to open a
>SUPER_BITMAP, GIMMEZEROZERO window (in a customscreen) so that I could draw
>my text into it's own bitmap without disturbing anybody.  The problem is that
>I am drawing into the bitmap, but the bitmap isn't being displayed on the
>screen.  Is there any trick to doing this? ...
>[]

   A SuperBitmap window's own bitplanes are used for off-screen rendering
and storage of image when the window is sized.  Anything rendered in
the displayed portion of a SuperBitmap window is rendered in the SCREEN's
bitplanes.

   There are two graphics.library functions for updating the displayed and
non-displayed parts of a SuperBitmap window.  These functions should be
used within a LockLayerRom() / UnlockLayerRom() pair.

   1. SyncSBitMap(layer *)

      Updates the SuperBitmap's own bitplanes from the displayed portion
      in the screen's bitmap.

      This could be used, for instance, to update the SuperBitmaps own
      bitplanes prior to saving them as an ILBM.  Note that the BitMap
      structure that YOU set up for the SuperBitmap window is NOT
      the one pointed at by the Window structure.  The pointer to
      that BitMap is stored in window->Layer->SuperBitMap.

   2. CopySBitMap(layer *)

      Updates the visible portion of the SuperBitmap (in SCREEN's bitplanes)
      from the SuperBitmap window's own bitplanes.

      This can be used if you have rendered to or cleared the SuperBitmap
      planes and wish to update the visible display to match it.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

scott@applix.UUCP (Scott Evernden) (04/20/87)

In article <1013@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:
>... The problem is that
>I am drawing into the bitmap, but the bitmap isn't being displayed on the
>screen.  Is there any trick to doing this?  The window is a BACKDROP,
>BORDERLESS, GIMMEZEROZERO, SUPER_BITMAP window in a screen with a depth of
>one.  My words draw into the bitplane in the BitMap of my window (which is the
>only one open on the screen) but nothing (as I said) is being displayed on the
>screen.

In order to draw into a SuperBitmap window, you need to:

1) draw into the Window's bitmap via its RastPort; the SuperBitmap
   is updated from the Window's bitmap whenever you do a ScrollLayer
   or whenever you do a (layer lib) SyncSBitmap.

2) draw into the SuperBitmap (maybe thru a temp RastPort) and
   then do a (layer lib) CopySBitmap to update the Window layer (and
   hence the display).

So, the short answer is to study the Layers Library CopySBitMap and
SyncSBitmap calls.

I don't remember if you need to lock your layers around these calls; they
may do this for you already.

 - scott

qix@mit-prep.ARPA (Ed Puckett) (04/22/87)

In article <1013@crash.CTS.COM>, Bill Kelly writes:
> . . . so, I decided to open a
> SUPER_BITMAP, GIMMEZEROZERO window (in a customscreen) so that I could draw
> my text into it's own bitmap without disturbing anybody.  The problem is that
> I am drawing into the bitmap, but the bitmap isn't being displayed on the
> screen.  Is there any trick to doing this?  The window is a BACKDROP,
> BORDERLESS, GIMMEZEROZERO, SUPER_BITMAP window in a screen with a depth of
> one.  My words draw into the bitplane in the BitMap of my window (which is the
> only one open on the screen) but nothing (as I said) is being displayed on the
> screen.
>                                                 Bill Kelly
> {akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk

You need to call CopySBitMap(layer) to make the changes visible.
SyncSBitMap(layer) does the reverse: makes the BitMap reflect the current
state of the display.  Hope this helps.

                              -Ed Puckett.