diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | config.def.h | 15 | ||||
-rw-r--r-- | cqrlogo.c | 15 |
4 files changed, 21 insertions, 15 deletions
@@ -1,2 +1,3 @@ +config.h cqrlogo *.png @@ -2,14 +2,17 @@ CC := gcc INSTALL := install +CP := cp RM := rm CFLAGS += -O2 -Wall -Werror CFLAGS += $(shell pkg-config --cflags --libs gdk-pixbuf-2.0) \ $(shell pkg-config --cflags --libs libqrencode) -all: cqrlogo.c +all: cqrlogo.c config.h $(CC) $(CFLAGS) -o cqrlogo cqrlogo.c +config.h: + $(CP) config.def.h config.h install: $(INSTALL) -D -m0755 cqrlogo $(DESTDIR)/usr/share/webapps/cqrlogo/cqrlogo diff --git a/config.def.h b/config.def.h new file mode 100644 index 0000000..d95e45d --- /dev/null +++ b/config.def.h @@ -0,0 +1,15 @@ +/* pixels are scaled up by this factor */ +#define QRCODE_SCALE 2 + +/* width of the border + * this is defined to at least 4, but works well with less */ +# define QRCODE_BORDER 1 + +/* error correction level used for QR code + * possible values: QR_ECLEVEL_L (lowest, about 7% error can be corrected) + * QR_ECLEVEL_M (about 15%) + * QR_ECLEVEL_Q (about 25%) + * QR_ECLEVEL_H (highest, about 30%) + * image size raises with higher levels */ +#define QRCODE_LEVEL QR_ECLEVEL_L + @@ -13,20 +13,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <qrencode.h> -/* pixels are scaled up by this factor */ -#define QRCODE_SCALE 2 - -/* width of the border - * this is defined to at least 4, but works well with less */ -# define QRCODE_BORDER 1 - -/* error correction level used for QR code - * possible values: QR_ECLEVEL_L (lowest, about 7% error can be corrected) - * QR_ECLEVEL_M (about 15%) - * QR_ECLEVEL_Q (about 25%) - * QR_ECLEVEL_H (highest, about 30%) - * image size raises with higher levels */ -#define QRCODE_LEVEL QR_ECLEVEL_L +#include "config.h" GdkPixbuf * encode_qrcode (char *text, int scale, int border) { QRcode *qrcode; |