[cairo] request for cairo_win32_surface_get_width/height()

Theo Veenker T.J.G.Veenker at uu.nl
Tue Apr 28 12:28:43 PDT 2009

Bill Spitzak wrote:
> Vladimir Vukicevic wrote:
>> On 4/28/09 1:08 AM, Theo Veenker wrote:
>>> Hi,
>>> I like to request cairo_win32_surface_get_width/height() to be added to

> It would however be nice to access the size with code that is portable 
> between X and Windows and also all other cairo targets. Currently fltk 
> keeps the window size in static variables parallel with the static 
> cairo_t, as programs certainly do need it. It seems wrong that this is 
> redundant with info that is in the xlib cairo_t but I am forced to do 
> this because the others don't have it.

I saw some apps which attach a user data structure (containing width/height)
to the cairo surface. It allowed them to create their own getwidth/getheight
methods. That's an ugly workaround for something that could have been solved
elegantly if we had cairo_win32_surface_get_width/height().

> Just like the X version, I think it is acceptable for the Windows 
> implemenmtation to require the caller to handle the resize events and 
> update the context itself (ie Cairo should not handle events or make 
> Windows calls to get the size). This is easily hidden in toolkit support 
> code.
> It would be nice to have some more parity between cairo on the different 
> platforms. The ability to change the size and target of an Xlib cairo 
> context is very useful and on Xlib I use exactly one Cairo context, 
> reusing it for every window and paint event. It would remove a lot of 
> ugly code if I could do this on Windows and OS/X. Conversely, if such 
> retargeting is a bad idea, the Xlib version should *not* be supporting 
> it either, because it certainly encouraged me to use it!

Fully agree.

BTW what happened to the idea of adding cairo_surface_get_width/height?
See thread http://lists.cairographics.org/archives/cairo/2006-June/thread.html#7083
Maybe a backend independent cairo_surface_get_width/height() cannot be added
at this moment. Are are there any objections by cairo developers against
adding at least cairo_win32_surface_get_width/height() to the todo list?


More information about the cairo mailing list