summaryrefslogtreecommitdiff
path: root/fitz/res_pixmap.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-03-31 03:18:51 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-03-31 03:18:51 +0200
commitb3f90095897b64f854efc4b2f37df428a71fd508 (patch)
tree27ad639a052b967e1fdc03f7d58ff63b5b0a8f46 /fitz/res_pixmap.c
parent4f484b32f3cf8682180ccb9e36f929edff175498 (diff)
downloadmupdf-b3f90095897b64f854efc4b2f37df428a71fd508.tar.xz
xps: Clean up image loading code, and handle images with alpha.
Diffstat (limited to 'fitz/res_pixmap.c')
-rw-r--r--fitz/res_pixmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index e70d084d..b37b7a3e 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -97,6 +97,24 @@ fz_clearpixmapwithcolor(fz_pixmap *pix, int value)
}
}
+void
+fz_premultiplypixmap(fz_pixmap *pix)
+{
+ unsigned char *s = pix->samples;
+ unsigned char a;
+ int k, x, y;
+ for (y = 0; y < pix->h; y++)
+ {
+ for (x = 0; x < pix->w; x++)
+ {
+ a = s[pix->n - 1];
+ for (k = 0; k < pix->n - 1; k++)
+ s[k] = fz_mul255(s[k], a);
+ s += pix->n;
+ }
+ }
+}
+
fz_bbox
fz_boundpixmap(fz_pixmap *pix)
{