[Lazarus] TCairoCanvas integration

petr.kristan at epos.cz petr.kristan at epos.cz
Thu Mar 11 14:54:48 CET 2010


On Thu, Mar 11, 2010 at 02:50:04PM +0100, Mattias Gaertner wrote:
> 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
I think this is good place for gdkcairocanvas.pas. But cairocanvas.pas
needs only libcairo. It do not needs gtk. 

Petr

-- 
Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709




More information about the Lazarus mailing list