summaryrefslogtreecommitdiff
path: root/source/tools/murun.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-23 17:45:21 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-24 12:48:35 +0100
commitd0b78f4166a1503ce522944002b3aab035724cd9 (patch)
treeb8c680dc401db56a28be1110759219c7c175dd8d /source/tools/murun.c
parent841952db71d6541a2e98fd4d1d49dede284b2cf8 (diff)
downloadmupdf-d0b78f4166a1503ce522944002b3aab035724cd9.tar.xz
fz_pixmap revamp: add stride and make alpha optional
fz_pixmaps now have an explicit stride value. By default no change from before, but code all copes with extra gaps at the end of the line. The alpha data in fz_pixmaps is no longer compulsory. mudraw: use rgb not rgba (ppmraw), cmyk not cmyka (pkmraw). Update halftone code to not expect alpha plane. Update PNG writing to cope with alpha less input. Also hide repeated params within the png output context. ARM code needs updating.
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r--source/tools/murun.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index b8a7d991..e069bf0d 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -1748,10 +1748,11 @@ static void ffi_new_Pixmap(js_State *J)
fz_context *ctx = js_getcontext(J);
fz_colorspace *colorspace = js_touserdata(J, 1, "fz_colorspace");
fz_irect bounds = ffi_toirect(J, 2);
+ int alpha = js_toboolean(J, 3);
fz_pixmap *pixmap;
fz_try(ctx)
- pixmap = fz_new_pixmap_with_bbox(ctx, colorspace, &bounds);
+ pixmap = fz_new_pixmap_with_bbox(ctx, colorspace, &bounds, alpha);
fz_catch(ctx)
rethrow(J);
@@ -2260,11 +2261,11 @@ static void ffi_DisplayList_toPixmap(js_State *J)
fz_display_list *list = js_touserdata(J, 0, "fz_display_list");
fz_matrix ctm = ffi_tomatrix(J, 1);
fz_colorspace *colorspace = js_touserdata(J, 2, "fz_colorspace");
- int solid = js_isdefined(J, 3) ? js_toboolean(J, 3) : 1;
+ int alpha = js_isdefined(J, 3) ? js_toboolean(J, 3) : 0;
fz_pixmap *pixmap;
fz_try(ctx)
- pixmap = fz_new_pixmap_from_display_list(ctx, list, &ctm, colorspace, solid);
+ pixmap = fz_new_pixmap_from_display_list(ctx, list, &ctm, colorspace, alpha);
fz_catch(ctx)
rethrow(J);
@@ -3301,7 +3302,7 @@ int murun_main(int argc, char **argv)
jsB_propcon(J, "fz_buffer", "Buffer", ffi_new_Buffer, 1);
jsB_propcon(J, "fz_document", "Document", ffi_new_Document, 1);
- jsB_propcon(J, "fz_pixmap", "Pixmap", ffi_new_Pixmap, 2);
+ jsB_propcon(J, "fz_pixmap", "Pixmap", ffi_new_Pixmap, 3);
jsB_propcon(J, "fz_image", "Image", ffi_new_Image, 1);
jsB_propcon(J, "fz_font", "Font", ffi_new_Font, 2);
jsB_propcon(J, "fz_text", "Text", ffi_new_Text, 0);