[cairo] cairo_show_page vs win32

Alexander Larsson alexl at redhat.com
Tue Jan 31 05:50:48 PST 2006


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! 


More information about the cairo mailing list