diff options
| author | foswret | 2026-04-30 23:23:25 -0500 |
|---|---|---|
| committer | foswret | 2026-04-30 23:23:25 -0500 |
| commit | 587315ff1af819dbf17c52d2622fa48526563707 (patch) | |
| tree | f4036146dc3bec9df8c94ec7ef039d233a8efedf | |
first commit
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Makefile | 27 | ||||
| -rwxr-xr-x | calp | bin | 0 -> 19904 bytes | |||
| -rw-r--r-- | src/calp.c | 42 | ||||
| -rw-r--r-- | src/calp.o | bin | 0 -> 7344 bytes | |||
| -rw-r--r-- | src/draw.c | 8 | ||||
| -rw-r--r-- | src/draw.h | 1 | ||||
| -rw-r--r-- | src/draw.o | bin | 0 -> 4720 bytes |
8 files changed, 80 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f99b77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +notes.md +output.pdf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4c8f544 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +VERSION = 0.0 +PREFIX = /usr/local +CC = cc +DIR = src +OBJS = $(DIR)/calp.o $(DIR)/draw.o +.PHONY: clean all install + +TARGET = calp + +CFLAGS = `pkg-config --cflags pangocairo` -O2 -g -Wall -Werror -Wextra -Winit-self -Wuninitialized -pedantic +LFLAGS = `pkg-config --libs pangocairo` -lm + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LFLAGS) + +clean: + -rm -f $(OBJS) calp + +install: all + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f calp ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/calp + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/calp Binary files differdiff --git a/src/calp.c b/src/calp.c new file mode 100644 index 0000000..9b0bb20 --- /dev/null +++ b/src/calp.c @@ -0,0 +1,42 @@ +#include <stdio.h> +#include <cairo/cairo-pdf.h> +#include <pango/pangocairo.h> + +#include "draw.h" + +// Metric +#define US_LETTER_WIDTH 216 +#define US_LETTER_HEIGHT 279 + +#define A4_WIDTH 210 +#define A4_HEIGHT 297 + +double width = A4_WIDTH; +double height = A4_HEIGHT; + +int main (int argc, char **argv) { + char *filename; + + // TBD clean this up + filename = argv[1]; + + if (argc == 1) { + filename = "output.pdf"; + } + + // Initialization + cairo_surface_t *surface = cairo_pdf_surface_create(filename, width, height); + cairo_t *cr = cairo_create(surface); + + // Draw stuff here + fill_bg(cr, width, height); + + // FUNCTIONS TO MAKE + // Draw Grid + // Draw Numbers + + // Clean up + cairo_destroy(cr); + cairo_surface_destroy(surface); + return 0; +} diff --git a/src/calp.o b/src/calp.o Binary files differnew file mode 100644 index 0000000..b7e4878 --- /dev/null +++ b/src/calp.o diff --git a/src/draw.c b/src/draw.c new file mode 100644 index 0000000..51cd862 --- /dev/null +++ b/src/draw.c @@ -0,0 +1,8 @@ +#include <cairo/cairo.h> + +int fill_bg(cairo_t *c, double x, double y) { + cairo_set_source_rgb (c, 255.0, 255.0, 255.0); + cairo_rectangle(c, 0, 0, x, y); + cairo_fill(c); + return 0; +} diff --git a/src/draw.h b/src/draw.h new file mode 100644 index 0000000..3cfc460 --- /dev/null +++ b/src/draw.h @@ -0,0 +1 @@ +int fill_bg(cairo_t *c, double w, double h); diff --git a/src/draw.o b/src/draw.o Binary files differnew file mode 100644 index 0000000..e768c5d --- /dev/null +++ b/src/draw.o |
