[cairo] RFC: introduce cairo_surface_get_height() / width()

Adrian Johnson ajohnson at redneon.com
Sat Jul 9 12:15:01 UTC 2016

On 09/07/16 00:40, Uli Schlachter wrote:
> Hi,
> Am 08.07.2016 um 11:43 schrieb Enrico Weigelt, metux IT consult:
>> retrieving surface dimensions currently only works by surface-type
>> specific functions, which isn't particularily good encapsulation.
> [...]
>> So, should we introduce generic functions (and corresponding
>> backend ops) for that ?
> What's the size of an unbounded surface?
> cairo_recording_surface_create(CAIRO_CONTENT_COLOR, NULL); creates a surface
> which conceptually has no size limit.

And can also create a surface with a non zero origin. A
cairo_surface_extents() function would be better that a get width/height.

> By the way, there is already a "generic hack" that does what you want. Create a
> new cairo context and ask for its clip extents:
> https://github.com/awesomeWM/awesome/blob/b33fb2a03a2a49b71820e337fc548663203537df/lib/gears/surface.lua#L125-L129
> For unbounded surfaces, you get x1=y1=-INFINITY and x2=y2=INFINITY (no idea if
> this is guaranteed by the documentation, but at least the current implementation
> in _cairo_default_context_clip_extents() does this.
> Cheers,
> Uli

More information about the cairo mailing list