#include #include #include int main( int argc, char **argv ) { cairo_surface_t *surface; cairo_pattern_t *pattern; cairo_surface_t *image; int width = 640, height = 480; uint8_t *data; cairo_t *cr; /* Create a nil image surface */ image = cairo_image_surface_create_from_png ("does-not-exist.png"); data = malloc (width * height * 4); surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32, width, height, width * 4); cr = cairo_create (surface); pattern = cairo_pattern_create_for_surface (image); cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); cairo_set_source (cr, pattern); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); cairo_destroy (cr); cairo_surface_destroy( surface ); return 0; }