diff options
author | Leo Howell <leo@lwh.jp> | 2009-10-08 16:41:56 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-10-08 16:41:56 +0900 |
commit | ce330147acca10cd66c370847bdc3e824a83a0c6 (patch) | |
tree | bb9dd881daacfe1dff656371df6d2292bcbd7658 /lpg/libqr/qr-bitmap-pbm.c | |
parent | 6359bfddcc5868093418784fa2e972581ebd82b6 (diff) | |
download | pdf-simple-sign-ce330147acca10cd66c370847bdc3e824a83a0c6.tar.gz pdf-simple-sign-ce330147acca10cd66c370847bdc3e824a83a0c6.tar.xz pdf-simple-sign-ce330147acca10cd66c370847bdc3e824a83a0c6.zip |
add qrgen sample app
Diffstat (limited to 'lpg/libqr/qr-bitmap-pbm.c')
-rw-r--r-- | lpg/libqr/qr-bitmap-pbm.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/lpg/libqr/qr-bitmap-pbm.c b/lpg/libqr/qr-bitmap-pbm.c deleted file mode 100644 index 3bcddb2..0000000 --- a/lpg/libqr/qr-bitmap-pbm.c +++ /dev/null @@ -1,47 +0,0 @@ -#include <limits.h> -#include <stdio.h> -#include "qr-bitmap.h" - -int qr_bitmap_write_pbm(const char * path, - const char * comment, - const struct qr_bitmap * bmp) -{ - FILE * out; - size_t count, x, y; - - out = fopen(path, "w"); - if (!out) - return -1; - - count = 0; - - count += fputs("P1\n", out); - - if (comment) - count += fprintf(out, "# %s\n", comment); - - count += fprintf(out, "%u %u\n", - (unsigned)bmp->width, - (unsigned)bmp->height); - - for (y = 0; y < bmp->height; ++y) { - unsigned char * row = bmp->bits + y * bmp->stride; - - for (x = 0; x < bmp->width; ++x) { - int bit = row[x / CHAR_BIT] & (1 << x % CHAR_BIT); - - if (x > 0) - fputc(' ', out); - fputc(bit ? '1' : '0', out); - } - count += fputc('\n', out); - } - - if (ferror(out)) - count = -1; - - fclose(out); - - return count; -} - |