[cairo] cairo_show_page vs win32

Stuart Parmenter stuartp at gmail.com
Tue Jan 31 13:33:29 PST 2006

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.


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.diff
Type: application/octet-stream
Size: 4155 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060131/3859b3a5/foo.obj

More information about the cairo mailing list