diff options
author | Norbert Preining <preining@logic.at> | 2016-05-09 00:57:22 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-05-09 00:57:22 +0000 |
commit | 92a6ea3b2272ec23a66f91fcd73de6a80bb331fc (patch) | |
tree | a691e570094deb71ae41ac1dee2dec9cb79eeb36 /Master/texmf-dist/tex/generic/pgfplots | |
parent | 9372c86d681d2e294b6e5090464672f288d0510f (diff) |
add luatex drivers for pgf and pgfplots with agreement from TT
git-svn-id: svn://tug.org/texlive/trunk@40966 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def new file mode 100644 index 00000000000..516d8e02a98 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def @@ -0,0 +1,168 @@ +%-------------------------------------------- +% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/sys/pgflibrarysurfshading.pgfsys-pdftex.def,v 1.1 2009/06/11 07:14:52 ludewich Exp $ +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% pgflibrarypgfplots.surfshading.pgfsys-luatex.def +% converted from ...-pdftex.def by replacing disappeared primitives/vars +% with their respective replacements, as laid out in the luatex manual. +% Conversion by Norbert Preining +% +% Included into the TeX Live pgfplots package with agreement of Till Tantau. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% The lowlevel call for surface shadings. It uses a pattern type 2 +% dictionary as fill color and has thus several things to do. This is +% a little bit more complicated than using the '/sh' operator (as +% other pgf shadings do): the surface shading must be positioned +% exactly at the requested coordinates, otherwise it is quite useless. +% +% Since shadings are *not* affected by changes in the canvas +% transformation matrix (shifts, rotations etc), it is necessary to +% pack the shading into a separate xform object which is then rotated +% and translated correctly. +% +% There is just one more transformation necessary: the shift inside of +% the xform. This shift is done using changes in the canvas +% transformation matrix and it is UNDONE in the /Matrix argument of +% the pattern dictionary. This last step can't be done with the /sh +% operator which is why I am using pattern dictionaries. +\def\pgfplotslibrarysurfdraw@sys{% + \begingroup + %\pgfinterruptpicture% needed? + \setbox\pgfutil@tempboxa=\hbox{% + \pgfpicture + \pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa% + \global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa + \pgfpathrectanglecorners + {\pgfplotslibrarysurf@corner@sw} + {\pgfplotslibrarysurf@corner@ne}% + \pgfplotslibrarysurfusepath + \endpgfpicture + }% + \immediate\saveboxresource resources{ + /Pattern << \pgfplots@glob@TMPa >> % write the pattern resource dictionary + }\pgfutil@tempboxa + \leavevmode + \useboxresource\lastsavedboxresourceindex + %\endpgfinterruptpicture + \endgroup +} + +% To be used inside of a pgfpicture. +% +% #1: a macro name. The contents of this macro needs to be written +% into the pdf pattern dictionary contained in the pdf resources of +% the current context. The current context is either the current page +% or an xform object. +% +% +\def\pgfplotssys@do@surfshading@fillpaths#1{% + \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty + \else + % Unfortunately, there is a bug in pdftex/luatex: if we + % provide a /Filter as attr, and pdftex compresses the stream, + % it overwrites the /Filter argument -- and the viewer cannot + % decode the stream. We have to deactivate compression here: + \pdfvariable compresslevel=0 + \fi + \def\pgfplots@loc@TMPa{% + % stream length will be computed automatically + /ShadingType \pgfplotslibrarysurf@type\space + /BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space + /BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space + \if5\pgfplotslibrarysurf@type + /VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols} + \else + /BitsPerFlag 8 + \fi + /ColorSpace /Device\pgfplotslibrarysurf@colorspace + /Decode [\pgfplotslibrarysurf@decode] + \ifpgfplotslibrarysurf@usecolormap + /Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} + \fi + \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty + \else + /Filter /\pgfplotslibrarysurf@filter@decode\space + \fi + }% + % + % \pgfplots@loc@TMPb := final boolean luaBinaryEncoding; + \pgfutil@IfUndefined{directlua}{% + \def\pgfplots@loc@TMPb{0}% + }{% + \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty + % ah - we have binary encoding (the standard). + \def\pgfplots@loc@TMPb{1}% + \else + % ah - base 16 ASCII encoding: + \def\pgfplots@loc@TMPb{0}% + \fi + }% + \if0\pgfplots@loc@TMPb + % no lua binary encoding. Use standard pdftex operations: + \immediate\pdfextension obj stream attr {% + \pgfplots@loc@TMPa + } {% + \pgfplotslibrarysurf@binarystream + }% + \edef\pgfplots@loc@TMPa{\the\numexpr\pdffeedback lastobj\relax}% + \else + % special handling for luatex binary encoding (see docs for \pgfplotsbinarytoluabinary): + \pgfplotsbinarytoluabinary{\pgfplotslibrarysurf@binarystream}% + \edef\pgfplots@loc@TMPa{% + \directlua{% + tex.print(pdf.immediateobj(\pgfplotsDQ stream\pgfplotsDQ , pgfplotsretval, \pgfplotsDQ \pgfplots@loc@TMPa\pgfplotsDQ )); + pgfplotsretval=nil; + }% + }% + \fi + \pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}% + \pgf@sys@bp@correct\pgf@x% + \pgf@sys@bp@correct\pgf@y% + \immediate\pdfextension obj {<< + /Type /Pattern + /PatternType 2 +% /Matrix [\pgf@pt@aa\space\pgf@pt@ab\space\pgf@pt@ba\space\pgf@pt@bb\space\pgf@sys@tonumber\pgf@pt@x\space\pgf@sys@tonumber\pgf@pt@y] + % FIXME: INCORPORATE TIKZ CM + /Matrix [1 0 0 1 \pgf@sys@tonumber\pgf@x\space \pgf@sys@tonumber\pgf@y] %226.533 518.141] + %-------------------------------------------------- + % /ExtGState + % << + % /LW 2 + % /OP true + % /OPM 1 + % >> + %-------------------------------------------------- + /Shading \pgfplots@loc@TMPa\space 0 R + >>}% + \edef#1{% + /pgfpatPlotsurface\pgfplotslibrarysurf@count\space \the\numexpr\pdffeedback lastobj\relax\space 0 R + }% + \pgfsys@setpatterncolored{Plotsurface\pgfplotslibrarysurf@count}% + \pgfplotsutil@advancestringcounter@global\pgfplotslibrarysurf@count +} + +\endinput +% vi: ft=tex |