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

Uli Schlachter psychon at znc.in
Fri Jul 8 15:10:14 UTC 2016


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.

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
-- 
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?


More information about the cairo mailing list