Article View: net.micro.mac
Article #6741Re: Flopping line in MacPaint
From: Richard Sansom
Date: Mon, 11 Aug 1986 15:56
Date: Mon, 11 Aug 1986 15:56
53 lines
3206 bytes
3206 bytes
In article <2693@mit-hermes.ARPA> jpexg@mit-hermes.ARPA (John Purbrick) writes:
>I have an Atari 1040ST, and I've been playing with its bit-mapped graphics.
>One thing that the Mac does when running MacPaint is let you start a line
>by clicking on a point, then flopping the other end around with the mouse
>until you anchor it by clicking again. If the display is bit-mapped, what I'd
>expect to see is that every time the flopping line leaves a point on the
>screen, that point would have to be redrawn or you'd see a whole row of blank
>points in every object crossed by the line. Yet this doesn't happen. Surely
>the whole screen isn't redrawn every time a line is moved? An alternative
>would be to have two planes which are automatically or-ed together to
>generate the display, so one could be permanent and one temporary, but
>the ST certainly doesn't do this--does Macintosh?
> --John Purbrick
The technique used is called XOR (eXclusive-OR). What happens is this:
once the first point of the line has been clicked (or "anchored"), then
everytime the mouse moves, a line is drawn from the anchor to the new
pointer position. However, instead of blindly erasing whatever is underneath
the line, the screen's bit image is preserved by XORing the line's bit image
with the screen image. Now, the _next_ time the mouse moves, the line is
again drawn using the XOR mask, thus restoring the background to its previous
state. Once the mouse positions the pointer in its final location and is
clicked, then the line is drawn "permanently". Of course, most programs
also use the "double-buffer" as well, so that any individual action can
be "undone". Anyway, here's an example of how this works:
Screen: Line: Screen XOR Line:
0010000 0000010 0010010
0100010 0000100 0100110
0111000 0001000 0110000 <-- note "hole" in this byte
0000100 0010000 0010100
0001000 0100000 0101000
0000000 1000000 1000000
XOR Screen: Line: Original Screen:
0010010 0000010 0010000
0100110 0000100 0100010
0110000 0001000 0111000
0010100 0010000 0000100
0101000 0100000 0001000
1000000 1000000 0000000
Hope this helps you a bit (;-).
--
__________ ______ ____ _____ ___
/_________//___ ||__|/____|/__/ Richard E. Sansom
___ ____/ / ____________ TRW Electronics & Defense Sector
/ / / /\ < | /| / One Space Park Drive, R3/1028
/ / / / \ \ | / | / Redondo Beach, CA 90278
/__/ /__/ \__\|__/ |__/ {...decvax,ucbvax,ihnp4}!trwrb!sansom
Technical Details
Message-ID:
<1232@trwrb.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!nbires!hao!hplabs!sdcrdcf!trwrb!sansomReferences:
<2693@mit-hermes.ARPA>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!nbires!hao!hplabs!sdcrdcf!trwrb!sansom From: sansom@trwrb.UUCP (Richard Sansom) Newsgroups: net.micro.mac,net.micro.atari16 Subject: Re: Flopping line in MacPaint Message-ID: <1232@trwrb.UUCP> Date: Mon, 11-Aug-86 11:56:52 EDT Article-I.D.: trwrb.1232 Posted: Mon Aug 11 11:56:52 1986 Date-Received: Tue, 12-Aug-86 17:31:23 EDT References: <2693@mit-hermes.ARPA> Reply-To: sansom@trwrb.UUCP (Richard Sansom) Distribution: net Organization: TRW EDS, Redondo Beach, CA Lines: 53