[net.micro.amiga] Flood fills.

donw@zinfandel.UUCP (Don White) (09/23/86)

   Help?

   I am writing a program in which I need to fill irregular shapes. I have
a pointer to a rastport from a window which I am successfully using for
'WritePixel(Window->RPort,x,y);' in the same function but when I try to use 
'Flood(Window->RPort,mode,x,y);'      nothing happens. Mode, x, and y are all
integers.  mode is set to one and x, and y are inside a shape. I know they are
correct. If I have called the library with WritePixel well enough to use it
isn't this also supposed to give me access to Flood?
         I'm not getting any errors or warning when I compile (lattice 3.03)
the program or link it. On execution the program just goes past it like it 
was a comment.  (It definitely is not inside comments. The next line down is
being used so accidental commenting is not a possible explanation)

    Could someone please give me a clue to stop me from bangin my head against
the wall?

dillon@CORY.BERKELEY.EDU (Matt Dillon) (10/02/86)

>   I am writing a program in which I need to fill irregular shapes. I have
>a pointer to a rastport from a window which I am successfully using for
>'WritePixel(Window->RPort,x,y);' in the same function but when I try to use 
>'Flood(Window->RPort,mode,x,y);'      nothing happens. Mode, x, and y are all
>integers.  mode is set to one and x, and y are inside a shape. I know they are
>correct. If I have called the library with WritePixel well enough to use it
>isn't this also supposed to give me access to Flood?
>         I'm not getting any errors or warning when I compile (lattice 3.03)
>the program or link it. On execution the program just goes past it like it 
>was a comment.  (It definitely is not inside comments. The next line down is
>being used so accidental commenting is not a possible explanation)

	I dunno, you could try:

	(A) SetAPen(Rp, pen)	(maybe your flooding the same color as the
				background?)

	(B) Setup an AreaInfo for your rastport

	I'm not sure whether you need the AreaInfo structure or not for
	Flood Fills, but it's the only thing I can think of that could
	possibly be wrong.  You probably have already discounted (A).

	Also, if you are using Manx and not Lattice, make sure the variables
	in the calling arguments are the right type (short/long, whichever
	the manual says).

					-Matt

perry@well.UUCP (Perry S. Kivolowitz) (10/02/86)

In article <535@zinfandel.UUCP>, donw@zinfandel.UUCP (Don White) writes:
> 
>    Help?
> 
>    I am writing a program in which I need to fill irregular shapes. I have
> a pointer to a rastport from a window which I am successfully using for
> 'WritePixel(Window->RPort,x,y);' in the same function but when I try to use 
> 'Flood(Window->RPort,mode,x,y);'      nothing happens. Mode, x, and y are all
> integers.  mode is set to one and x, and y are inside a shape. I know they are

Ahhhh. This one again? Did you allocate a TmpRas structure before calling Flood?
This one bit  me  on the ass  about  a year ago. Since then, I've heard of three
other people who made  the  same  mistake  I  did and after their enlightenment,
no problem!

Perry S. Kivolowitz

nevets@ihuxl.UUCP (Steven R Ringwood) (10/03/86)

>   I am writing a program in which I need to fill irregular shapes. ...
>'Flood(Window->RPort,mode,x,y);'      nothing happens.

It looks to me like you did not set the area fill pattern,
	somehing like SetPattern ?? (I don't have the manual handy).
	I do seem to remember that it defaults to all 0, giving
	you no fill if you do not set it.
	Hope this helps.
	
						Nevets
						

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (10/03/86)

In article <535@zinfandel.UUCP> donw@zinfandel.UUCP (Don White) writes:
>
>   I am writing a program in which I need to fill irregular shapes. I have
>a pointer to a rastport from a window which I am successfully using for
>'WritePixel(Window->RPort,x,y);' in the same function but when I try to use 
>'Flood(Window->RPort,mode,x,y);'      nothing happens.

   Although the Flood code fragment in the RK manual does not show
a TmpRas allocation, I believe you do need a TmpRas to use Flood.

  Declare or allocate a TmpRas structure.
  Use AllocRaster to allocate a TmpRas raster the size of one bit-plane
  Use InitTmpRas to initialize your TmpRas structure.
  Link the TmpRas structure to the RastPort you wnat to Flood() in
    by putting the address of your initialized TmpRas structure
    in yourRastPort->TmpRas.
 
  (now try Flood)

  And remember to FreeRaster the extra bit-plane you allocated in
  your program cleanup.


      
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=