diff options
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 54 |
1 files changed, 2 insertions, 52 deletions
@@ -203,8 +203,8 @@ int print_dimensions(struct dimensions *d) { printf("month_top_corner_y: %f\n", d->month_top_corner_y); printf("day width: %.2f\n", d->day_width); printf("day height: %.2f\n", d->day_height); - printf("header width: %.2f\n", d->header_width); - printf("header height: %.2f\n", d->header_height); + //printf("header width: %.2f\n", d->header_width); + //printf("header height: %.2f\n", d->header_height); return 0; } @@ -359,56 +359,6 @@ int draw_month_title(cairo_t *c, struct dimensions *d, char *font_family, int fo } - - -// Draw an image at a specified point -int draw_image(cairo_t *c, char *path, double x, double y) { - cairo_surface_t *image; - - // Checks if the file exists. If it doesn't, warn the user that it was not found. - // A file not existing will not terminate the program, but simply not render the image. - FILE *file; - if((file = fopen(path, "r")) != NULL) - { - // file exists - fclose(file); - } - else - { - printf("Warning: image \'%s\' does not exist.\n", path); - return 1; - } - - image = cairo_image_surface_create_from_png(path); - cairo_set_source_surface(c, image, x, y); - cairo_paint(c); - - cairo_surface_destroy (image); - return 0; -} - - - - -// Draw month art -int draw_month_art(cairo_t *c, struct dimensions *d, char *path) { - cairo_save(c); - double width = d->header_width; - // TODO: Make this relative to text height - double height = d->header_height - (d->margin * 3.0); - - double cursor_x = d->margin; - double cursor_y = d->margin; - cairo_rectangle (c, d->margin, d->margin, width, height); - cairo_clip(c); - - - draw_image(c, path, cursor_x, cursor_y); - cairo_restore(c); - return 0; -} - - //int draw_weekday_names(cairo_t *c, struct dimensions *d) { // //} |
