diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-07-23 00:51:26 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-08-02 02:20:45 +0800 |
commit | e669037e78e1cfbe7adb3ad80dc2f80b62010a34 (patch) | |
tree | c5b97fa34a458c9d4c9510da2925e6812b298ff3 /source | |
parent | 7111d62585a9264c92962584f234b1fcdd1445f9 (diff) | |
download | mupdf-e669037e78e1cfbe7adb3ad80dc2f80b62010a34.tar.xz |
JS: Add several Image.get*() methods similar to JNI.
Diffstat (limited to 'source')
-rw-r--r-- | source/tools/murun.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c index 80703931..99335929 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -1992,6 +1992,36 @@ static void ffi_Image_getYResolution(js_State *J) js_pushnumber(J, image->yres); } +static void ffi_Image_getNumberOfComponents(js_State *J) +{ + fz_image *image = js_touserdata(J, 0, "fz_image"); + js_pushnumber(J, image->n); +} + +static void ffi_Image_getBitsPerComponent(js_State *J) +{ + fz_image *image = js_touserdata(J, 0, "fz_image"); + js_pushnumber(J, image->bpc); +} + +static void ffi_Image_getInterpolate(js_State *J) +{ + fz_image *image = js_touserdata(J, 0, "fz_image"); + js_pushboolean(J, image->interpolate); +} + +static void ffi_Image_getImageMask(js_State *J) +{ + fz_image *image = js_touserdata(J, 0, "fz_image"); + js_pushboolean(J, image->imagemask); +} + +static void ffi_Image_getMask(js_State *J) +{ + fz_image *image = js_touserdata(J, 0, "fz_image"); + ffi_pushimage(J, image->mask); +} + static void ffi_Image_getColorSpace(js_State *J) { fz_image *image = js_touserdata(J, 0, "fz_image"); @@ -3561,6 +3591,11 @@ int murun_main(int argc, char **argv) jsB_propfun(J, "Image.getColorSpace", ffi_Image_getColorSpace, 0); jsB_propfun(J, "Image.getXResolution", ffi_Image_getXResolution, 0); jsB_propfun(J, "Image.getYResolution", ffi_Image_getYResolution, 0); + jsB_propfun(J, "Image.getNumberOfComponents", ffi_Image_getNumberOfComponents, 0); + jsB_propfun(J, "Image.getBitsPerComponent", ffi_Image_getBitsPerComponent, 0); + jsB_propfun(J, "Image.getInterpolate", ffi_Image_getInterpolate, 0); + jsB_propfun(J, "Image.getImageMask", ffi_Image_getImageMask, 0); + jsB_propfun(J, "Image.getMask", ffi_Image_getMask, 0); jsB_propfun(J, "Image.toPixmap", ffi_Image_toPixmap, 2); } js_setregistry(J, "fz_image"); |