💾 Archived View for heavysquare.com › visuals › 0112-init.c.txt captured on 2021-12-04 at 18:04:22.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
#include<cairo.h> #include<stdlib.h> #include<string.h> int main (int argc, char *argv[]) { int seed = atoi(argv[1]); if(argc<2) exit(1); srand(seed); double w = 900., h = 900.; char fn[200]; strcpy(fn, "v"); strcat(fn, argv[1]); strcat(fn, ".png"); cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h); cairo_t *cr = cairo_create (surface); cairo_set_source_rgb (cr, 1, 1, 1); cairo_rectangle (cr, 0, 0, w, h); cairo_fill (cr); int i=0; for(;i<100;++i) { cairo_set_line_width (cr, 1.+(rand()%10)); cairo_set_source_rgba (cr, 0.5-seed/30. + (rand()%400)/800., seed/30. +(rand()%400)/1600.,seed/15., 1); int x0 = 10 + rand()%((int)w-100); int y0 = 10 + rand()%((int)h-100); int xoff = 80+ rand()%((int)w-x0-89); int yoff = 80+ rand()%((int)h-y0-89); cairo_move_to(cr, x0, y0); cairo_rel_line_to (cr, xoff, yoff); cairo_stroke (cr); } cairo_destroy (cr); cairo_surface_write_to_png (surface, fn); cairo_surface_destroy (surface); return 0; }