summaryrefslogtreecommitdiff
path: root/source/tools/murun.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-06-06 15:07:39 +0200
committerRobin Watts <robin.watts@artifex.com>2016-06-16 18:08:15 +0100
commitfe02a527fe1d309e584ffc3c65a84af829185930 (patch)
treeb838bef82cde1aa23cf839420fff1896f14e00d9 /source/tools/murun.c
parentc038cf4db5122259a790aa0f15f391b375f7540a (diff)
downloadmupdf-fe02a527fe1d309e584ffc3c65a84af829185930.tar.xz
Update getStride and add getAlpha to JS bindings.
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r--source/tools/murun.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 5c724082..61e43e17 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -1643,10 +1643,16 @@ static void ffi_Pixmap_getNumberOfComponents(js_State *J)
js_pushnumber(J, pixmap->n);
}
+static void ffi_Pixmap_getAlpha(js_State *J)
+{
+ fz_pixmap *pixmap = js_touserdata(J, 0, "fz_pixmap");
+ js_pushnumber(J, pixmap->alpha);
+}
+
static void ffi_Pixmap_getStride(js_State *J)
{
fz_pixmap *pixmap = js_touserdata(J, 0, "fz_pixmap");
- js_pushnumber(J, pixmap->w * pixmap->n);
+ js_pushnumber(J, pixmap->stride);
}
static void ffi_Pixmap_getSample(js_State *J)
@@ -3224,6 +3230,7 @@ int murun_main(int argc, char **argv)
jsB_propfun(J, "Pixmap.getWidth", ffi_Pixmap_getWidth, 0);
jsB_propfun(J, "Pixmap.getHeight", ffi_Pixmap_getHeight, 0);
jsB_propfun(J, "Pixmap.getNumberOfComponents", ffi_Pixmap_getNumberOfComponents, 0);
+ jsB_propfun(J, "Pixmap.getAlpha", ffi_Pixmap_getAlpha, 0);
jsB_propfun(J, "Pixmap.getStride", ffi_Pixmap_getStride, 0);
jsB_propfun(J, "Pixmap.getColorSpace", ffi_Pixmap_getColorSpace, 0);
jsB_propfun(J, "Pixmap.getXResolution", ffi_Pixmap_getXResolution, 0);