summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-11-13 13:27:30 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-11-13 21:27:06 +0100
commitb35df4b2ae4a80c8f770335b813e5cd3203c175b (patch)
tree9ed6b381d3aa039cfb94613b9b7162cb49602520
parent9a8a3fe5e1d3e319559fd0bde2bc40bc47ee01bd (diff)
downloadmupdf-b35df4b2ae4a80c8f770335b813e5cd3203c175b.tar.xz
Use fz_image.imagemask field when adding PDF image resources.
Don't pass the information as a separate argument.
-rw-r--r--include/mupdf/fitz/image.h3
-rw-r--r--include/mupdf/pdf/resource.h2
-rw-r--r--platform/java/mupdf_native.c2
-rw-r--r--source/pdf/pdf-device.c4
-rw-r--r--source/pdf/pdf-image.c6
-rw-r--r--source/tools/murun.c2
-rw-r--r--source/tools/pdfcreate.c2
7 files changed, 10 insertions, 11 deletions
diff --git a/include/mupdf/fitz/image.h b/include/mupdf/fitz/image.h
index 8c5e7d62..6dfd6c9b 100644
--- a/include/mupdf/fitz/image.h
+++ b/include/mupdf/fitz/image.h
@@ -185,8 +185,7 @@ fz_image *fz_new_image_of_size(fz_context *ctx,
interpolate: 1 if interpolation should be used when decoding
this image, 0 otherwise.
- imagemask: 1 if this is an imagemask (i.e. transparent), 0
- otherwise.
+ imagemask: 1 if this is an imagemask (i.e. transparency bitmap mask), 0 otherwise.
decode: NULL, or a pointer to to a decode array. The default
decode array is [0 1] (repeated n times, for n color components).
diff --git a/include/mupdf/pdf/resource.h b/include/mupdf/pdf/resource.h
index d8968996..85a37641 100644
--- a/include/mupdf/pdf/resource.h
+++ b/include/mupdf/pdf/resource.h
@@ -49,7 +49,7 @@ int pdf_is_jpx_image(fz_context *ctx, pdf_obj *dict);
fz_image *pdf_load_image(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
-pdf_obj *pdf_add_image(fz_context *ctx, pdf_document *doc, fz_image *image, int mask);
+pdf_obj *pdf_add_image(fz_context *ctx, pdf_document *doc, fz_image *image);
/*
* Pattern
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index 27095891..f1dd4f2b 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -7269,7 +7269,7 @@ FUN(PDFDocument_addImage)(JNIEnv *env, jobject self, jobject jimage)
if (!image) { jni_throw_arg(env, "image must not be null"); return NULL; }
fz_try(ctx)
- ind = pdf_add_image(ctx, pdf, image, 0);
+ ind = pdf_add_image(ctx, pdf, image);
fz_catch(ctx)
{
jni_rethrow(env, ctx);
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index 7322bd32..a193f565 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -819,7 +819,7 @@ pdf_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix c
gstate *gs = CURRENT_GSTATE(pdev);
pdf_dev_end_text(ctx, pdev);
- im_res = pdf_add_image(ctx, pdev->doc, image, 0);
+ im_res = pdf_add_image(ctx, pdev->doc, image);
if (im_res == NULL)
{
fz_warn(ctx, "pdf_add_image: problem adding image resource");
@@ -856,7 +856,7 @@ pdf_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_mat
gstate *gs = CURRENT_GSTATE(pdev);
pdf_dev_end_text(ctx, pdev);
- im_res = pdf_add_image(ctx, pdev->doc, image, 1);
+ im_res = pdf_add_image(ctx, pdev->doc, image);
if (im_res == NULL)
{
fz_warn(ctx, "pdf_add_image: problem adding image resource");
diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c
index da98cce8..939c8974 100644
--- a/source/pdf/pdf-image.c
+++ b/source/pdf/pdf-image.c
@@ -299,7 +299,7 @@ pdf_load_image(fz_context *ctx, pdf_document *doc, pdf_obj *dict)
}
pdf_obj *
-pdf_add_image(fz_context *ctx, pdf_document *doc, fz_image *image, int mask)
+pdf_add_image(fz_context *ctx, pdf_document *doc, fz_image *image)
{
fz_pixmap *pixmap = NULL;
pdf_obj *imobj = NULL;
@@ -457,7 +457,7 @@ raw_or_unknown_compression:
pdf_dict_put_int(ctx, imobj, PDF_NAME(Width), pixmap ? pixmap->w : image->w);
pdf_dict_put_int(ctx, imobj, PDF_NAME(Height), pixmap ? pixmap->h : image->h);
- if (mask)
+ if (image->imagemask)
{
pdf_dict_put_bool(ctx, imobj, PDF_NAME(ImageMask), 1);
}
@@ -525,7 +525,7 @@ raw_or_unknown_compression:
if (image->mask)
{
- pdf_dict_put_drop(ctx, imobj, PDF_NAME(SMask), pdf_add_image(ctx, doc, image->mask, 1));
+ pdf_dict_put_drop(ctx, imobj, PDF_NAME(SMask), pdf_add_image(ctx, doc, image->mask));
}
pdf_update_stream(ctx, doc, imobj, buffer, 1);
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 33bdd8f4..d122ce51 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -3283,7 +3283,7 @@ static void ffi_PDFDocument_addImage(js_State *J)
pdf_obj *ind = NULL;
fz_try(ctx)
- ind = pdf_add_image(ctx, pdf, image, 0);
+ ind = pdf_add_image(ctx, pdf, image);
fz_catch(ctx)
rethrow(J);
diff --git a/source/tools/pdfcreate.c b/source/tools/pdfcreate.c
index 043936e4..b0f1c0a3 100644
--- a/source/tools/pdfcreate.c
+++ b/source/tools/pdfcreate.c
@@ -120,7 +120,7 @@ static void add_image_res(pdf_obj *resources, char *name, char *path)
pdf_dict_put_drop(ctx, resources, PDF_NAME(XObject), subres);
}
- ref = pdf_add_image(ctx, doc, image, 0);
+ ref = pdf_add_image(ctx, doc, image);
pdf_dict_puts(ctx, subres, name, ref);
pdf_drop_obj(ctx, ref);