summaryrefslogtreecommitdiff
path: root/draw/blendmodes.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-08-04 13:43:58 +0000
committerTor Andersson <tor@ghostscript.com>2010-08-04 13:43:58 +0000
commit2c036aab4670a93490d42de3492983feb389231d (patch)
tree1248816b579df9101cae086c88a568aeac5224f5 /draw/blendmodes.c
parent724d113ed8840470ded2b32a52c9b53a4e0a5c6b (diff)
downloadmupdf-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.c14
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));