[cairo] How cairo_pattern_set_matrix() works?
Silenio Quarti
Silenio_Quarti at ca.ibm.com
Fri Mar 18 09:43:59 PST 2005
What cairo_pattern_set_matrix() should do? Should it affect every
individual cell or the whole pattern coordinate system? It seems also
that the matrix have the inverse effect. If the matrix scaling portion
is 0.5, it actually enlarges the image, instead of reducing it.
For example, in the code below I was expecting 4 surfaces/pixmaps
of reduced size (30x30) to be drawn completely (one in which corner of the
rectangle (50,50, 60,60)), but instead the output is partial enlarged
images.
Is this the expected behavior?
Silenio
cairo_t cairo = ...
Pixmap pixmap = a 60x60 pixmap ...
cairo_surfce_t surface = cairo_xlib_surface_create(display, pixmap,
visual, 0, colormap);
cairo_pattern_t pattern = cairo_pattern_create_for_surface(surface);
cairo_pattern_set_extend(surface, CAIRO_EXTENT_REPEAT);
cairo_matrix_t matrix = cairo_matrix_create();
cairo_marix_translate(matrix, 50, 50);
cairo_marix_scale(matrix, 0.5, 0.5);
cairo_pattern_set_matrix(matrix);
cairo_set_pattern(cairo, pattern);
cairo_rectangle(cairo, 50, 50, 60, 60);
cairo_fill(cairo);
cairo_pattern_destroy(pattern);
cairo_matrix_destroy(matrix);
cairo_surface_destroy(surface);
More information about the cairo
mailing list