[latex3-commits] [git/LaTeX3-latex3-latex3] master: Extend opacity to older (x)dvipdfmx (1238d6e0f)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sun Jan 24 18:37:41 CET 2021
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/1238d6e0fba1f3d5b553cbf30bc96c12d5d48292
>---------------------------------------------------------------
commit 1238d6e0fba1f3d5b553cbf30bc96c12d5d48292
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun Jan 24 17:37:41 2021 +0000
Extend opacity to older (x)dvipdfmx
At least, I hope so!
>---------------------------------------------------------------
1238d6e0fba1f3d5b553cbf30bc96c12d5d48292
l3backend/l3backend-opacity.dtx | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/l3backend/l3backend-opacity.dtx b/l3backend/l3backend-opacity.dtx
index 25999e291..c9f2a8cde 100644
--- a/l3backend/l3backend-opacity.dtx
+++ b/l3backend/l3backend-opacity.dtx
@@ -214,11 +214,36 @@
% \end{macrocode}
%
% \begin{macro}{\@@_backend_select:n}
-% Older backends have no stack support.
+% Older backends have no stack support, so everything is done directly.
% \begin{macrocode}
\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
{
- \cs_gset_protected:Npn \@@_backend_select:n #1 { }
+ \cs_gset_protected:Npn \@@_backend_select_aux:n #1
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#1}
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity #1 }
+ { << /ca ~ #1 /CA ~ #1 >> }
+ \__kernel_backend_literal_pdf:n { /opacity #1 ~ gs }
+ }
+ \cs_gset_protected:Npn \@@_backend_fill_stroke:nn #1#2
+ {
+ \str_if_eq:nnTF {#1} {#2}
+ { \@@_backend_select_aux:n {#1} }
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#2}
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity.fill #1 }
+ { << /ca ~ #1 >> }
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity.stroke #1 }
+ { << /CA ~ #2 >> }
+ \__kernel_backend_literal_pdf:n
+ { /opacity.fill #1 ~ gs /opacity.stroke #2 ~ gs }
+ }
+ }
}
% \end{macrocode}
% \end{macro}
More information about the latex3-commits
mailing list.