src/theme/xbm/parse.c: generate cairo_surface

This commit is contained in:
Johan Malm 2020-06-26 21:52:38 +01:00
parent f86394a997
commit 40e862f3ac
3 changed files with 60 additions and 6 deletions

View file

@ -18,6 +18,17 @@ int main(int argc, char **argv)
tokens = xbm_tokenize(buffer);
free(buffer);
xbm_create_bitmap(tokens);
cairo_surface_t *surface = xbm_create_bitmap(tokens);
free(tokens);
if (!surface)
fprintf(stderr, "no surface\n");
char png_name[1024];
snprintf(png_name, sizeof(png_name), "%s.png", argv[1]);
if (cairo_surface_write_to_png(surface, png_name)) {
fprintf(stderr, "cannot save png\n");
exit(EXIT_FAILURE);
}
cairo_surface_destroy(surface);
exit(EXIT_SUCCESS);
}