summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend/l3backend-opacity.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3backend/l3backend-opacity.dtx')
-rw-r--r--macros/latex/contrib/l3backend/l3backend-opacity.dtx59
1 files changed, 42 insertions, 17 deletions
diff --git a/macros/latex/contrib/l3backend/l3backend-opacity.dtx b/macros/latex/contrib/l3backend/l3backend-opacity.dtx
index a600defcc0..6017403ea0 100644
--- a/macros/latex/contrib/l3backend/l3backend-opacity.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-opacity.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-05-07}
+% \date{Released 2021-07-12}
%
% \maketitle
%
@@ -72,7 +72,14 @@
% \end{macrocode}
%
% \begin{macro}{\@@_backend_select:n,\@@_backend_select_aux:n}
-% No stack so set values directly.
+% \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
+% \begin{macro}{\@@_backend:nnn, \@@_backend:xnn}
+% No stack so set values directly. The need to deal with Distiller and
+% Ghostscript separately means we use a common auxiliary: the two
+% systems require different PostScript for transparency. This is
+% of course not quite as efficient as doing one test for setting all
+% transparency, but it keeps things clearer here. Thanks to Alex Grahn
+% for the detail on testing for GhostScript.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select:n #1
{
@@ -81,29 +88,47 @@
}
\cs_new_protected:Npn \@@_backend_select_aux:n #1
{
- \__kernel_backend_postscript:n
- { #1 ~ .setfillconstantalpha ~ #1 ~ .setstrokeconstantalpha }
+ \@@_backend:nnn {#1} { fill } { ca }
+ \@@_backend:nnn {#1} { stroke } { CA }
}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
-% \begin{macro}{\@@_backend:nn, \@@_backend:xn}
-% Similar to the above but with no stack and only adding to one or other of
-% the entries.
-% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill:n #1
- { \@@_backend:xn { \fp_eval:n { min(max(0,#1),1) } } { fill } }
+ {
+ \@@_backend:xnn
+ { \fp_eval:n { min(max(0,#1),1) } }
+ { fill }
+ { ca }
+ }
\cs_new_protected:Npn \@@_backend_stroke:n #1
- { \@@_backend:xn { \fp_eval:n { min(max(0,#1),1) } } { stroke } }
-\cs_new_protected:Npn \@@_backend:nn #1#2
{
- \__kernel_backend_postscript:n { #1 ~ .set #2 constantalpha }
+ \@@_backend:xnn
+ { \fp_eval:n { min(max(0,#1),1) } }
+ { stroke }
+ { CA }
}
-\cs_generate_variant:Nn \@@_backend:nn { x }
+\cs_new_protected:Npn \@@_backend:nnn #1#2#3
+ {
+ \__kernel_backend_postscript:n
+ {
+ product ~ (Ghostscript) ~ search
+ {
+ pop ~ pop ~ pop ~
+ #1 ~ .set #2 constantalpha
+ }
+ {
+ pop ~
+ mark ~
+ /#3 ~ #1
+ /SetTransparency ~
+ pdfmark
+ }
+ ifelse
+ }
+ }
+\cs_generate_variant:Nn \@@_backend:nnn { x }
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macrocode}
%</dvips>