Putting color in flood fills. 
Author Message
 Putting color in flood fills.

How do you put color in flood fills?

I wrote the following program.

-------------------------------------------------------------
program flood;
uses Graph;
var Gd, Gm: Integer;
begin
 Gd := Detect;
 InitGraph(Gd, Gm, '');
 if GraphResult <> grOk then halt(1);
 SetColor(4);
 line(10,10,10,90);
 line(10,90,60,90);
 line(60,90,60,70);
 line(60,70,90,70);
 line(90,70,90,60);
 line(90,60,30,60);
 line(30,60,30,10);
 line(30,10,10,10);
 readln;
 setcolor(6);
 FloodFill(11, 11, 4);
 Readln;
 CloseGraph;
end.
-----------------------------------------------------------

The docs say that it should fill in with the currently used color, but
EVERY TIME I fill in the drawing that I make with this program, the
outline of the shape is red (which I want) but the inside fills in as
white even when I don't want it to be white. What am I doing wrong?

-Patrick-



Wed, 18 Jun 1902 08:00:00 GMT  
 Putting color in flood fills.



Quote:
> How do you put color in flood fills?

> I wrote the following program.

> -------------------------------------------------------------
> program flood;
> uses Graph;
> var Gd, Gm: Integer;
> begin
>  Gd := Detect;
>  InitGraph(Gd, Gm, '');
>  if GraphResult <> grOk then halt(1);
>  SetColor(4);
>  line(10,10,10,90);
>  line(10,90,60,90);
>  line(60,90,60,70);
>  line(60,70,90,70);
>  line(90,70,90,60);
>  line(90,60,30,60);
>  line(30,60,30,10);
>  line(30,10,10,10);
>  readln;
>  setcolor(6);
>  FloodFill(11, 11, 4);
>  Readln;
>  CloseGraph;
> end.
> -----------------------------------------------------------

> The docs say that it should fill in with the currently used color, but
> EVERY TIME I fill in the drawing that I make with this program, the
> outline of the shape is red (which I want) but the inside fills in as
> white even when I don't want it to be white. What am I doing wrong?

> -Patrick-

Hi, Patrick,

Somewhere in here, before your call to FloodFill(), you need the line:
    SetFillStyle( SOLIDFILL, your color choice );

HTH, Doug Lurie



Wed, 18 Jun 1902 08:00:00 GMT  
 Putting color in flood fills.

Quote:
> How do you put color in flood fills?

you add a SetFillStyle statment

Quote:
>  line(30,10,10,10);
>  readln;
>  setcolor(6);

SetFillStyle(1, fillcolor);

Quote:
>  FloodFill(11, 11, 4);
>  Readln;
>  CloseGraph;

A programmer's life is the computer they use (you know, the one they

screw up so much)



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. FLOOD FILL

2. FLOOD FILL

3. Changing Color of Selection Fill

4. 256 color image on a 16 color screen?

5. Windows Pascal 1.5 - Text color & Background color

6. Problem printing color bitmap on color printer wih TPW 1.5

7. Windows Pascal 1.5 - Text color & Background color

8. I like to print color Line graphics, text color in a hp deskject

9. COLORS COLORS

10. COLORS COLORS

11. 24-bit color to 256 color's source

12. Delphi: 16 color bitmap w/non-system colors

 

 
Powered by phpBB® Forum Software