diff options
Diffstat (limited to 'src/calp.c')
| -rw-r--r-- | src/calp.c | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -10,6 +10,9 @@ #define A4_WIDTH 210 #define A4_HEIGHT 297 +#define US_LETTER_WIDTH 216 +#define US_LETTER_HEIGHT 279 + // Font Settings #define FONT_FAMILY "Sans" #define FONT_SIZE_NORMAL 10 @@ -18,9 +21,15 @@ int main (void) { // Definitions // ----------- + //double width = US_LETTER_WIDTH; + //double height = US_LETTER_HEIGHT; + + double width = A4_WIDTH; + double height = A4_HEIGHT; + // Convert to inches, then 1 unit = 1/72th inch - double width = (A4_WIDTH / 25.4) * 72.0; - double height = (A4_HEIGHT / 25.4) * 72.0; + width = (width / 25.4) * 72.0; + height = (height / 25.4) * 72.0; extern char *months[]; int num_of_months = 12; @@ -33,6 +42,8 @@ int main (void) { // Create dimensions struct to hold measurements struct dimensions dim; + struct month_info month; + // Leap year adjustment: increment February day count by one int year = 2026; @@ -73,14 +84,27 @@ int main (void) { //print_dimensions(&dim); // Draw all months + // + struct RGB color; + + color = hex_to_rgb("#81bbd3"); + + printf("red: %f\n", color.r); + printf("green: %f\n", color.g); + printf("blue: %f\n", color.b); + for (int i = 0; i < num_of_months; i++) { + // Set the + month.first_day = day_of_week(1, i + 1, year); + month.num_of_days = days_in_month[i]; cairo_set_source_rgb (paper, 0.0, 0.0, 0.0); draw_month_title(paper, &dim, months[i]); - calculate_minimum_rows(day_of_week(1, i + 1, year), days_in_month[i], &dim); + calculate_minimum_rows(&month, &dim); - draw_month(paper, cd, day, &dim, days_in_month[i], day_of_week(1, i + 1, year)); + draw_month(paper, cd, day, &month, &dim); + draw_month_grid(paper, &month, &dim); // Go to next page in pdf cairo_show_page(paper); |
