schwager@cs.uiuc.edu (Michael Schwager) (01/23/91)
Ok, so now I'm tryin' to do a Flood fill of an area, and that's not working right. Dig this: I've got a BackDrop window that I've put a lovely IFF picture into. There's a large area of white (pen 1) surrounding x=470, y=79. I'm trying to turn that area black (pen 4). Around the white is background (pen 0). I have a struct Window *ThisWindow; So I can do this: SetOPen (ThisWindow->RPort, 0L); SetAPen (ThisWindow->RPort, 4L); Flood (ThisWindow->RPort, 0L, 470L, 79L); However, if I try to do a mode 1 flood, nothing happens! That is, it doesn't matter what I do with SetOPen, but when I try: Flood (ThisWindow->RPort, 1L, 470L, 79L); forget it! It stays whiter than white, brighter than bright. It's enough to ruin my day. So, wisened peoples, what's wrong with my brain this time? Do I need to set aside a TmpRas? Do I need to change something else in my RastPort? Am I even using the correct RastPort? Like, ought I go to the Screen's RastPort (aren't they the same?)? I feel like I'm fishing in the dark a little here... Thanks! -Mike Schwager |"Weapons are the tools of fear; INTERNET:schwager@cs.uiuc.edu | a decent man will avoid them... UUCP:{uunet|convex|pur-ee}!uiucdcs!schwager| His enemies are not demons, BITNET:schwager@mike.cs.uiuc.edu | but human beings like himself...." University of Illinois, Dept. of Comp. Sci.| -Tao Te Ching, chapter 31
markv@kuhub.cc.ukans.edu (01/24/91)
> Do I need to set aside a TmpRas? Do I need to change something else in my > RastPort? Am I even using the correct RastPort? Like, ought I go to the > Screen's RastPort (aren't they the same?)? I feel like I'm fishing in the > dark a little here... Bingo. Use the windows Rastport, and allocate a TmpRas and bitplane and fill in the field and stuff. Here is some simple sample code: struct Window *MyWindow; struct TmpRas MyTmpRas; PLANEPTR *MyPlane; /* ...assume window is now open and cant get bigger than WIDTH and HEIGHT */ MyPlane = AllocRaster(WIDTH, HEIGHT); if (!MyPlane) { /* ..barf and die..*/ } InitTmpRas(&MyTmpRas, MyPlane, RASSIZE(WIDTH, HEIGHT)); MyWindow->RPort->TmpRas = &MyTmpRas; /* ..when done clean up */ MyWindow->RPort->TmpRas = NULL; FreeRaster(WIDTH, HEIGHT); > Thanks! No problem. Note that a TmpRas is only one bitplane, and that it must be as big as the largest possible fill (ie: ScreenSize generally) just in case the Flood() leaks you dont want it to scribble on memory. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: markgood \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spence@cbmvax.commodore.com (Spencer Shanson) (01/24/91)
In article <1991Jan23.034804.6498@cs.uiuc.edu> schwager@cs.uiuc.edu (Michael Schwager) writes: >Ok, so now I'm tryin' to do a Flood fill of an area, and that's not working >right. Dig this: > >Flood (ThisWindow->RPort, 1L, 470L, 79L); > >forget it! It stays whiter than white, brighter than bright. It's enough >to ruin my day. So, wisened peoples, what's wrong with my brain this time? >Do I need to set aside a TmpRas? Do I need to change something else in my YES - you need a TmpRas at least as large as the RastPort. >Thanks! >-Mike Schwager |"Weapons are the tools of fear; -- --------------------------------------------------------------------------- Spencer Shanson - Amiga Software Engineer | email: spence@commodore.COM | or uunet!cbmvax!spence All opinions expressed are my own, and do not | "A picture is worth 1000 (necessarily) represent those of Commodore. | words, or about 300,000 | bytes."