[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: new transparent version (358acc5)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Aug 27 23:53:31 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/358acc5e8cb0a595aafc01559d4cafcaf4e40722

>---------------------------------------------------------------

commit 358acc5e8cb0a595aafc01559d4cafcaf4e40722
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Aug 27 23:53:31 2019 +0200

    new transparent version


>---------------------------------------------------------------

358acc5e8cb0a595aafc01559d4cafcaf4e40722
 build.lua                       |   5 +-
 newpackages/new-transparent.sty | 107 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/build.lua b/build.lua
index 9b0763e..75779b6 100644
--- a/build.lua
+++ b/build.lua
@@ -7,7 +7,10 @@ bundle  = ""
 module  = "pdfresources"
 
 installfiles = {"*.sty","*.cls","*.def","*.lua"}
-sourcefiles =  {"*.dtx","*.ins","hluatex-experimental.def","tmpl3shipout.sty"}
+sourcefiles =  {"*.dtx","*.ins",
+                "hluatex-experimental.def",
+                "tmpl3shipout.sty",
+                "newpackages/new-transparent.sty"}
 
 checkruns = 3
 checkengines = {"luatex","pdftex","xetex"}
diff --git a/newpackages/new-transparent.sty b/newpackages/new-transparent.sty
new file mode 100644
index 0000000..baa6a99
--- /dev/null
+++ b/newpackages/new-transparent.sty
@@ -0,0 +1,107 @@
+%%
+%% This is file `transparent.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% transparent.dtx  (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Project: transparent
+%% Version: 2018/11/18 v1.3
+%%
+%% Copyright (C) 2007 by
+%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. This version of this license is in
+%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
+%% and the latest version of this license is in
+%%    http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Heiko Oberdiek.
+%%
+%% This work consists of the main source file transparent.dtx
+%% and the derived files
+%%    transparent.sty, transparent.pdf, transparent.ins, transparent.drv,
+%%    transparent-example.tex.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{new-transparent}%
+  [2019/08/27 v1.4 Transparency via pdfTeX's color stack (HO)]%
+\RequirePackage{ifpdf}
+\ifpdf
+\else
+  \PackageWarningNoLine{transparent}{%
+    Loading aborted, because pdfTeX is not running in PDF mode%
+  }%
+  \expandafter\endinput
+\fi
+\ifx\pdfextension\@undefined
+  \let\TRP at pdfcolorstackinit\pdfcolorstackinit
+  \let\TRP at pdfpageresources\pdfpageresources
+  \let\TRP at pdfcolorstack\pdfcolorstack
+\else
+  \def\TRP at pdfcolorstackinit           {\pdffeedback colorstackinit}
+  \protected\edef\TRP at pdfpageresources {\pdfvariable pageresources}
+  \protected\def\TRP at pdfcolorstack     {\pdfextension colorstack}
+\fi
+\ifcsname pdf_pageresources_gput:nnn\endcsname
+\else
+\PackageWarningNoLine{new-transparent}{%
+    Loading aborted, because pdf resource management code not found%
+  }%
+  \expandafter\endinput
+\fi
+
+\ExplSyntaxOn
+\pdf_pageresources_gput:nnn { ExtGState}{TRP1}{<</ca~1/CA~1>>}
+\cs_new_protected:Npn \__transparent_use:n #1
+ {
+   \tl_if_exist:cF { c__transparent_TRP#1_tl }
+     {
+       \pdf_pageresources_gput:nnn { ExtGState}{TRP#1}{<</ca~#1/CA~#1>>}
+       \tl_const:cn { c__transparent_TRP#1_tl }{ /TRP#1~gs }
+     }
+ }
+
+\xdef\TRP at colorstack{%
+  \TRP at pdfcolorstackinit~page~direct{/TRP1~gs}%
+}
+\newcommand*{\transparent}[1]
+  {
+    \exp_args:Nx\__transparent_use:n { \fp_eval:n{ min(max(0,#1),1)}}
+    \tl_set:Nx  \transparent at current { \fp_eval:n{ min(max(0,#1),1)}}
+    \transparent at set
+  }
+
+\def\transparent at current{/TRP1 gs}
+\def\transparent at set
+  {
+    \TRP at pdfcolorstack\TRP at colorstack~push~
+      {
+        \tl_use:c { c__transparent_TRP\transparent at current _tl }
+      }
+        \aftergroup\transparent at reset
+  }
+\ExplSyntaxOff
+\def\transparent at reset{%
+  \TRP at pdfcolorstack\TRP at colorstack pop\relax
+}
+\newcommand*{\texttransparent}[2]{%
+  \protect\leavevmode
+  \begingroup
+    \transparent{#1}%
+    #2%
+  \endgroup
+}
+\endinput
+%%
+%% End of file `transparent.sty'.





More information about the latex3-commits mailing list