Board index » delphi » FloodFill does not work with TPrinter.Canvas!

FloodFill does not work with TPrinter.Canvas!

FloodFill simply does not work on the
TPrinter.Canvas. For example, the
following line of code does nothing:

Printer.Canvas.FloodFill(100,100,clYellow,fsBorder)
;

FloodFill works with screen canvases but
not printer.canvas. To get around this
problem I tried to use CopyRect to copy
the entire tprinter.canvas to a
tbitmap.canvas and then either print the
tbitmap.canvas or move the
tbitmap.canvas back to tprinter.canvas
with either the CopyRect command or the
Draw command. None of this worked.
Consequently there appears to be no way
to fill fill irregularly shaped areas on
a printout! I tried this in Delphi 2 and
Delphi 4. Frustrating! Anyone know how
to get around this problem?

David Cochrane
e-mail: kep...@patterns.com

 

Re:FloodFill does not work with TPrinter.Canvas!


An alternative to FloodFill is to use Win32 paths.  You draw a path
around the irregular region and then call FillPath.  See BeginPath in
the Win32 reference to get started.

On Fri, 22 Jan 1999 14:02:28 -0500, Cosmic Patterns

Quote
<kep...@patterns.com> wrote:
>Consequently there appears to be no way
>to fill fill irregularly shaped areas on
>a printout! I tried this in Delphi 2 and
>Delphi 4. Frustrating! Anyone know how
>to get around this problem?

Chris Hill
Chris...@aol.com

Re:FloodFill does not work with TPrinter.Canvas!


The porblem is you cannot do raster operations
like that on a printer canvas. You should not
send raster images based on the screen to
the printer. It may work on some print
drivers, but you may bring down the entire
OS on other systems.

If you must use a raster image, make sure its
monochrome, or convert it to a DIB (device independent
bitmap) and send it to the printer using a DIB
function such as StretchDiBits().

Joe

Quote
Cosmic Patterns wrote:

> FloodFill simply does not work on the
> TPrinter.Canvas. For example, the
> following line of code does nothing:

> Printer.Canvas.FloodFill(100,100,clYellow,fsBorder)
> ;

> FloodFill works with screen canvases but
> not printer.canvas. To get around this
> problem I tried to use CopyRect to copy
> the entire tprinter.canvas to a
> tbitmap.canvas and then either print the
> tbitmap.canvas or move the
> tbitmap.canvas back to tprinter.canvas
> with either the CopyRect command or the
> Draw command. None of this worked.
> Consequently there appears to be no way
> to fill fill irregularly shaped areas on
> a printout! I tried this in Delphi 2 and
> Delphi 4. Frustrating! Anyone know how
> to get around this problem?

> David Cochrane
> e-mail: kep...@patterns.com

--
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm

Other Threads