#include #include #include #include int main(int argc, char **argv) { double angle = 0.5, radmul=1; if (argc >= 2) angle = atof(argv[1]); cairo_surface_t *img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 200, 200); cairo_pattern_t *rg = cairo_pattern_create_radial(0, 0, 1, radmul*cos(angle), radmul*sin(angle), 0); cairo_pattern_add_color_stop_rgb(rg, 0.0, 0, 1, 0); cairo_pattern_add_color_stop_rgb(rg, 1.0, 1, 0, 0); cairo_t *ct = cairo_create(img); cairo_translate(ct, 100, 100); cairo_scale(ct, 10, -10); cairo_set_source(ct, rg); cairo_paint(ct); cairo_surface_write_to_png(img, "radial-focus.png"); return 0; }