[cairo] cairo_show_page vs win32

Stuart Parmenter stuartp at gmail.com
Tue Jan 31 13:59:53 PST 2006


I would really like to see cairo add more printing related APIs so
that all platforms can actually work without trying to do lazy
startpage/endpage.   Things like
cairo_begin_printing(title,randommetadataobject,whatever),
cairo_end_printing(), cairo_begin_page(), cairo_end_page(),
cairo_abort_printing() along with backend functions for these.  These
could go along with some of the APIs suggested on
http://live.gnome.org/GtkTeamPrintingBreakout

I would suggest changing show_page call begin_page/end_page as needed
so that it behaves the same.

thanks,
stuart

On 1/31/06, Stuart Parmenter <stuartp at gmail.com> wrote:
> Here's a patch I had been playing around with a while ago.  It should
> work, although it has similar problems to clipping in that it won't
> trigger if we have to draw directly to the DC.  There is still no good
> spot in cairo for BeginDoc, EndDoc and AbortDoc in cairo, so for now
> I've left our StartPage/EndPage calls external as well.
>
> stuart
>
> On 1/31/06, Alexander Larsson <alexl at redhat.com> wrote:
> > On Tue, 31 Jan 2006, Owen Taylor wrote:
> >
> > > On Tue, 2006-01-31 at 07:00 -0500, Alexander Larsson wrote:
> > > > How is cairo_show_page() meant to be implemented on win32? At the moment
> > > > its not implemented at all, but for printint to work we really need it.
> > > > Unfortunately the win32 API consists of a StartPage/EndPage pair, where
> > > > you have to draw your stuff inbetween calling these.
> > > >
> > > > It is possible to call StartPage when creating the surface from the HDC,
> > > > and make cairo_show_page() do "EndPage(); StartPage();". However, this will
> > > > cause an extra StartPage() to be called after the last page.
> > > >
> > > > Is there a better way to handle this?
> > >
> > > I'd say in general that with the design of the Win32 backend having
> > > Cairo do the StartPage() and EndPage() calls is a bit weird; it would
> > > make more sense in general for it to look like the GDI+ example at:
> > >
> > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/usingGDIPlus/printing/sendingGDIPlusoutputtoaprinter.asp
> >
> > This is the way i'm handling this atm. And i agree it makes sense. It also
> > allows me to use the win32 api to do things like setting page size and
> > orientation, avoiding having to implement that via cairo.
> >
> > > But since we have cairo_show_page() we probably need to make it work
> > > on Win32 ... it certainly should be pretty easy to make the StartPage()
> > > lazy and only occur on the first drawing operation; the set of entry
> > > points into  cairo-win32-surface.c that actually result in drawing is
> > > small.
> >
> > However, the existance of cairo_show_page () sort of muddies this. If i
> > manually call StartPage, then this can be screwed up if cairo also calls
> > StartPage on the first drawing operation, but cairo needs to do that to
> > make sho_page work.
> >
> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >  Alexander Larsson                                            Red Hat, Inc
> >                    alexl at redhat.com    alla at lysator.liu.se
> > He's a lonely moralistic master criminal plagued by the memory of his family's
> > brutal murder. She's a mistrustful renegade research scientist from beyond the
> > grave. They fight crime!
> > _______________________________________________
> > cairo mailing list
> > cairo at cairographics.org
> > http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> >
>
>
>


More information about the cairo mailing list