home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: mozart.unx.sas.com!jamie
- From: jamie@cdevil.unx.sas.com (James Cooper)
- Subject: Re: FLOOD() questions
- Originator: jamie@cdevil.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <DnFzyp.DvL@unx.sas.com>
- Date: Tue, 27 Feb 1996 16:18:25 GMT
- X-Nntp-Posting-Host: cdevil.unx.sas.com
- References: <19960223.7D2BD90.9087@mojaveg.ridgecrest.ca.us>
- Organization: SAS Institute Inc.
-
-
- In article <19960223.7D2BD90.9087@mojaveg.ridgecrest.ca.us>, mojaveg@ridgecrest.ca.us (Everett M. Greene) writes:
- >I've been experimenting with the Flood() graphics operation
- >and am finding much ambiguity in the RKM explanation. I've
- >included an excerpt of the code I've tried (which doesn't
- >work).
- >
- >void do_window_magic(struct Window *wp)
- >{
- > ULONG tmp_size;
- > PLANEPTR plane;
- > struct TmpRas tr;
- >
- > tmp_size = RASSIZE(wp->Width, wp->Height) * wp->WScreen->BitMap.Depth;
- > if (plane = AllocRaster(wp->Width, wp->Height)) {
- > InitTmpRas(&tr, plane, tmp_size);
- > wp->RPort->TmpRas = &tr;
- > Flood(wp->RPort, 1, wp->BorderLeft + 1, wp->BorderTop + 1);
- > FreeRaster(plane, wp->Width, wp->Height);
- > }
- >}
-
- Your code would be much simpler (and more correct!) if you used
- AllocBitmap() instead of AllocRaster(). AllocBitmap() is a 3.x
- only function, though.
-
- By "more correct" I mean that everything will be allocated on
- proper boundaries, and with proper amounts of padding, etc.
-
- Also, AllocBitmap() can allocate interleaved bitmaps, AllocRaster()
- (by definition, since it only allocates a single plane at a time)
- cannot.
-
- >Questions:
- >
- >1. How does the size computed by RASSIZE compare to that
- > generated by AllocRaster() from its width and height
- > parameters?
-
- AllocRaster() may round up to nearest 8 or 16 bit boundary.
- I don't remember if RASSIZE does or not.
-
- >2. Does AllocRaster() allocate CHIP memory?
-
- Yes.
-
- >3. Do you have to AllocRaster() for each bit plane or will
- > one allocation suffice for the whole temp raster?
-
- You must do one for each plane.
-
- >4. If one is flooding within a window, does the temp raster
- > need to be any larger than the window? [The RKM says
- > something about making the temp raster the same size as
- > the screen which would seem unnecessary.]
-
- The temp raster needs to be as large as the area being flooded.
-
- --
- ---------------
- Jim Cooper
- (jamie@unx.sas.com) bix: jcooper
-
- Any opinions expressed herein are mine (Mine, all mine! Ha, ha, ha!),
- and not necessarily those of my employer.
-
- I'm NOT Politically Correct, but that's because I'm "Sensitivity Challenged."
-