diff options
author | Leo Howell <leo@lwh.jp> | 2009-09-28 22:09:47 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-09-28 22:09:47 +0900 |
commit | 36f38e01ddd23f332374093fa213ca08429729b1 (patch) | |
tree | a0a8fd4b198346501353eb33a6463f934141249d /lpg/libqr/qr-bitmap.c | |
parent | 388507a61df32c0bddf7e61c5da013c3f29d32d4 (diff) | |
download | pdf-simple-sign-36f38e01ddd23f332374093fa213ca08429729b1.tar.gz pdf-simple-sign-36f38e01ddd23f332374093fa213ca08429729b1.tar.xz pdf-simple-sign-36f38e01ddd23f332374093fa213ca08429729b1.zip |
QR masks
Diffstat (limited to 'lpg/libqr/qr-bitmap.c')
-rw-r--r-- | lpg/libqr/qr-bitmap.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lpg/libqr/qr-bitmap.c b/lpg/libqr/qr-bitmap.c index e42b550..1a5ca52 100644 --- a/lpg/libqr/qr-bitmap.c +++ b/lpg/libqr/qr-bitmap.c @@ -48,6 +48,25 @@ void qr_bitmap_destroy(struct qr_bitmap * bmp) } } +struct qr_bitmap * qr_bitmap_clone(const struct qr_bitmap * src) +{ + struct qr_bitmap * bmp; + size_t size; + + bmp = qr_bitmap_create(src->width, src->height, !!src->mask); + if (!bmp) + return 0; + + assert(bmp->stride == src->stride); + + size = bmp->width * bmp->stride; + memcpy(bmp->bits, src->bits, size); + if (bmp->mask) + memcpy(bmp->mask, src->mask, size); + + return bmp; +} + void qr_bitmap_merge(struct qr_bitmap * dest, const struct qr_bitmap * src) { unsigned char * d, * s, * m; |