diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-11-05 07:57:47 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-11-05 07:57:47 +0100 |
commit | 24ee8c1e74d613b1ec394c7380b39349f07d47d6 (patch) | |
tree | 07c964441d983c713c05090021ce6da1e1c132fe /render/pixmap.c | |
parent | cbbee31601e34f1f513a4d046d52963baebf07fa (diff) | |
download | mupdf-24ee8c1e74d613b1ec394c7380b39349f07d47d6.tar.xz |
tiling patterns
Diffstat (limited to 'render/pixmap.c')
-rw-r--r-- | render/pixmap.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/render/pixmap.c b/render/pixmap.c index 634fe8f6..ed64769f 100644 --- a/render/pixmap.c +++ b/render/pixmap.c @@ -82,25 +82,46 @@ fz_blendover(fz_pixmap *src, fz_pixmap *dst) { int x, y, k; - assert(dst->n == src->n); + assert(dst->n == src->n || src->n == 1); assert(dst->w == src->w); assert(dst->h == src->h); unsigned char *s = src->samples; unsigned char *d = dst->samples; - for (y = 0; y < dst->h; y++) + if (dst->n == src->n) { - for (x = 0; x < dst->w; x++) + for (y = 0; y < dst->h; y++) { - int sa = s[0]; - int ssa = 255 - sa; + for (x = 0; x < dst->w; x++) + { + int sa = s[0]; + int ssa = 255 - sa; - for (k = 0; k < dst->n; k++) - d[k] = s[k] + fz_mul255(d[k], ssa); + for (k = 0; k < dst->n; k++) + d[k] = s[k] + fz_mul255(d[k], ssa); - s += src->n; - d += dst->n; + s += src->n; + d += dst->n; + } + } + } + else if (src->n == 1) + { + for (y = 0; y < dst->h; y++) + { + for (x = 0; x < dst->w; x++) + { + int sa = s[0]; + int ssa = 255 - sa; + + d[0] = s[0] + fz_mul255(d[0], ssa); + for (k = 1; k < dst->n; k++) + d[k] = 0 + fz_mul255(d[k], ssa); + + s += src->n; + d += dst->n; + } } } } @@ -111,7 +132,6 @@ fz_blendmask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk) int x, y, k; assert(src->n == dst->n); - assert(msk->n == 1); unsigned char *d = dst->samples; unsigned char *s = src->samples; @@ -125,7 +145,7 @@ fz_blendmask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk) { *d++ = fz_mul255(*s++, *m); } - m++; + m += msk->n; } } } |