summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-02-27 10:12:29 +0100
committerGravatar Christian Hesse <mail@eworm.de>2014-02-27 10:12:29 +0100
commitb4248c6191a063d424434ca1921680eceb61d922 (patch)
tree464eeabfb588b20d8c8319199b8cb2815e5ae9c3 /README.md
parent79946b9682c99c0b685003a7b5931e8088576b37 (diff)
downloadcqrlogo-b4248c6191a063d424434ca1921680eceb61d922.tar.gz
cqrlogo-b4248c6191a063d424434ca1921680eceb61d922.tar.zst
rename functions and type definitions, introduce cqr_encode_qrcode_to_png()
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 9 insertions, 17 deletions
diff --git a/README.md b/README.md
index 19668d2..83f7997 100644
--- a/README.md
+++ b/README.md
@@ -74,29 +74,22 @@ your custom needs. This is minimal sample source code:
#include <libcqrlogo.h>
int main(int argc, char **argv) {
- struct bitmap_t * bitmap;
- struct png_t * png;
- struct cqrconf_t cqrconf;
-
- cqrconf.scale = 2;
- cqrconf.border = 1;
- cqrconf.level = 0;
- cqrconf.overwrite = 1;
-
- /* encode the QR-Code */
- if ((bitmap = encode_qrcode("https://github.com/eworm-de/cqrlogo", cqrconf)) == NULL) {
- fprintf(stderr, "Could not generate QR-Code.\n");
- return EXIT_FAILURE;
- }
+ struct cqr_png * png;
+ struct cqr_conf conf;
+
+ conf.scale = 2;
+ conf.border = 1;
+ conf.level = 0;
+ conf.overwrite = 1;
/* generate PNG data */
- if ((png = generate_png(bitmap, CQR_COMMENT|CQR_VERSION|CQR_LIBVERSION, "https://github.com/eworm-de/cqrlogo")) == NULL) {
+ if ((png = cqr_encode_qrcode_to_png("https://github.com/eworm-de/cqrlogo", conf, CQR_META_ALL)) == NULL) {
fprintf(stderr, "Failed to generate PNG.\n");
return EXIT_FAILURE;
}
/* print HTTP header */
- printf("Content-Type: image/png\n\n");
+ printf(cqr_mimeheader);
/* write PNG data to stdout */
if (fwrite(png->buffer, png->size, 1, stdout) != 1) {
@@ -105,7 +98,6 @@ your custom needs. This is minimal sample source code:
}
/* free memory we no longer need */
- bitmap_free(bitmap);
if (png->size > 0)
free(png->buffer);
free(png);