Board index » delphi » Floodfill doesn't work on Printer.Canvas

Floodfill doesn't work on Printer.Canvas

I want to use Printer.Canvas.Floodfill but it seems that when I want do
this the Rectangle isn't drawn to the Printer.Canvas yet.
Any suggestions?? Do I need to update the Printer.Canvas before using
floodfill? How do I do this?

Printer.BeginDoc;
Printer.Canvas.Brush.Color := clWhite;
Printer.Canvas.Pen.Color := ClBlack;
Printer.Canvas.Pen.Width := 10;
Printer.Canvas.Rectangle(100, 100, 300, 300);
Printer.Canvas.Brush.Color := clRed;
Printer.Canvas.FloodFill(200, 200, ClWhite, fsSurface);
Printer.EndDoc;

I use delphi 3
--
Peter Van der Voort
Bits & Pieces
e-mail: Peter.Vandervo...@ping.be

 

Re:Floodfill doesn't work on Printer.Canvas


On 14 Dec 1997 23:34:53 GMT, "Peter Van der Voort"

Quote
<Peter.VanDerVo...@ping.be> wrote:
>I want to use Printer.Canvas.Floodfill but it seems that when I want do
>this the Rectangle isn't drawn to the Printer.Canvas yet.

Many GDI drivers, particularly printer drivers, don't support
floodfill. It sounds like the driver for your printer is one of them.

My general recommendation is to avoid floodfill entirely.

-Steve

Re:Floodfill doesn't work on Printer.Canvas


Ok but what is the alternative then?
I use a Canon BJC 5500 whith A2 paper (42 X 60 cm) (5760 X 8277 pixels).
I put pixels on the printer canvas to get very irregular polygons that I
want to color in.
The printer canvas is tool large to prepare the image using offscreen
bitmaps. And using the pixel function to color every single pixel will take
ages.
Can I write some algorithm that performs the same function as floodfill?
--
Peter Van der Voort
Bits & Pieces
e-mail: Peter.Vandervo...@ping.be

Steve Schafer (TeamB) <pand...@telepath.com> wrote in article
<34997aeb.191691...@forums.borland.com>...

Quote
> On 14 Dec 1997 23:34:53 GMT, "Peter Van der Voort"
> <Peter.VanDerVo...@ping.be> wrote:

> >I want to use Printer.Canvas.Floodfill but it seems that when I want do
> >this the Rectangle isn't drawn to the Printer.Canvas yet.

> Many GDI drivers, particularly printer drivers, don't support
> floodfill. It sounds like the driver for your printer is one of them.

> My general recommendation is to avoid floodfill entirely.

> -Steve

Re:Floodfill doesn't work on Printer.Canvas


On 15 Dec 1997 22:48:14 GMT, "Peter Van der Voort"

Quote
<Peter.VanDerVo...@ping.be> wrote:
>Can I write some algorithm that performs the same function as floodfill?

Yes, there are a number of floodfill algorithms you could use. I don't
have any appropriate references on hand, but I know that various
graphics books have treated the subject.

-Steve

Re:Floodfill doesn't work on Printer.Canvas


pand...@telepath.com (Steve Schafer (TeamB)) wrote:

Quote
>On 14 Dec 1997 23:34:53 GMT, "Peter Van der Voort"
><Peter.VanDerVo...@ping.be> wrote:

>>I want to use Printer.Canvas.Floodfill but it seems that when I want do
>>this the Rectangle isn't drawn to the Printer.Canvas yet.

>Many GDI drivers, particularly printer drivers, don't support
>floodfill. It sounds like the driver for your printer is one of them.

>My general recommendation is to avoid floodfill entirely.

Could this be the reason why Floodfill does not work properly during
Repaint?  When dragging another window across a window that uses
Floodfill it does not 'fill'.  The area filled depends on how fast you
drag the top window.

Regards,
Chris Roberts

Re:Floodfill doesn't work on Printer.Canvas


"Peter Van der Voort" <Peter.VanDerVo...@ping.be> wrote:

Quote
>I use a Canon BJC 5500 whith A2 paper (42 X 60 cm) (5760 X 8277 pixels).
>I put pixels on the printer canvas to get very irregular polygons that I
>want to color in.
>The printer canvas is tool large to prepare the image using offscreen
>bitmaps.

If your indiviual polygons are small enough, why not just draw one polygon
at a time to an adequately sized offscreen bitmap, FloodFill it, and blt
the result to the printer?

- Tim Roberts, t...@probo.com
  Providenza & Boekelheide, Inc

Re:Floodfill doesn't work on Printer.Canvas


On Tue, 16 Dec 1997 16:38:34 GMT, cdrobert_nos...@ctel.com.au (Chris

Quote
Roberts) wrote:
>Could this be the reason why Floodfill does not work properly during
>Repaint?

Possibly. Floodfill is a can of worms best left unopened, as far as
I'm concerned.

-Steve

Re:Floodfill doesn't work on Printer.Canvas


On 15 Dec 1997 22:48:14 GMT, "Peter Van der Voort"

Quote
<Peter.VanDerVo...@ping.be> wrote:
>Can I write some algorithm that performs the same function as floodfill?

Another alternative would be to draw the "flooded" region first, as a
rectangle or some other simple polygon, and then draw the other more
complex polygons on top of that.

-Steve

Re:Floodfill doesn't work on Printer.Canvas


Have you tried to use the Polygon Method?
I don't have any experience with Printer-drawing, but I use the Polygon
Method for Screen-polygons and it works fine.

example:

Printer.BeginDoc;
Printer.Canvas.Brush.Color := clRed;
Printer.Canvas.Pen.Color := ClBlack;
Printer.Canvas.Pen.Width := 10;
Printer.Canvas.Polygon([100,100],[300,100],[300,300],[100,300]);
Printer.EndDoc;

Steven Brom
J.S.B...@bk.TUdelft.nl

Other Threads