[cairo] [PATCH 0/6 v0] RFC: Projective transformation

Bryce Harrington bryce at osg.samsung.com
Fri Nov 28 20:31:18 PST 2014

This resurrects a patch proposed some years back for adding 2d
projective transformation support to Cairo.  I've reviewed and updated
the patch for the current codebase, and made a test demo to try it out.
There's a bug that occurs on rotational transformations that I haven't
figured out -- suggestions appreciated.

You might recall that this time last year there was a discussion here
about 4x4 matrices in Cairo for doing more advanced 3d transformations.
There were doubts expressed about whether that would stretch Cairo's
focus too far.  However, 2d projective transformation requires only 2
elements to added to Cairo's matrix support so perhaps is more

I'll follow up with the demo program code.  This displays a simple
geometry transformed using each of the different basic matrix operations
along with the same including projective components for comparison.

In the demo program you can see the bug in the rotation transformation.
Even without any projective transformation applied the rotation is
behaving weirdly.  If the demo program is built against vanilla cairo,
this bug does not occur.

Bryce Harrington (6):
  Enable projective transforms
  matrix: Update code docs for projective transform
  matrix: Refactor out two temporary variables
  matrix: Make the other *_rel_* routines non-relative internally
  path: Don't use fast path if there is projective transformation

 src/cairo-default-context.c |   70 +++++++++++----
 src/cairo-gstate.c          |    7 ++
 src/cairo-matrix.c          |  208 ++++++++++++++++++++++++++++++-------------
 src/cairo-path-fixed.c      |    2 +-
 src/cairo-pen.c             |    2 +-
 src/cairo.h                 |   12 ++-
 src/cairoint.h              |    6 +-
 7 files changed, 219 insertions(+), 88 deletions(-)


More information about the cairo mailing list