From 7332cda41120e671d5a3613ee898bb59da6a133e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 15 Nov 2013 09:41:28 +0100 Subject: move structs and functions definitions to new header file --- cqrlogo.c | 10 +++------- cqrlogo.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 cqrlogo.h diff --git a/cqrlogo.c b/cqrlogo.c index 1c1a27c..4f4692e 100644 --- a/cqrlogo.c +++ b/cqrlogo.c @@ -17,16 +17,12 @@ #include "config.h" +/* define structs and functions */ +#include "cqrlogo.h" + #define URLPATTERN "^[hH][tT][tT][pP][sS]\\?://%s/" #define TEXTSTOLEN "This QR Code has been stolen from http%s://%s/!" -/* a bitmap */ -struct bitmap_t { - unsigned int width; - unsigned int height; - uint8_t *pixel; -}; - #if defined PNG_TEXT_SUPPORTED && PNG_ENABLE_TEXT /*** add_png_text ***/ png_text * add_png_text(png_text *pngtext, unsigned int *textcount, char *key, char *text) { diff --git a/cqrlogo.h b/cqrlogo.h new file mode 100644 index 0000000..7a48c18 --- /dev/null +++ b/cqrlogo.h @@ -0,0 +1,39 @@ +/* + * (C) 2013 by Christian Hesse + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#ifndef _CQRLOGO_H +#define _CQRLOGO_H + +/* a bitmap */ +struct bitmap_t { + unsigned int width; + unsigned int height; + uint8_t *pixel; +}; + +#if defined PNG_TEXT_SUPPORTED && PNG_ENABLE_TEXT +/*** add_png_text ***/ +png_text * add_png_text(png_text *pngtext, unsigned int *textcount, char *key, char *text); +#endif + +/*** generate_png ***/ +int generate_png (struct bitmap_t *bitmap, const char *uri); + +/*** bitmap_new ***/ +struct bitmap_t * bitmap_new(int width, int height); +/*** bitmap_free ***/ +void bitmap_free(struct bitmap_t * bitmap); + +/*** encode_qrcode ***/ +struct bitmap_t * encode_qrcode (const char *text, unsigned int scale, unsigned int border, unsigned int level); + +/*** get_value ***/ +int get_value(const char *query_string, const char *pattern, unsigned int *value, unsigned int def, unsigned int min, unsigned int max); + +#endif /* _CQRLOGO_H */ + +// vim: set syntax=c: -- cgit v1.2.3-54-g00ecf