#include #include "draw.h" static FILE *file; int draw_init(char *file_name, unsigned width, unsigned height) { file = fopen(file_name, "w"); if (!file) { fprintf(stderr, "unable to create file [%s]\n", file_name); return -1; } if (fprintf(file, "\n\n" " \n", width, height) < 0) return -1; return 0; } int draw_line(int x1, int y1, int x2, int y2, unsigned stroke_width, unsigned r, unsigned g, unsigned b) { if (fprintf(file, " \n", x1, y1, x2, y2, r, g, b, stroke_width) < 0) return -1; return 0; } int draw_close(void) { if (fprintf(file, "\n") < 0) return -1; fclose(file); return 0; }