[comp.sys.amiga.tech] Clearing the Window

kchiu@carina.unm.edu (08/10/90)

	Ok, this might sound like a stupid question, but Is there a function
for clearing the Window? Or do you have to fill the window with background
color?
						Thanks in advance.

kchiu@carina.unm.edu

jjszucs@cbmvax.commodore.com (John J. Szucs) (08/10/90)

In article <1990Aug10.022609.9022@ariel.unm.edu> kchiu@carina.unm.edu writes:
>
>	Ok, this might sound like a stupid question,

The only kind of stupid question is an important one that isn't asked.

>but Is there a function
>for clearing the Window? Or do you have to fill the window with background
>color?

There is no function for clearing a window per se.

However, there are calls in graphics.library that can be used for this
purpose.

If you are using a GIMMEZEROZERO window (specified with the GIMMEZEROZERO
flag in the Flags field of the NewWindow structure):

 #define BACKGROUND_PEN 0 /* Define constant for background color */

struct Window *Window;

	...
	/* Set window to background color */
	SetRast(Window->RPort,BACKGROUND_PEN);
	...

This method applies only to GIMMEZEROZERO windows. However, the use of
GIMMEZEROZERO windows has an adverse effect on system performance and should be
avoided if at all possible.

For non-GIMMEZEROZERO windows (windows for which the GIMMEZEROZERO flag
in the Flags field of the NewWindow structure was not set):

 #define BACKGROUND_PEN 0 /* Define constant for background color */

struct Window *Window;

	...
	/* Set area and outline pens to background color */
	SetAPen(Window->RPort,BACKGROUND_PEN);
	SetOPen(Window->RPort,BACKGROUND_PEN);

	/* Set window to background color */
	RectFill(Window->RPort,Window->BorderLeft,Window->BorderTop,
		Window->Width-Window->BorderRight-1,
		Window->Height-Window->BorderTop-1);

For more information on windows and the graphics.library calls (including
SetRast and RectFill), see the Intuition and Graphics sections, respectively,
of the ROM Kernel Manual: Libraries and Devices and the includes and
AutoDocs files (all available for Commodore Applications and Technical
Support).

>						Thanks in advance.
>
>kchiu@carina.unm.edu

================================================================================
|| John J. Szucs                    || The opinions expressed are my own and  ||
|| Systems Evaluation Group         || in no way represent the opinions or    ||
|| Product Assurance Department     || policies of Commodore Technology, Inc. ||
|| Commodore Technology, Inc.       || or any associated entity.              ||
================================================================================
...{rutgers|uunet|pyramid}!cbmvax!jjszucs
jjszucs@cbmvax.commodore.com

"Everything is deeply intertwingled." - Ted Nelson, Computer Lib/Dream Machines

wfh58@leah.Albany.Edu (William F. Hammond) (08/11/90)

In article <13749@cbmvax.commodore.com> jjszucs@cbmvax (John J. Szucs) writes:
>In article <1990Aug10.022609.9022@ariel.unm.edu> kchiu@carina.unm.edu writes:
> ...
>>but Is there a function
>>for clearing the Window? Or do you have to fill the window with background
> ...
>There is no function for clearing a window per se.
>
Take a look at ClearScreen().  I don't have autodocs handy at the moment,
but I believe this function is in graphics.library:

              void ClearScreen(struct RastPort *rp);

where:        rp = yourwindow->RPort

with:         yourwindow being the pointer to the window you want to clear

----------------------------------------------------------------------
William F. Hammond                   Dept. of Mathematics & Statistics
518-442-4625                         SUNYA, Albany, NY 12222
hammond@leah.albany.edu              wfh58@albnyvms.bitnet
----------------------------------------------------------------------

jjszucs@cbmvax.commodore.com (John J. Szucs) (08/11/90)

In article <3510@leah.Albany.Edu> wfh58@leah.albany.edu.UUCP (William F. Hammond) writes:
>In article <13749@cbmvax.commodore.com> jjszucs@cbmvax (John J. Szucs) writes:
>>In article <1990Aug10.022609.9022@ariel.unm.edu> kchiu@carina.unm.edu writes:

[stuff deleted]

>>There is no function for clearing a window per se.
>>
>Take a look at ClearScreen().  I don't have autodocs handy at the moment,
>but I believe this function is in graphics.library:
>
>              void ClearScreen(struct RastPort *rp);
>
>where:        rp = yourwindow->RPort
>
>with:         yourwindow being the pointer to the window you want to clear

ClearScreen clears the RastPort from the current position. If the window
is not of the GIMMEZEROZERO flavor, the window borders and border gadgetry are
in the RastPort and are also cleared. Thus, ClearScreen is only suitable
for GIMMEZEROZERO windows (or other RastPorts where you really mean to
clear the WHOLE RastPort).

>
>----------------------------------------------------------------------
>William F. Hammond                   Dept. of Mathematics & Statistics

================================================================================
|| John J. Szucs                    || The opinions expressed are my own and  ||
|| Systems Evaluation Group         || in no way represent the opinions or    ||
|| Product Assurance Department     || policies of Commodore Technology, Inc. ||
|| Commodore Technology, Inc.       || or any associated entity.              ||
================================================================================
...{rutgers|uunet|pyramid}!cbmvax!jjszucs
jjszucs@cbmvax.commodore.com

"Everything is deeply intertwingled." - Ted Nelson, Computer Lib/Dream Machines

Bits_of_Magic@cup.portal.com (09/06/90)

SetRast(rp, color), where rp is a pointer to your window's RastPort
should work, at least according to Rob Peck's book.

Nicky Robinson
<bits_of_magic@cup.portal.com>