[comp.sys.sun] How to clear CANVAS in sunview

jaysun@omni.eng.clemson.edu (Jay) (05/09/89)

I have already posted this to comp.graphics but have got no answers so
please help me out.

I am interested in an easy way to clear a canvas without having to write
my own repaint proc.  I have tried changing CANVAS_AUTO_CLEAR to TRUE but
this does not SEEM to work.  The manual says "... if the attribute
CANVAS_AUTO_CLEAR is TRUE, the canvas package will clear the repaint area
before calling your repaint procedure".  Does this mean I have to have my
own repaint proc for this to occur?????  Any help on this will be much
appriciated as I am a relative newcomer to sunview prog.

Jay Williamson            Engineering Computer Operations
jaysun@eng.clemson.edu    Clemson University

Jay Williamson    <jaysun@eng.clemson.edu>

ellery@trantor.harris-atd.com (Ellery Chan) (05/12/89)

The easiest way that I know to clear a canvas is:

    pw_writebackground (canvas_pixwin(canvas), 0, 0, width, height, PIX_SRC);

or, for color canvases:

    pw_writebackground (canvas_pixwin(canvas), 0, 0, width, height,
                        PIX_SRC | PIX_COLOR(bg_color));

You only need to supply your own repaint procedure if you want to refresh
the display manually when previously covered parts of your canvas become
exposed.  If CANVAS_RETAINED is set to TRUE, the canvas is repainted
automatically from a backing pixrect kept in memory.  I hope this helps.

 Ellery Chan                     | ARPA  : ellery@trantor.harris-atd.com
 Harris Corp., MS 3A-1912        | USENET: ...!uunet!x102a!trantor!ellery
 PO Box 37, Melbourne, FL  32902 | AT&T  : (407) 729-3364