Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!rutgers!uwvax!dogie!yahnke@vms.macc.wisc.edu From: yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) Newsgroups: comp.sys.mac.programmer Subject: Need help on fill routine Message-ID: <1173@dogie.edu> Date: 3 Feb 89 15:17:34 GMT Sender: news@dogie.edu Organization: University of Wisconsin Academic Computing Center Lines: 38 I need to do a pixel by pixel visit of a region for a program I'm working on. (I don't mean "region" in the quickdraw sense really, more of an arbitrary bitmap image). A fill routine would do, here's a real ez version, and a rare practical application of recursion: Fill(hPt, vPt) int hPt, vPt; { Rect aRect; Point aPoint; if (!GetPixel(hPt, vPt)) { SetRect(&aRect, hPt, vPt, hPt + 1, vPt + 1); PaintRect(&aRect); Fill(hPt + 1, vPt + 1); Fill(hPt , vPt + 1); Fill(hPt - 1, vPt + 1); Fill(hPt - 1, vPt ); Fill(hPt - 1, vPt - 1); Fill(hPt , vPt - 1); Fill(hPt + 1, vPt - 1); Fill(hPt + 1, vPt ); } } /* Fill */ This works well for hollowed out closed loop areas. My application will be a little different, involving transfering one bitmap image to another, so if I did a recursive version the above code would be somewhat changed. The only problem with it is it's really stack intensive, it could blow the stack if the area to be filled is too large. Does anybody know of an unrecursive routine that works similarly? Thanks in advance! //////////////////////////////////////////////////////////// Internet: yahnke@vms.macc.wisc.edu Bitnet: yahnke@wiscmacc(.bitnet) \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\