diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-08-04 13:43:58 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-08-04 13:43:58 +0000 |
commit | 2c036aab4670a93490d42de3492983feb389231d (patch) | |
tree | 1248816b579df9101cae086c88a568aeac5224f5 /draw/blendmodes.c | |
parent | 724d113ed8840470ded2b32a52c9b53a4e0a5c6b (diff) | |
download | mupdf-2c036aab4670a93490d42de3492983feb389231d.tar.xz |
Rearrange low level painting functions and add new functions for constant alpha painting.
Diffstat (limited to 'draw/blendmodes.c')
-rw-r--r-- | draw/blendmodes.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/draw/blendmodes.c b/draw/blendmodes.c index 0c8c7eec..184e1a28 100644 --- a/draw/blendmodes.c +++ b/draw/blendmodes.c @@ -326,12 +326,24 @@ fz_blendnonseparable(byte * restrict bp, byte * restrict sp, int w, fz_blendmode } void -fz_blendpixmapswithmode(fz_pixmap *dst, fz_pixmap *src, fz_blendmode blendmode) +fz_blendpixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_blendmode blendmode) { unsigned char *sp, *dp; fz_bbox bbox; int x, y, w, h, n; + /* TODO: fix this hack! */ + if (alpha < 255) + { + sp = src->samples; + n = src->w * src->h * src->n; + while (n--) + { + *sp = fz_mul255(*sp, alpha); + sp++; + } + } + bbox = fz_boundpixmap(dst); bbox = fz_intersectbbox(bbox, fz_boundpixmap(src)); |