[cairo] [patch] enable projective transformations
mkbosmans at gmail.com
Sat Aug 14 06:10:20 PDT 2010
This is a first attempt to add projective transformations to Cairo. It
is far from complete, but mostly meant to get the discussion going
about how such a feature should be implemented.
The patch does the following:
- add px and py, the first two elements of the bottom row to
cairo_matrix_t. These where until now always assumed zero.
- modify the function in cairo-matrix.c to respect these elements in
all matrix operations and checks.
- change cairo_rel_line_to such that it does the correct thing.
So is adding px and py the right approach? (btw. may be there are some
more appropriate names for these elements)
As now eight elements of the 3x3 matrix are explicitly defined and
only the last one assumed 1, it may be better to switch all the matrix
code to use the pixman floating point matrix.
The main problem with adding projective transformations is that
translational invariance isn't guaranteed anymore. So that means that
probably all uses of cairo_matrix_transform_distance must be changed.
As an example I changed cairo_rel_line_to to add the distances to the
current point itself.
If it is decided that this patch uses the right approach, at least
these things have to be addressed for the patch to be complete:
- Check the test suite, right now there will undoubtedly be failures.
- Add some tests to check the projective transforms.
- Adapt other rel_ function not to use transform_distance.
- Check how the performance is affected, mainly for the
non-projective case. Although there are some divisions added by the
patch, I suspect that the matrix operations aren't that performance
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 9881 bytes
Desc: not available
More information about the cairo