summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2020-03-27 14:46:05 -0700
committerMichael Vrhel <michael.vrhel@artifex.com>2020-03-27 14:46:05 -0700
commitd12d2085b5bd08ca1e813d97f3f7f7e630e791a0 (patch)
tree56172749b47c14c26f9f98df58e0f61f1107632f /xps
parent1241ea6848d254de9a9dbcb8c8edf10a59761d1d (diff)
downloadghostpdl-d12d2085b5bd08ca1e813d97f3f7f7e630e791a0.tar.gz
Squashed commit of the opacity_shape branch
This commit removes shape.alpha and opacity.alpha from the graphic state. This involved removal of methods in the postscript based PDF interpreter, changes in the pdf14 device, changes in pdfwrite, the XPS interpreter, and the PS transparency test file that is present in examples and on the cluster. The goal of this commit was to avoid confusion and conflicts between shape.alpha opacity.alpha and the stroke and fill alpha values (CA ca). This change resulted in progressions in the XPS file. There were changes in a couple PDF files that required some investigation. In particular, the change in the dashed lines of Bug694981.pdf. Robin and I looked at this. Robin determined it was due to differences in stroke_add and stroke_fill not giving identical results. In the end, the new output looks closer the what AR provides.
Diffstat (limited to 'xps')
-rw-r--r--xps/xpscolor.c2
-rw-r--r--xps/xpsgradient.c2
-rw-r--r--xps/xpsimage.c3
-rw-r--r--xps/xpsopacity.c11
-rw-r--r--xps/xpspath.c2
-rw-r--r--xps/xpstile.c4
6 files changed, 11 insertions, 13 deletions
diff --git a/xps/xpscolor.c b/xps/xpscolor.c
index 980a71745..f8f0d6bf0 100644
--- a/xps/xpscolor.c
+++ b/xps/xpscolor.c
@@ -28,7 +28,6 @@ xps_set_color(xps_context_t *ctx, gs_color_space *cs, float *samples)
if (ctx->opacity_only)
{
- gs_setopacityalpha(ctx->pgs, 1.0);
gs_setfillconstantalpha(ctx->pgs, 1.0);
gs_setstrokeconstantalpha(ctx->pgs, 1.0);
gs_setgray(ctx->pgs, samples[0]);
@@ -40,7 +39,6 @@ xps_set_color(xps_context_t *ctx, gs_color_space *cs, float *samples)
for (i = 0; i < n; i++)
cc.paint.values[i] = samples[i + 1];
- gs_setopacityalpha(ctx->pgs, samples[0]);
gs_setfillconstantalpha(ctx->pgs, samples[0]);
gs_setstrokeconstantalpha(ctx->pgs, samples[0]);
gs_setcolorspace(ctx->pgs, cs);
diff --git a/xps/xpsgradient.c b/xps/xpsgradient.c
index cd59ba30c..60a828302 100644
--- a/xps/xpsgradient.c
+++ b/xps/xpsgradient.c
@@ -999,7 +999,7 @@ xps_parse_gradient_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dic
}
gs_end_transparency_mask(ctx->pgs, TRANSPARENCY_CHANNEL_Opacity);
- gs_trans_group_params_init(&tgp);
+ gs_trans_group_params_init(&tgp, 1.0);
gs_begin_transparency_group(ctx->pgs, &tgp, &bbox, PDF14_BEGIN_TRANS_GROUP);
code = draw(ctx, root, spread_method, color_func);
if (code)
diff --git a/xps/xpsimage.c b/xps/xpsimage.c
index e08a068ec..e789b266e 100644
--- a/xps/xpsimage.c
+++ b/xps/xpsimage.c
@@ -316,7 +316,6 @@ xps_paint_image_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict,
return gs_rethrow(code, "cannot gsave before transparency group");
/* You do not want the opacity to be used in the image soft mask filling */
- gs_setopacityalpha(ctx->pgs, 1.0);
gs_setfillconstantalpha(ctx->pgs, 1.0);
gs_setstrokeconstantalpha(ctx->pgs, 1.0);
gs_trans_mask_params_init(&params, TRANSPARENCY_MASK_Luminosity);
@@ -332,7 +331,7 @@ xps_paint_image_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict,
gs_setcolorspace(ctx->pgs, image->colorspace);
gs_setblendmode(ctx->pgs, BLEND_MODE_Normal);
- gs_trans_group_params_init(&tgp);
+ gs_trans_group_params_init(&tgp, 1.0);
gs_begin_transparency_group(ctx->pgs, &tgp, &bbox, PDF14_BEGIN_TRANS_GROUP);
code = xps_paint_image_brush_imp(ctx, image, 0);
if (code < 0)
diff --git a/xps/xpsopacity.c b/xps/xpsopacity.c
index 64e414bd5..acd0b2c70 100644
--- a/xps/xpsopacity.c
+++ b/xps/xpsopacity.c
@@ -78,9 +78,8 @@ xps_begin_opacity(xps_context_t *ctx, char *base_uri, xps_resource_t *dict,
if (opacity_att)
opacity = atof(opacity_att);
gs_setblendmode(ctx->pgs, BLEND_MODE_Normal);
- gs_setopacityalpha(ctx->pgs, opacity);
- gs_setfillconstantalpha(ctx->pgs, opacity);
- gs_setstrokeconstantalpha(ctx->pgs, opacity);
+ gs_setfillconstantalpha(ctx->pgs, 1.0);
+ gs_setstrokeconstantalpha(ctx->pgs, 1.0);
code = xps_bounds_in_user_space_path_clip(ctx, &bbox, use_path, is_stroke);
if (code < 0)
@@ -125,8 +124,12 @@ xps_begin_opacity(xps_context_t *ctx, char *base_uri, xps_resource_t *dict,
ctx->opacity_only = save;
}
- gs_trans_group_params_init(&tgp);
+ gs_setfillconstantalpha(ctx->pgs, opacity);
+ gs_setstrokeconstantalpha(ctx->pgs, opacity);
+ gs_trans_group_params_init(&tgp, opacity);
gs_begin_transparency_group(ctx->pgs, &tgp, &bbox, PDF14_BEGIN_TRANS_GROUP);
+ gs_setfillconstantalpha(ctx->pgs, 1.0);
+ gs_setstrokeconstantalpha(ctx->pgs, 1.0);
return 0;
}
diff --git a/xps/xpspath.c b/xps/xpspath.c
index d2eff223b..19d6506ce 100644
--- a/xps/xpspath.c
+++ b/xps/xpspath.c
@@ -65,7 +65,7 @@ xps_clip(xps_context_t *ctx)
void
xps_fill(xps_context_t *ctx)
{
- if (gs_currentopacityalpha(ctx->pgs) < 0.001)
+ if (gs_getfillconstantalpha(ctx->pgs) < 0.001)
gs_newpath(ctx->pgs);
else if (ctx->fill_rule == 0) {
if (gs_eofill(ctx->pgs) == gs_error_Remap_Color){
diff --git a/xps/xpstile.c b/xps/xpstile.c
index d278bd8fe..eea48f478 100644
--- a/xps/xpstile.c
+++ b/xps/xpstile.c
@@ -388,12 +388,10 @@ xps_parse_tiling_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict,
/* If the tiling brush has an opacity, it was already set in the group
that we are filling. Reset to 1.0 here to avoid double application
when the tiling actually occurs */
- opacity = ctx->pgs->opacity.alpha;
- gs_setopacityalpha(ctx->pgs, 1.0);
+ opacity = gs_getfillconstantalpha(ctx->pgs);
gs_setfillconstantalpha(ctx->pgs, 1.0);
gs_setstrokeconstantalpha(ctx->pgs, 1.0);
xps_fill(ctx);
- gs_setopacityalpha(ctx->pgs, opacity);
gs_setfillconstantalpha(ctx->pgs, opacity);
gs_setstrokeconstantalpha(ctx->pgs, opacity);