[futurebasic] Re: Two simple color questions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Tue, 30 Dec 1997 20:06:07 +0000
Mark wrote:
> >1.  What transfer mode does one use to draw a line on the screen and then
> >erase it, so that whatever was there under the line before is redrawn?  I
> >think one of the transfer modes uses some mathematical formula to redraw
> >the original colors.

Mel replied:
> Nope. If something draw over something else, whatever is underneath is
> almost always destroyed. For example, suppose you had a custom ppat
> background. You draw coloured lines over it and there is no way to restore
> it by undrawing the lines.

Mel:  I think Mark may be thinking of the SrcXOR transfer mode.  If you
CALL PENMODE(_SrcXOr), and then draw something, and then redraw the
_exact_ same thing again, the second "draw" will actually erase the
original, and leave whatever was "underneath" untouched.  The catch is
that you don't really have control over the colors of whatever you're
drawing (because SrcXOR essentially "draws" by inverting colors). 
Here's a demo:

WINDOW 1
xc = 70: yc = 70
PEN 4, 4
FOR r = 1 TO 4
  SELECT r
    CASE 1: COLOR = _zGreen
    CASE 2: COLOR = _zRed
    CASE 3: COLOR = _zBlack
    CASE 4: COLOR = _zBlue
  END SELECT
  CIRCLE xc, yc, r * 10
NEXT
COLOR = _zBlack: LOCATE 0, 0: CLS LINE
PRINT "Click mouse to draw"
DO
UNTIL MOUSE(_down)
CALL PENMODE (_srcXOR)
PEN 10, 10
COLOR = _zMagenta
PLOT xc-30, yc-30 TO xc+30, yc+30
PLOT xc+30, yc-30 TO xc-30, yc+30
COLOR = _zBlack: LOCATE 0, 0: CLS LINE
PRINT "Click mouse to erase"
DO
UNTIL NOT MOUSE(_down)
DO
UNTIL MOUSE(_down)
'Repeat drawing exactly:
PLOT xc-30, yc-30 TO xc+30, yc+30
PLOT xc+30, yc-30 TO xc-30, yc+30
COLOR = _zBlack: LOCATE 0, 0: CLS LINE
PRINT "Click mouse to end"
DO
UNTIL NOT MOUSE(_down)
DO
UNTIL MOUSE(_down)

- Rick