[cairo] cairo_show_page vs win32

Owen Taylor otaylor at redhat.com
Tue Jan 31 02:23:52 PST 2006


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

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.


Regards,
						Owen

BTW - I believe there was general consensus that having to call 
cairo_show_page() before finish() to avoid a blank PDF/PS document was
a bug and a bad one at that; if that bug is present, we shouldn't
spend effort duplicating it for the Win32 backend :-)





More information about the cairo mailing list