[cairo] cairo_matrix_t

Bill Spitzak spitzak at d2.com
Thu Nov 4 14:23:57 PST 2004


On Thursday 04 November 2004 11:08 am, Carl Worth wrote:

> Or we could just expose a 6-element double array named cairo_matrix_t,
> drop "affine" from the current functions.

This is probably the right solution. The problem with doing projections is 
that Cairo defines the current projection as affecting the pen and font. This 
means that if 3D was supported Cairo could only draw what looks like the 2D 
image mapped to a flat surface. This is easily achieved by mapping a 2D image 
using a 3D projection. I think there would be a lot more interest in using 
Cairo to draw nice line drawings of 3D figures and label parts of 3D like 
OpenGL does with screen-aligned labels. This can be achieved right now by 
doing the 3D transforms before asking Cairo to draw, and I think Cairo could 
only provide a useful interface by doing the 3D projection seperately from 
the 2D part. Thus it may be best to ignore 3D for now and assumme it will be 
a seperate part if it ever appears.

I'm unsure if beziers correctly 3D project by just projecting the control 
points and then doing 2D, does anybody know? Certainly the result looks 
really close. This is the only problem other than speed I can see with Cairo 
not doing 3D.

> Oh, but that's with respect to the CTM and geometry transformation. For
> the pattern matrix, we may want to expose projective transformation
> today since all the backends already support it, right?

I believe this would be very useful as it is the only part of drawing a 3D 
graphic that cannot be done by the calling program. And I believe all 
hardware that can do any such transformation can do this. Also I made a 
scheme described here: http://mysite.verizon.net/spitzak/circle.html that
shows how 3D projection can produce radial patterns where the bright point is 
not in the middle of the circle.




More information about the cairo mailing list