potato man
potato man

Reputation: 151

Text Rotation in Cairo

I want to rotate text in Cairo, for that I am using a function : cairo_rotate(m_cr, angle), to rotate by angle radians. Now to unset the angle to start normal text rendering, should I call cairo_rotate(m_cr, - angle) function or cairo_rotate(m_cr, 0.0), I mean is the rotation in cairo cumulative ?

Upvotes: 3

Views: 2877

Answers (1)

Uli Schlachter
Uli Schlachter

Reputation: 9867

Rotation (and all other transformations) are cumulative.

However, IMHO it's nicer to use cairo_save(cr); cairo_rotate(cr, angle); and later cairo_restore(cr); to undo the effect. This will also work correctly for other kind of transformations, resets the current clip and the current source. In fact, cairo_restore restores everything but the current path.

Upvotes: 3

Related Questions