summaryrefslogtreecommitdiff
path: root/source/fitz/pixmap.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-08-01 17:10:02 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-08-09 14:02:19 +0200
commit09d3d93b4e3d8951bf958f2404ee27b5a0769cb9 (patch)
tree668941dbbcb6b9e5a1525aa9f4a08b08a16cea39 /source/fitz/pixmap.c
parent72e05eaace2fdb3b118b57f6d331054127c46fc5 (diff)
downloadmupdf-09d3d93b4e3d8951bf958f2404ee27b5a0769cb9.tar.xz
Render shadings to images in stext-device.
Diffstat (limited to 'source/fitz/pixmap.c')
-rw-r--r--source/fitz/pixmap.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index 1c4ea52b..bef5b6a5 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -526,6 +526,37 @@ fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value)
}
void
+fz_fill_pixmap_with_color(fz_context *ctx, fz_pixmap *pix, fz_colorspace *colorspace, float *color, const fz_color_params *color_params)
+{
+ float colorfv[FZ_MAX_COLORS];
+ unsigned char colorbv[FZ_MAX_COLORS];
+ int i, n, a, s, x, y, w, h;
+
+ n = fz_colorspace_n(ctx, pix->colorspace);
+ a = pix->alpha;
+ s = pix->s;
+ fz_convert_color(ctx, color_params, NULL, pix->colorspace, colorfv, colorspace, color);
+ for (i = 0; i < n; ++i)
+ colorbv[i] = colorfv[i] * 255;
+
+ w = pix->w;
+ h = pix->h;
+ for (y = 0; y < h; ++y)
+ {
+ unsigned char *p = pix->samples + y * pix->stride;
+ for (x = 0; x < w; ++x)
+ {
+ for (i = 0; i < n; ++i)
+ *p++ = colorbv[i];
+ for (i = 0; i < s; ++i)
+ *p++ = 0;
+ if (a)
+ *p++ = 255;
+ }
+ }
+}
+
+void
fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_irect *b, const fz_default_colorspaces *default_cs)
{
unsigned char *srcp;