| 1 |
%-------------------------------------------- |
| 2 |
% |
| 3 |
% Package pgfplots |
| 4 |
% |
| 5 |
% Provides a user-friendly interface to create function plots (normal |
| 6 |
% plots, semi-logplots and double-logplots). |
| 7 |
% |
| 8 |
% It is based on Till Tantau's PGF package. |
| 9 |
% |
| 10 |
% Copyright 2007/2008 by Christian Feuersänger. |
| 11 |
% |
| 12 |
% This program is free software: you can redistribute it and/or modify |
| 13 |
% it under the terms of the GNU General Public License as published by |
| 14 |
% the Free Software Foundation, either version 3 of the License, or |
| 15 |
% (at your option) any later version. |
| 16 |
% |
| 17 |
% This program is distributed in the hope that it will be useful, |
| 18 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
% GNU General Public License for more details. |
| 21 |
% |
| 22 |
% You should have received a copy of the GNU General Public License |
| 23 |
% along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 |
% |
| 25 |
%-------------------------------------------- |
| 26 |
|
| 27 |
|
| 28 |
\def\pgfplotslibrarysurf@initstream{% |
| 29 |
\if\pgfplotslibrarysurf@bytespercoordinate4% |
| 30 |
\pgfplots@warning{************** The generated postscript file may not be compatible with all viewers. Consider using \string\pgfplotsset{surf shading/precision=postscript} for improved compatibility. Or: convert it to pdf, that will work correctly. **************}% |
| 31 |
\fi |
| 32 |
% binary doesn't work due to limitations of DVI. |
| 33 |
% We NEED an ASCII encoding. |
| 34 |
% |
| 35 |
\def\pgfplotslibrarysurf@filter@encode{ASCIIHexEncode}% |
| 36 |
\def\pgfplotslibrarysurf@filter@decode{ASCIIHexDecode}% |
| 37 |
}% |
| 38 |
|
| 39 |
% The lowlevel call for surface shadings. It uses a pattern type 2 |
| 40 |
% dictionary as fill color and has thus several things to do. |
| 41 |
% |
| 42 |
% It appears the dvips implementation is simpler than the pdftex |
| 43 |
% implementation - I did not need to adjust the matrix (don't know |
| 44 |
% why). |
| 45 |
\def\pgfplotslibrarysurfdraw@sys{% |
| 46 |
\pgfpicture |
| 47 |
\pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa% |
| 48 |
\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa |
| 49 |
\pgfpathrectanglecorners |
| 50 |
{\pgfplotslibrarysurf@corner@sw} |
| 51 |
{\pgfplotslibrarysurf@corner@ne}% |
| 52 |
\pgfplotslibrarysurfusepath |
| 53 |
\endpgfpicture |
| 54 |
\leavevmode% ?? |
| 55 |
} |
| 56 |
|
| 57 |
% To be used inside of a pgfpicture. |
| 58 |
% |
| 59 |
% #1: a macro name. The contents of this macro needs to be written |
| 60 |
% into the pdf pattern dictionary contained in the pdf resources of |
| 61 |
% the current context. The current context is either the current page |
| 62 |
% or an xform object. |
| 63 |
% |
| 64 |
% |
| 65 |
\def\pgfplotssys@do@surfshading@fillpaths#1{% |
| 66 |
%http://www.ghostscript.com/pipermail/gs-devel/2002-September/005763.html |
| 67 |
%http://www.tek-tips.com/viewthread.cfm?qid=1183719&page=4 |
| 68 |
% \pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}% |
| 69 |
% \pgf@sys@bp@correct\pgf@x% |
| 70 |
% \pgf@sys@bp@correct\pgf@y% |
| 71 |
\pgfsys@invoke{% |
| 72 |
<< |
| 73 |
%/Type /Pattern |
| 74 |
/PatternType 2 |
| 75 |
/Shading |
| 76 |
<< |
| 77 |
/ShadingType \pgfplotslibrarysurf@type\space |
| 78 |
/BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space |
| 79 |
/BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space % Note: this here is the reason why I can't use ASCII85Decode |
| 80 |
\if5\pgfplotslibrarysurf@type |
| 81 |
/VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols} |
| 82 |
\else |
| 83 |
/BitsPerFlag 8 |
| 84 |
\fi |
| 85 |
/ColorSpace /Device\pgfplotslibrarysurf@colorspace |
| 86 |
/Decode [\pgfplotslibrarysurf@decode] |
| 87 |
\ifpgfplotslibrarysurf@usecolormap |
| 88 |
/Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} |
| 89 |
\fi |
| 90 |
/DataSource |
| 91 |
currentfile |
| 92 |
% direct binary output not possible: DVI |
| 93 |
% doesn't support it (?) |
| 94 |
%<< /EODCount \pgfplotslibrarysurf@binarystream@len\space /EODString () >> /SubFileDecode filter |
| 95 |
% not completely implemented : |
| 96 |
%/ASCII85Decode filter |
| 97 |
% works: |
| 98 |
/ASCIIHexDecode filter |
| 99 |
/ReusableStreamDecode filter |
| 100 |
\pgfplotslibrarysurf@binarystream |
| 101 |
%\csname pgfp@bin@126\endcsname% tilde ~> is end-of-input indicator for ASCII85Decode |
| 102 |
> % end-of-input indicator for ASCIIHexDecode |
| 103 |
>> |
| 104 |
>> [ 1 0 0 1 0 0 ] makepattern setpattern |
| 105 |
% I don't know why I don't need the shifts here !? But it |
| 106 |
% appears to work, so never mind. |
| 107 |
% >> [ 1 0 0 1 \pgf@sys@tonumber\pgf@x\space \pgf@sys@tonumber\pgf@y ] makepattern setpattern |
| 108 |
% 'setpattern' is a shortcut for changing the colorspace and |
| 109 |
% the color to pattern. |
| 110 |
}% |
| 111 |
} |
| 112 |
|
| 113 |
\endinput |
| 114 |
% vi: ft=tex |