64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stdarg.h>
|
||
|
#include <string.h>
|
||
|
#include <math.h>
|
||
|
|
||
|
#include <sys/time.h>
|
||
|
|
||
|
#include <cairo-svg.h>
|
||
|
|
||
|
#include <hexagram/cluster.h>
|
||
|
|
||
|
static int usage(int argc, char **argv, const char *message, ...) {
|
||
|
if (message) {
|
||
|
va_list args;
|
||
|
|
||
|
va_start(args, message);
|
||
|
vfprintf(stderr, message, args);
|
||
|
fprintf(stderr, "\n");
|
||
|
va_end(args);
|
||
|
}
|
||
|
|
||
|
fprintf(stderr, "usage: %s output.svg\n", argv[0]);
|
||
|
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv) {
|
||
|
hexagram_cluster *cluster;
|
||
|
|
||
|
int width = 1024,
|
||
|
height = 480;
|
||
|
|
||
|
cairo_surface_t *surface;
|
||
|
|
||
|
cairo_t *bg;
|
||
|
|
||
|
if (argc != 2) {
|
||
|
return usage(argc, argv, "No output SVG file specified");
|
||
|
}
|
||
|
|
||
|
if ((cluster = hexagram_cluster_new(width, height)) == NULL) {
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
surface = cairo_svg_surface_create(argv[1], width, height);
|
||
|
|
||
|
/*
|
||
|
* Set up the rendering surfaces
|
||
|
*/
|
||
|
bg = cairo_create(surface);
|
||
|
|
||
|
/*
|
||
|
* Draw the background layer
|
||
|
*/
|
||
|
hexagram_cluster_draw_bg(cluster, bg);
|
||
|
|
||
|
cairo_destroy(bg);
|
||
|
|
||
|
cairo_surface_destroy(surface);
|
||
|
|
||
|
return 0;
|
||
|
}
|