[cairo] Extents under rotation
psychon at znc.in
Thu Dec 5 12:43:45 PST 2013
On 04.12.2013 16:06, Donn wrote:
> you rotate a matrix, draw something and then use path_extents to measure
> it, you get a result that's bigger than it should be.
Depends on what you mean with "should". You get something that does contain the
path, but these extents are not necessarily tight (which means that "smaller
results would still be correct").
> On 01/12/2013 15:09, Chris Wilson wrote:
>> The extents is in userspace. The bounds are found in device space
>> and then rotated back to userspace. This introduces the enlargement
>> you see above.
> I don't follow. Could you say that in another way? (I'm not the smartest
> kid in the class. :P )
Cairo calculates the tight extents in device space, that is without any
rotation. Then it has to account for the rotation that is used. To do this, it
assumes that the path really is a rectangle that completely covers the extents
of the path in device space and returns the corresponding bounds for this in
user space. This rotation introduces the too-large-values that you are seeing.
I hope that explains were these too large extents come from. I don't have any
good input for how to calculate the values that you want. My bad input would be
an ugly wall of code, I guess.
A learning experience is one of those things that say,
'You know that thing you just did? Don't do that.'
-- Douglas Adams
More information about the cairo