summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2016-09-15 12:21:11 +0100
committerKen Sharp <ken.sharp@artifex.com>2017-05-29 16:45:16 +0100
commit257b128c1f083c195af5fc3ef1137e2a104276ca (patch)
tree70a2dabe8a1cf1290b718a9e82bd909c34c1ff28
parent18a9dd1bc3ea951e4c55fcec968c8292396d0df2 (diff)
downloadghostpdl-257b128c1f083c195af5fc3ef1137e2a104276ca.tar.gz
Separate overprint for stroke and overprint for everything else. Add
means to set and retrieve each individually. Make the PDF interpreter use the correct one. Make the PostScript overprint set both. Hopefully in the future we may add code to use the correct overprint directly from the gstate, instead of using swapcolors to do so, which is the current method. For me this produces a couple of surprising progressions with devices which honour overprint.
-rw-r--r--Resource/Init/pdf_draw.ps4
-rw-r--r--Resource/Init/pdf_ops.ps20
-rw-r--r--base/gsstate.c39
-rw-r--r--base/gsstate.h5
-rw-r--r--base/gxgstate.h6
-rw-r--r--psi/zcssepr.c50
6 files changed, 111 insertions, 13 deletions
diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps
index dbe31706f..485369869 100644
--- a/Resource/Init/pdf_draw.ps
+++ b/Resource/Init/pdf_draw.ps
@@ -35,12 +35,12 @@ pdfdict begin
% not set them.
/FillColor //sc1
/FillColorSpace { /FillColorSpace gput } bind
- /FillOverprint //op
+% /FillOverprint //op
/SoftMask //SMask
% /StrokeConstantAlpha //CA
/StrokeColor //SC1
/StrokeColorSpace { /StrokeColorSpace gput } bind
- /StrokeOverprint //OP
+% /StrokeOverprint //OP
% /TextSpacing //Tc
% We can't use //Tz as we've stored the value we actually use,
% not value * 100 (see /Tz in pdf_ops.ps)
diff --git a/Resource/Init/pdf_ops.ps b/Resource/Init/pdf_ops.ps
index 46af59331..4d1039d91 100644
--- a/Resource/Init/pdf_ops.ps
+++ b/Resource/Init/pdf_ops.ps
@@ -217,6 +217,8 @@ currentdict /gput_always_allow .undef
currentsmoothness
currentflat
currentoverprint
+ .currentstrokeoverprint
+ .currentfilloverprint
currentstrokeadjust
currentdash
currentmiterlimit
@@ -244,6 +246,8 @@ currentdict /gput_always_allow .undef
setmiterlimit
setdash
setstrokeadjust
+ .setfilloverprint
+ .setstrokeoverprint
setoverprint
setflat
setsmoothness
@@ -364,8 +368,10 @@ currentdict /gput_always_allow .undef
% ---------------- Overprint/transparency setting ---------------- %
-/op { /FillOverprint gput } bdef % NB pdf_draw:gsparamdict handled /OP with no /op
-/OP { /StrokeOverprint gput } bdef
+/op { .setfilloverprint %/FillOverprint gput
+} bdef % NB pdf_draw:gsparamdict handled /OP with no /op
+/OP { .setstrokeoverprint %/StrokeOverprint gput
+} bdef
/OPM {
/.setoverprintmode where { pop dup .setoverprintmode .swapcolors .setoverprintmode .swapcolors } { pop } ifelse
} bdef
@@ -422,7 +428,7 @@ currentdict /gput_always_allow .undef
} bdef
% (Non-mask) images must execute setfillblend.
/setfillblend {
- FillOverprint setoverprint
+% FillOverprint setoverprint
.getFillConstantAlpha
SoftMask .settransparencyparams
} def
@@ -432,7 +438,7 @@ currentdict /gput_always_allow .undef
/setstrokestate {
.swapcolors
- StrokeColor StrokeColorSpace setgcolor StrokeOverprint setoverprint
+ StrokeColor StrokeColorSpace setgcolor %StrokeOverprint setoverprint
.getStrokeConstantAlpha
SoftMask .settransparencyparams
.swapcolors
@@ -595,8 +601,10 @@ end def
pop currentcolorspace 1 get % use the base space
} if
known {
- /stroke ne { FillOverprint } { StrokeOverprint } ifelse
- .currentblendmode dup /Normal eq exch /Compatible eq or not and
+ /stroke ne { .currentfilloverprint %FillOverprint
+ } { .currentstrokeoverprint %StrokeOverprint
+ } ifelse
+ .currentblendmode dup /Normal eq exch /Compatible eq or not and
} {
pop //false
} ifelse
diff --git a/base/gsstate.c b/base/gsstate.c
index f8f1a56d7..d7cc7dc04 100644
--- a/base/gsstate.c
+++ b/base/gsstate.c
@@ -671,6 +671,7 @@ gs_setoverprint(gs_gstate * pgs, bool ovp)
bool prior_ovp = pgs->overprint;
pgs->overprint = ovp;
+ pgs->overprint_stroke = ovp;
if (prior_ovp != ovp)
(void)gs_do_set_overprint(pgs);
}
@@ -682,6 +683,40 @@ gs_currentoverprint(const gs_gstate * pgs)
return pgs->overprint;
}
+/* setstrokeoverprint */
+void
+gs_setstrokeoverprint(gs_gstate * pgs, bool ovp)
+{
+ bool prior_ovp = pgs->overprint_stroke;
+
+ pgs->overprint_stroke = ovp;
+}
+
+/* currentstrokeoverprint */
+bool
+gs_currentstrokeoverprint(const gs_gstate * pgs)
+{
+ return pgs->overprint_stroke;
+}
+
+/* setstrokeoverprint */
+void
+gs_setfilloverprint(gs_gstate * pgs, bool ovp)
+{
+ bool prior_ovp = pgs->overprint;
+
+ pgs->overprint = ovp;
+ if (prior_ovp != ovp)
+ (void)gs_do_set_overprint(pgs);
+}
+
+/* currentstrokeoverprint */
+bool
+gs_currentfilloverprint(const gs_gstate * pgs)
+{
+ return pgs->overprint;
+}
+
/* setoverprintmode */
int
gs_setoverprintmode(gs_gstate * pgs, int mode)
@@ -1309,8 +1344,8 @@ void gs_swapcolors_quick(gs_gstate *pgs)
pgs->color_component_map_alt = tmp_ccm;
tmp = pgs->overprint;
- pgs->overprint = pgs->overprint_alt;
- pgs->overprint_alt = tmp;
+ pgs->overprint = pgs->overprint_stroke;
+ pgs->overprint_stroke = tmp;
tmp = pgs->overprint_mode;
pgs->overprint_mode = pgs->overprint_mode_alt;
diff --git a/base/gsstate.h b/base/gsstate.h
index 752689ba3..fad48d4bc 100644
--- a/base/gsstate.h
+++ b/base/gsstate.h
@@ -49,6 +49,11 @@ int gs_copygstate(gs_gstate * /*to */ , const gs_gstate * /*from */ ),
int gs_gstate_update_overprint(gs_gstate *, const gs_overprint_params_t *);
bool gs_currentoverprint(const gs_gstate *);
void gs_setoverprint(gs_gstate *, bool);
+bool gs_currentstrokeoverprint(const gs_gstate *);
+void gs_setstrokeoverprint(gs_gstate *, bool);
+bool gs_currentfilloverprint(const gs_gstate *);
+void gs_setfilloverprint(gs_gstate *, bool);
+
int gs_currentoverprintmode(const gs_gstate *);
int gs_setoverprintmode(gs_gstate *, int);
diff --git a/base/gxgstate.h b/base/gxgstate.h
index f39a4fe41..e98d885d0 100644
--- a/base/gxgstate.h
+++ b/base/gxgstate.h
@@ -321,7 +321,7 @@ struct gs_gstate_s {
bool overprint;
int overprint_mode;
int effective_overprint_mode;
- bool overprint_alt;
+ bool overprint_stroke;
int overprint_mode_alt;
int effective_overprint_mode_alt;
float flatness;
@@ -367,7 +367,7 @@ struct gs_gstate_s {
void *SMask;
/* void *BM; Already handled (.setblendmode) */
bool AIS;
- bool OP; /* Stroke overprint, for fill we will use existing overprint */
+/* bool OP; /* Stroke overprint, for fill we will use existing overprint */
/* bool TK; Already handled (.settextknockout) */
float Tc;
float TL;
@@ -434,7 +434,7 @@ struct gs_gstate_s {
s->overprint = __state_init.overprint; \
s->overprint_mode = __state_init.overprint_mode; \
s->effective_overprint_mode = __state_init.effective_overprint_mode; \
- s->overprint_alt = __state_init.overprint_alt; \
+ s->overprint_stroke = __state_init.overprint_stroke; \
s->overprint_mode_alt = __state_init.overprint_mode_alt; \
s->effective_overprint_mode_alt = __state_init.effective_overprint_mode_alt; \
s->flatness = __state_init.flatness; \
diff --git a/psi/zcssepr.c b/psi/zcssepr.c
index 9c3b52b3f..9d7011882 100644
--- a/psi/zcssepr.c
+++ b/psi/zcssepr.c
@@ -73,6 +73,52 @@ zsetoverprint(i_ctx_t *i_ctx_p)
return 0;
}
+/* - currentstrokeoverprint <bool> */
+static int
+zcurrentstrokeoverprint(i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+
+ push(1);
+ make_bool(op, gs_currentstrokeoverprint(igs));
+ return 0;
+}
+
+/* <bool> setstrokeoverprint - */
+static int
+zsetstrokeoverprint(i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+
+ check_type(*op, t_boolean);
+ gs_setstrokeoverprint(igs, op->value.boolval);
+ pop(1);
+ return 0;
+}
+
+/* - currentfilloverprint <bool> */
+static int
+zcurrentfilloverprint(i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+
+ push(1);
+ make_bool(op, gs_currentfilloverprint(igs));
+ return 0;
+}
+
+/* <bool> setfilloverprint - */
+static int
+zsetfilloverprint(i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+
+ check_type(*op, t_boolean);
+ gs_setfilloverprint(igs, op->value.boolval);
+ pop(1);
+ return 0;
+}
+
/* - .currentoverprintmode <int> */
static int
zcurrentoverprintmode(i_ctx_t *i_ctx_p)
@@ -107,5 +153,9 @@ const op_def zcssepr_l2_op_defs[] =
{"0.currentoverprintmode", zcurrentoverprintmode},
{"1setoverprint", zsetoverprint},
{"1.setoverprintmode", zsetoverprintmode},
+ {"0.currentstrokeoverprint", zcurrentstrokeoverprint},
+ {"1.setstrokeoverprint", zsetstrokeoverprint},
+ {"0.currentfilloverprint", zcurrentfilloverprint},
+ {"1.setfilloverprint", zsetfilloverprint},
op_def_end(0)
};