summaryrefslogtreecommitdiff
path: root/fitz/res_pixmap.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-11-28 21:54:26 +0000
committerTor Andersson <tor@ghostscript.com>2010-11-28 21:54:26 +0000
commit71a1131902da7e7f41566eb67cae3cad60bb14f4 (patch)
tree9900a5be346d04d811ec2282a35be3d37e5b6951 /fitz/res_pixmap.c
parentd63dc50e7d0ac6f1adccd9507b41410e0cbb0faf (diff)
downloadmupdf-71a1131902da7e7f41566eb67cae3cad60bb14f4.tar.xz
Support luminosity softmask background colors.
Diffstat (limited to 'fitz/res_pixmap.c')
-rw-r--r--fitz/res_pixmap.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index 4826502e..7455338a 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -70,9 +70,30 @@ fz_droppixmap(fz_pixmap *pix)
}
void
-fz_clearpixmap(fz_pixmap *pix, int value)
+fz_clearpixmap(fz_pixmap *pix)
{
- memset(pix->samples, value, pix->w * pix->h * pix->n);
+ memset(pix->samples, 0, pix->w * pix->h * pix->n);
+}
+
+void
+fz_clearpixmapwithcolor(fz_pixmap *pix, int value)
+{
+ if (value == 255)
+ memset(pix->samples, 255, pix->w * pix->h * pix->n);
+ else
+ {
+ int k, x, y;
+ unsigned char *s = pix->samples;
+ for (y = 0; y < pix->h; y++)
+ {
+ for (x = 0; x < pix->w; x++)
+ {
+ for (k = 0; k < pix->n - 1; k++)
+ *s++ = value;
+ *s++ = 255;
+ }
+ }
+ }
}
fz_bbox