On Fri, May 25, 2007 at 01:35:16AM +0300, Hakki Dogusan wrote:

I need your advice for cairo_matrix_t; It is declared as:
typedef struct _cairo_matrix {
double xx; double yx;
double xy; double yy;
double x0; double y0;
} cairo_matrix_t;
And usage is like:
cairo_matrix_t matrix;
cairo_matrix_init_scale (&matrix, w * 5., h * 5.);
cairo_pattern_set_matrix (pattern, &matrix);
Which one of the following is "Lua way"/practical?
- named fields,ie:
matrix = {xx=.5, yx=1.0, xy=.9, yy=.3, x0=.3, y0=.2}

It looks like named fields would allow something more like:
matrix = cairo.matrix{scalex=0.5, scaley=0.5}
matrix = cairo.matrix{rotate=-0.2}
... similarly with the various _init() functions from
... http://cairographics.org/manual/cairo-cairo-matrix-t.html
... then operate on it like:
m0 = matrix:translate{tx=4} -- ty = 0, by default
m = m0 * matrix