aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorfoswret <foswret@posteo.com>2025-12-11 20:22:55 -0600
committerfoswret <foswret@posteo.com>2025-12-11 20:22:55 -0600
commitde77826633fc128b915e999a9adf10f088b4d3f3 (patch)
tree65cbe77d7c04cc7fc3bb84a64e6b80889675a0d8 /main.c
parent0ea73247a8ba4036567a9dc28b6133d4b58507b3 (diff)
added src/, updated README.md
Diffstat (limited to 'main.c')
-rw-r--r--main.c99
1 files changed, 0 insertions, 99 deletions
diff --git a/main.c b/main.c
deleted file mode 100644
index 51fb86d..0000000
--- a/main.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Standard Libraries */
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <time.h>
-
-/* Cairo Libraries */
-#include <cairo/cairo-pdf.h>
-#include <cairo/cairo.h>
-
-/* calp Libraries */
-#include "color.h"
-#include "date.h"
-#include "draw.h"
-
-
-// int main (int argc, char *argv[]) {
-int main (void) {
- /* Dimension initialization */
- int rows = 5; /* Number of weeks in a month */
- int columns = 7; /* Number of days in a week */
- double margin = 0.5; /* 0.5" */
- int number_of_days = 28;
-
- double month_origin_x = margin;
- double month_origin_y = 3.0;
- double paper_width = 8.5;
- double paper_height = 11;
- double month_width = paper_width - (month_origin_x * 2);
- double month_height = paper_height - month_origin_y - margin;
- double day_box_width = month_width / columns;
- double day_box_height = month_height / rows;
-
- struct dimensions dim = {
- paper_width, /* pw */
- paper_height, /* ph */
- month_width, /* mw */
- month_height, /* mh */
- day_box_width, /* bw */
- day_box_height, /* bh */
- rows, /* r */
- columns, /* c */
- margin, /* m */
- };
-
- /* Date Setup */
- char *months[] = {
- "January", "February", "March", "April", "May",
- "June", "July", "August", "September", "October",
- "November", "December"
- };
-
- //int days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
- // const char *weekday_names[] = {
- // "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
- // };
-
- // const char *weekdays_abbr[] = {
- // "Su", "Mo", "Tue", "Wed", "Thurs", "Fri", "Sat"
- // };
-
- int year = 2025;
- int month = 2;
-
- struct tm day;
- day.tm_mon = month - 1;
- day.tm_mday = 1;
- day.tm_year = year - 1900;
-
- /* tm.hour, tm_min, & tm_sec are not used, but need to be zeroed. */
- day.tm_hour = 0;
- day.tm_min = 0;
- day.tm_sec = 0;
-
- mktime(&day);
-
- cairo_surface_t * surface = cairo_pdf_surface_create("0.pdf", dim.pw * 72, dim.ph * 72);
- cairo_t *cr = cairo_create(surface);
-
-
- cairo_scale(cr, 72, 72);
- set_color(cr, "BLACK");
- cairo_set_line_width (cr, 0.03);
-
-
- draw_calendar(cr, month_origin_x, month_origin_y, dim);
- set_color(cr, "GRAY");
- draw_numbers(cr, month_origin_x, month_origin_y, dim, day.tm_wday, number_of_days);
- draw_month_name(cr, months[1], dim);
-
- /* Clean Up */
- cairo_destroy(cr);
- cairo_surface_destroy(surface);
- return(0);
-}