[net.graphics] Area-fill algorithm summary

carl@ncr-tp.UUCP (Carl Kuck) (05/20/85)

" As you read the scroll you become confused.  Call it:  UNIX (*) manual "


   Here is the promised summarization of the results of my area-fill posting.

1. Good reference book:

   "Principles of Interactive Computer Graphics" by Newman and Sproull

2. Simple area fill algorithm: (written in Pascal)

   (* assumes SET_PIXEL(X,Y) to turn on a pixel, and PIXEL_OFF(X,Y) which
      returns "true" if the pixel at (X,Y) is off *)

   procedure FILL (X,Y : integer);

   begin
     SET_PIXEL(X,Y);
     if PIXEL_OFF(X-1,Y) then
       FILL(X-1,Y);
     if PIXEL_OFF(X+1,Y) then
       FILL(X+1,Y);
     if PIXEL_OFF(X,Y-1) then
       FILL(X,Y-1);
     if PIXEL_OFF(X,Y+1) then
       FILL(X,Y+1);
   end; (* FILL *)


3. Acknowledgements:

   Thanks (and a tip o' the chapeau) to Bill Ingogly, Joel Wittels,
Conor Rafferty, all the people who requested this summary, and anyone
else I might have forgotten in the heat of trying to get all of this
done before the Pyramid here at SE-SD/TP goes away!  This will be my last
posting, as ncr-tp leaves the net (not for too long, I hope) on May 22nd!
Don't bother replying, we'll be long gone by the time it gets here...

*****************  Thanks again, to one and all !!! *********************

-- Carl " 2 days and counting " Kuck  (soon-to-be formerly ncr-tp!carl)

(*) If there's anyone reading this who doesn't know that UNIX is a
    trademark, get in touch with me immediately.  You need help.

" Ask me no questions and I might not tell you any lies ... fnord ... "