From fe02a527fe1d309e584ffc3c65a84af829185930 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 6 Jun 2016 15:07:39 +0200 Subject: Update getStride and add getAlpha to JS bindings. --- source/tools/murun.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/tools') 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); -- cgit v1.2.3