[cairo] new pattern interface bug

Vladimir Vukicevic vladimir at pobox.com
Mon Apr 5 23:16:37 PDT 2004


Howdy,

I have some code that creates a surface from data (image data), and then 
renders the image like so:

	cairo_t *ct = ...;
	cairo_set_pattern (ct, image_surface);
	cairo_move_to (ct, x, y);
	cairo_rectangle (ct, x, y, width, height);
	cairo_fill (ct);

With the pattern patch, I changed this to:

	cairo_pattern_t *image_pattern = cairo_pattern_create_for_surface 
(image_surface);
	cairo_set_pattern (ct, image_pattern);
	... /* as above */
	cairo_pattern_destroy (image_pattern);

However, in the second case, the surface is always rendered at 0,0; or 
rather, it tries to be rendered there, but is clipped to the rect. 
(Note: I just noticed that the move_to is redundant, but I can't easily 
re-test this without the move_to atm :)  So, if the image is 100 pixels 
wide, and I render at x = 50, in the first case, the image is rendered 
from 50 to 150; in the second case, I only see the second "half" of the 
image, at x=50 to 100.

Am I doing something wrong with the (propsed) pattern interface?

Thanks,
	- Vlad





More information about the cairo mailing list