[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2200-gff35f1a
[email protected] (Nancy Durgin)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, pdfi has been updated
via ff35f1a2d576d6f5fa04b2279672a1a8d901af3b (commit)
from 06a27e555f49aa29b1707376aa00b25c47535dc4 (commit)
----------------------------------------------------------------------
commit ff35f1a2d576d6f5fa04b2279672a1a8d901af3b
Author: Nancy Durgin <[email protected]>
Date: Wed Sep 4 14:48:07 2019 -0700
Put in transparency setup/teardown for images
diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index 844bfb1..4f7600b 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -926,6 +926,28 @@ pdfi_do_image_smask(pdf_context *ctx, pdf_stream *source, pdfi_image_info_t *ima
return code;
}
+
+/* Setup for transparency (see pdf_draw.ps/doimage) */
+static int
+pdfi_image_setup_trans(pdf_context *ctx, pdfi_trans_state_t *state)
+{
+ int code;
+
+ code = pdfi_gsave(ctx);
+ if (code < 0)
+ return code;
+ code = gs_moveto(ctx->pgs, 1.0, 1.0);
+ if (code < 0)
+ goto exit;
+ code = gs_lineto(ctx->pgs, 0., 0.);
+ if (code < 0)
+ goto exit;
+ code = pdfi_trans_setup(ctx, state, TRANSPARENCY_Caller_Image, gs_getfillconstantalpha(ctx->pgs));
+ exit:
+ pdfi_grestore(ctx);
+ return code;
+}
+
static int
pdfi_image_get_color(pdf_context *ctx, pdf_stream *source, pdfi_image_info_t *image_info,
int *comps, gs_color_space **pcs)
@@ -1068,6 +1090,7 @@ pdfi_do_image(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *stream_dict, pdf_
pdfi_int_gstate *igs = (pdfi_int_gstate *)ctx->pgs->client_data;
bool transparency_group = false;
bool has_smask = false;
+ pdfi_trans_state_t trans_state;
dbgmprintf(ctx->memory, "pdfi_do_image BEGIN\n");
memset(&mask_info, 0, sizeof(mask_info));
@@ -1092,6 +1115,9 @@ pdfi_do_image(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *stream_dict, pdf_
goto cleanupExit;
}
+ /* TODO: Save current rendering intent, set it to what is in image, and add a restore in the
+ * cleanup of this function (see pdf_draw.ps/doimage) */
+
/* If there is an alternate, swap it in */
/* If image_info.Alternates, look in the array, see if any of them are flagged as "DefaultForPrinting"
* and if so, substitute that one for the image we are processing.
@@ -1222,8 +1248,7 @@ pdfi_do_image(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *stream_dict, pdf_
if (code < 0)
goto cleanupExit;
- /* Setup the fill state (pdf_draw.ps/doimage, setfillstate) */
- code = pdfi_trans_set_params(ctx, gs_getfillconstantalpha(ctx->pgs));
+ code = pdfi_image_setup_trans(ctx, &trans_state);
if (code < 0)
return code;
@@ -1237,6 +1262,7 @@ pdfi_do_image(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *stream_dict, pdf_
goto cleanupExit;
}
+ code = pdfi_trans_teardown(ctx, &trans_state);
cleanupExit:
if (code < 0)
Summary of changes:
pdf/pdf_image.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)