diff options
Diffstat (limited to 'psi/ztrans.c')
-rw-r--r-- | psi/ztrans.c | 64 |
1 files changed, 14 insertions, 50 deletions
diff --git a/psi/ztrans.c b/psi/ztrans.c index 2933e37a..4a26bdd4 100644 --- a/psi/ztrans.c +++ b/psi/ztrans.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2019 Artifex Software, Inc. +/* Copyright (C) 2001-2020 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -41,20 +41,6 @@ /* ------ Utilities ------ */ -static int -set_float_value(i_ctx_t *i_ctx_p, int (*set_value)(gs_gstate *, double)) -{ - os_ptr op = osp; - double value; - int code; - - if (real_param(op, &value) < 0) - return_op_typecheck(op); - if ((code = set_value(igs, value)) < 0) - return code; - pop(1); - return 0; -} static int current_float_value(i_ctx_t *i_ctx_p, @@ -123,34 +109,6 @@ zcurrentblendmode(i_ctx_t *i_ctx_p) return 0; } -/* <0..1> .setopacityalpha - */ -static int -zsetopacityalpha(i_ctx_t *i_ctx_p) -{ - return set_float_value(i_ctx_p, gs_setopacityalpha); -} - -/* - .currentopacityalpha <0..1> */ -static int -zcurrentopacityalpha(i_ctx_t *i_ctx_p) -{ - return current_float_value(i_ctx_p, gs_currentopacityalpha); -} - -/* <0..1> .setshapealpha - */ -static int -zsetshapealpha(i_ctx_t *i_ctx_p) -{ - return set_float_value(i_ctx_p, gs_setshapealpha); -} - -/* - .currentshapealpha <0..1> */ -static int -zcurrentshapealpha(i_ctx_t *i_ctx_p) -{ - return current_float_value(i_ctx_p, gs_currentshapealpha); -} - /* <bool> .settextknockout - */ static int zsettextknockout(i_ctx_t *i_ctx_p) @@ -216,7 +174,7 @@ static int common_transparency_group(i_ctx_t *i_ctx_p, pdf14_compositor_operatio check_type(*dop, t_dictionary); check_dict_read(*dop); - gs_trans_group_params_init(¶ms); + gs_trans_group_params_init(¶ms, 1.0); if ((code = dict_bool_param(dop, "Isolated", false, ¶ms.Isolated)) < 0 || (code = dict_bool_param(dop, "Knockout", false, ¶ms.Knockout)) < 0 || (code = dict_bool_param(dop, ".image_with_SMask", false, ¶ms.image_with_SMask)) < 0 @@ -245,6 +203,15 @@ static int common_transparency_group(i_ctx_t *i_ctx_p, pdf14_compositor_operatio params.ColorSpace = NULL; } } + + if (gs_getalphaisshape(igs)) { + params.group_shape = gs_getfillconstantalpha(igs); + params.group_opacity = 1.0; + } else { + params.group_opacity = gs_getfillconstantalpha(igs); + params.group_shape = 1.0; + } + code = gs_begin_transparency_group(igs, ¶ms, &bbox, group_type); if (code < 0) return code; @@ -508,6 +475,9 @@ zpushpdf14devicefilter(i_ctx_t *i_ctx_p) gx_device *cdev = gs_currentdevice_inline(igs); check_type(*op, t_integer); + if (dev_proc(cdev, dev_spec_op)(cdev, gxdso_is_pdf14_device, NULL, 0) > 0) + return 0; /* ignore push_device if already is pdf14 device */ + /* Bug 698087: In case some program uses our .pushpdf14devicefilter make */ /* sure that the device knows that we are using the pdf14 */ /* transparency. Note this will close and re-open the device */ @@ -528,8 +498,6 @@ zpushpdf14devicefilter(i_ctx_t *i_ctx_p) if (cdev->is_open) { if ((code = gs_closedevice((gx_device *)cdev)) < 0) return code; - if (dev_proc(cdev, dev_spec_op)(cdev, gxdso_is_pdf14_device, NULL, 0) > 0) - pdf14_disable_device(cdev); /* should already be disabled (bug 698306) */ } if ((code = gs_opendevice((gx_device *)cdev)) < 0) return code; @@ -674,10 +642,6 @@ zcurrentSMask(i_ctx_t *i_ctx_p) const op_def ztrans1_op_defs[] = { {"1.setblendmode", zsetblendmode}, {"0.currentblendmode", zcurrentblendmode}, - {"1.setopacityalpha", zsetopacityalpha}, - {"0.currentopacityalpha", zcurrentopacityalpha}, - {"1.setshapealpha", zsetshapealpha}, - {"0.currentshapealpha", zcurrentshapealpha}, {"1.settextknockout", zsettextknockout}, {"0.currenttextknockout", zcurrenttextknockout}, {"0.pushextendedgstate", zpushextendedgstate}, |