summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-03-14 20:24:49 +0000
committerKarl Berry <karl@freefriends.org>2024-03-14 20:24:49 +0000
commit7bad9b14c550da9ae08669e681e2d94c11bddd9e (patch)
treeed81b7a7d34eb2da325026d3977131cdb8044c00 /Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx
parent2bb8d5e07c328b2737d7e4ba46365bffa060b64f (diff)
l3 (14mar24)
git-svn-id: svn://tug.org/texlive/trunk@70637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx78
1 files changed, 38 insertions, 40 deletions
diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx
index 6cc972f7d84..a5828bfd905 100644
--- a/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx
+++ b/Master/texmf-dist/source/latex/l3backend/l3backend-opacity.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2024-02-20}
+% \date{Released 2024-03-14}
%
% \maketitle
%
@@ -71,9 +71,9 @@
%<*dvips>
% \end{macrocode}
%
-% \begin{macro}{\@@_backend_select:n,\@@_backend_select_aux:n}
+% \begin{macro}{\@@_backend_select:n}
% \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
-% \begin{macro}{\@@_backend:nnn, \@@_backend:enn}
+% \begin{macro}{\@@_backend:nnn}
% 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
@@ -83,25 +83,20 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select:n #1
{
- \exp_args:Ne \@@_backend_select_aux:n
- { \fp_eval:n { min(max(0,#1),1) } }
- }
-\cs_new_protected:Npn \@@_backend_select_aux:n #1
- {
\@@_backend:nnn {#1} { fill } { ca }
\@@_backend:nnn {#1} { stroke } { CA }
}
\cs_new_protected:Npn \@@_backend_fill:n #1
{
- \@@_backend:enn
- { \fp_eval:n { min(max(0,#1),1) } }
+ \@@_backend:nnn
+ { #1 }
{ fill }
{ ca }
}
\cs_new_protected:Npn \@@_backend_stroke:n #1
{
- \@@_backend:enn
- { \fp_eval:n { min(max(0,#1),1) } }
+ \@@_backend:nnn
+ { #1 }
{ stroke }
{ CA }
}
@@ -124,7 +119,6 @@
ifelse
}
}
-\cs_generate_variant:Nn \@@_backend:nnn { e }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -143,7 +137,7 @@
% \begin{macrocode}
\bool_lazy_and:nnT
{ \cs_if_exist_p:N \pdfmanagement_if_active_p: }
- { \pdfmanagement_if_active_p:}
+ { \pdfmanagement_if_active_p: }
{
%<*luatex|pdftex>
\__kernel_color_backend_stack_init:Nnn \c_@@_backend_stack_int
@@ -157,24 +151,21 @@
%
% \begin{variable}{\l_@@_backend_fill_tl, \l_@@_backend_stroke_tl}
% We use |tl| here for speed: at the backend, this should be reasonable.
+% Both need to start off fully opaque.
% \begin{macrocode}
\tl_new:N \l_@@_backend_fill_tl
\tl_new:N \l_@@_backend_stroke_tl
+\tl_set:Nn \l_@@_backend_fill_tl { 1 }
+\tl_set:Nn \l_@@_backend_stroke_tl { 1 }
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\@@_backend_select:n, \@@_backend_select_aux:n}
+% \begin{macro}{\@@_backend_select:n}
% \begin{macro}{\@@_backend_reset:}
-% Other than the need to evaluate the opacity as an \texttt{fp}, much the
-% same as color.
+% Much the same as color.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select:n #1
{
- \exp_args:Ne \@@_backend_select_aux:n
- { \fp_eval:n { min(max(0,#1),1) } }
- }
-\cs_new_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 }
@@ -189,12 +180,6 @@
{ /opacity #1 ~ gs }
\group_insert_after:N \@@_backend_reset:
}
-\bool_lazy_and:nnF
- { \cs_if_exist_p:N \pdfmanagement_if_active_p: }
- { \pdfmanagement_if_active_p:}
- {
- \cs_gset_protected:Npn \@@_backend_select_aux:n #1 { }
- }
\cs_new_protected:Npn \@@_backend_reset:
{
%<*dvipdfmx|xetex>
@@ -210,26 +195,26 @@
% \end{macro}
%
% \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
-% \begin{macro}{\@@_backend_fillstroke:nn, \@@_backend_fillstroke:ee}
+% \begin{macro}{\@@_backend_fill_stroke:nn}
% For separate fill and stroke, we need to work out if we need to do
% more work or if we can stick to a single setting.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill:n #1
{
- \@@_backend_fill_stroke:ee
- { \fp_eval:n { min(max(0,#1),1) } }
- \l_@@_backend_stroke_tl
+ \exp_args:Nno \@@_backend_fill_stroke:nn
+ { #1 }
+ { \l_@@_backend_stroke_tl }
}
\cs_new_protected:Npn \@@_backend_stroke:n #1
{
- \@@_backend_fill_stroke:ee
- \l_@@_backend_fill_tl
- { \fp_eval:n { min(max(0,#1),1) } }
+ \exp_args:No \@@_backend_fill_stroke:nn
+ { \l_@@_backend_fill_tl }
+ { #1 }
}
\cs_new_protected:Npn \@@_backend_fill_stroke:nn #1#2
{
\str_if_eq:nnTF {#1} {#2}
- { \@@_backend_select_aux:n {#1} }
+ { \@@_backend_select:n {#1} }
{
\tl_set:Nn \l_@@_backend_fill_tl {#1}
\tl_set:Nn \l_@@_backend_stroke_tl {#2}
@@ -237,7 +222,7 @@
{ opacity.fill #1 }
{ << /ca ~ #1 >> }
\pdfmanagement_add:nnn { Page / Resources / ExtGState }
- { opacity.stroke #1 }
+ { opacity.stroke #2 }
{ << /CA ~ #2 >> }
%<*dvipdfmx|xetex>
\__kernel_backend_literal_pdf:n
@@ -249,11 +234,24 @@
\group_insert_after:N \@@_backend_reset:
}
}
-\cs_generate_variant:Nn \@@_backend_fill_stroke:nn { ee }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\@@_backend_select:n, \@@_backend_fill_stroke:nn}
+% Redefine them to stubs if pdfmanagement is either not loaded or
+% deactivated.
+% \begin{macrocode}
+\bool_lazy_and:nnF
+ { \cs_if_exist_p:N \pdfmanagement_if_active_p: }
+ { \pdfmanagement_if_active_p: }
+ {
+ \cs_gset_protected:Npn \@@_backend_select:n #1 { }
+ \cs_gset_protected:Npn \@@_backend_fill_stroke:nn #1#2 { }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
@@ -272,9 +270,9 @@
\cs_new_protected:Npn \@@_backend_fill:n #1
{ \@@_backend:nn {#1} { fill- } }
\cs_new_protected:Npn \@@_backend_stroke:n #1
- { \@@_backend:nn { {#1} } { stroke- } }
+ { \@@_backend:nn {#1} { stroke- } }
\cs_new_protected:Npn \@@_backend:nn #1#2
- { \__kernel_backend_scope:e { #2 opacity = " \fp_eval:n { min(max(0,#1),1) } " } }
+ { \__kernel_backend_scope:e { #2 opacity = " #1 " } }
% \end{macrocode}
% \end{macro}
% \end{macro}