summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/mutool/run.html3
-rw-r--r--source/tools/murun.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/docs/mutool/run.html b/docs/mutool/run.html
index e82a68bd..3d8f2753 100644
--- a/docs/mutool/run.html
+++ b/docs/mutool/run.html
@@ -228,6 +228,9 @@ tiles of a page.
<dt>Pixmap#getWidth()
<dt>Pixmap#getHeight()
<dt>Pixmap#getNumberOfComponents()
+<dd>Number of colors; plus one if an alpha channel is present.
+<dt>Pixmap#getAlpha()
+<dd>True if alpha channel is present.
<dt>Pixmap#getStride()
<dd>Number of bytes per row.
<dt>Pixmap#getColorSpace()
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);