[Lazarus] TCairoCanvas integration

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Mar 11 14:50:04 CET 2010


On Thu, 11 Mar 2010 14:41:18 +0100
petr.kristan at epos.cz wrote:

> On Thu, Mar 11, 2010 at 02:23:15PM +0100, Michael Van Canneyt wrote:
> >
> >
> > On Thu, 11 Mar 2010, petr.kristan at epos.cz wrote:
> >
> >> On Wed, Mar 10, 2010 at 03:22:31PM +0100, petr.kristan at epos.cz wrote:
> >>> Hi.
> >>>
> >>> Main work on TCairoCanvas = class(TPrinterCanvas) is almost done.
> >>>
> >>> My question is how to integrate it into LCL?
> >>> IMHO user should have a choice which TPrinterCanvas implementation use.
> >>> Now in TCUPSPrinter is hard coded TPostscriptPrinterCanvas:
> >>>
> >>> function TCUPSPrinter.GetCanvasRef: TPrinterCanvasRef;
> >>> begin
> >>>   Result:=TPostscriptPrinterCanvas;
> >>> end;
> >>>
> >>> Petr
> >>>
> >> Nobody here, who can halp me to integrate TCairoCanvas into LCL?
> >>
> >> Were in LCL directory structure place cairocanvas.pas (depends only on
> >> libcairo) and gdkcairocanvas.pas (depends extra on libgdk).
> >>
> >> How should programer select which implementation of TPrinterCanvas will
> >> be created in TPrinter.GetCanvas.
> >>
> >> Now TCUPSPrinter implementation use hard coded TPostscriptPrinterCanvas
> >> and needs access to TPostscriptPrinterCanvas(Canvas).OutputFileName.
> >> My TCairoCanvas implementation has the same needs.
> >>
> >> I do not want to waste my time if comunity do not have an interest to
> >> include CairoCanvas into lcl.
> >
> > I think you should create an abstract TFilePrinterCanvas descendent of
> > TPrinterCanvas (with the needed FileName property) and define a variable
> >
> > Type
> >   TFilePrinterCanvas = Class of TFilePrinterCanvas;
> >
> > Var
> >   CupsCanvasClass : TFilePrinterCanvas = TPostscriptPrinterCanvas;
> >
> > which the programmer can set, if so desired. then the
> > TCUPSPrinter.GetCanvasRef
> > implementation checks the CupsCanvasClass variable. If it is set,
> > it uses the class defined there, and if not, it uses
> > TPostscriptPrinterCanvas.
> Thanks.
> 
> This corresponds with my idea. 
> 
> Where is recommeded place for cairocanvas.pas and gdkcairocanvas.pas in
> lcl? CairoCanvas can work on Windows, Linux and Mac OS X. 

lcl/interfaces/gtk2

Mattias




More information about the Lazarus mailing list