2 %% This is file
'pyx.def',
4 % Copyright (C
) 2003 Michael Schindler
<m
-schindler@users.sourceforge.net
>
6 % this file is based on dvips.def from the LaTeX graphics bundle
,
7 % available via ftp from ftp.dante.de
9 % pyx.def is free software
; you can redistribute it and
/or modify
10 % it under the terms of the GNU General Public License as published by
11 % the Free Software Foundation
; either version
2 of the License
, or
12 % (at your option
) any later version.
14 % pyx.def is distributed in the hope that it will be useful
,
15 % but WITHOUT ANY WARRANTY
; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
17 % GNU General Public License for more details.
19 % You should have received a copy of the GNU General Public License
20 % along with pyx.def
; if not
, write to the Free Software
21 % Foundation
, Inc.
, 59 Temple Place
, Suite
330, Boston
, MA
02111-1307 USA
23 % TODO
: - documentation
25 \ProvidesFile
{pyx.def
}
26 [2003/06/12 driver
-dependant file
]
28 % %%%%%% auxiliary macros
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///
29 % used in DEF file only
:
30 % check if #
1 is in
[0,1]
34 \ifdim\dimen@
<\z@\dimen@\maxdimen
\fi
36 \PackageError
{color
}{Argument `#
1' not in range [0,1]}\@ehd
41 % %%%%%% (1a) gray, cmyk, rgb and RGB colors %%%%%%%%%%%%%%%%%%%%%%%%%%% ///
42 % used in color.sty: \color@gray, cmyk, rgb, RGB, hsb
43 % these commands are created with \csname as a
44 % combination of 'color@
' and 'gray
'/'cmyk
'/'rgb
'/'RGB
'/'hsb
'
45 % in color.sty by \@undeclaredcolor
46 % gray, cmyk, rgb, hsb all take numbers in [0,1] as first argument(s)
47 % RGB takes numbers in [0,255] as first arguments
50 \c@lor@arg{#2}% % check the argument
51 \edef#1{gray #2}% % prepare for command
54 \def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1} % \@@ is only a separator for the arguments!
55 \def\c@lor@@cmyk#1,#2,#3,#4\@@#5{%
60 \edef#5{cmyk #1 #2 #3 #4}% #5 is always \current@color (only once a \tempa)
63 \def\color@rgb#1#2{\c@lor@@rgb#2\@@#1}
64 \def\c@lor@@rgb#1,#2,#3\@@#4{%
68 \edef#4{rgb #1 #2 #3}%
71 \def\color@RGB#1#2{\c@lor@@RGB#2\@@#1}
72 \def\c@lor@@RGB#1,#2,#3\@@#4{%
73 \c@lor@RGB@rgb{#1}\@tempa % renormalise
74 \c@lor@RGB@rgb{#2}\@tempb
75 \c@lor@RGB@rgb{#3}\@tempc
76 \c@lor@@rgb\@tempa,\@tempb,\@tempc\@@#4% % call with normalised values
78 \def\c@lor@RGB@rgb#1#2{%
80 \divide\dimen@\@cclv % divide by 255
81 \edef#2{\strip@pt\dimen@}} % strip the number
83 \def\color@hsb#1#2{\c@lor@@hsb#2\@@#1}
84 \def\c@lor@@hsb#1,#2,#3\@@#4{%
88 \edef#4{hsb #1 #2 #3}% this is the string defining the color in the special.
89 % % it is stored in the variable \current@color
92 % %%%%%% (1b) "texnamed" colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///
93 % used in color.sty: \color@named \col@...
94 % like above with the use of \csname
96 \def\color@named#1#2{\c@lor@@named#2,,\@@#1}
97 \def\c@lor@@named#1,#2,#3\@@#4{%
98 \@ifundefined{col@#1}%
99 {\PackageError{color}{Undefined color `#1'}\@ehd
}%
100 {\edef#
4{texnamed #
1}}% % arguments
2,3 are thrown away? Maybe an error detection mechanism
101 } % \col@#
1 is defined by \define@color@named
102 \def\current@color
{texnamed Black
}
103 \def\define@color@named#
1#
2{% for \DefineNamedColor only
104 \expandafter\let\csname col@#
1\endcsname\@nnil
}
106 % %%%%%% (1c
) "pyxgray", "pyxcmyk", "pyxrgb", "pyxhsb" colors
%%%%%%%%%% ///
108 % use with
\textcolor
[pyxcmyk
]{Name
}
109 % where Name has to be defined in PyX as
'color.cmyk.Name'
110 % Attention
! PyX has to do the error detection if the color is not defined
!
112 \def\color@pyx#
1#
2{\c@olor@@pyx#
2,,\@@#
1}
113 \def\c@olor@@pyx#
1,#
2,#
3\@@#
4{%
116 % %%%%%% (1) colors general
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///
118 % \set@color is called by \@
(un
)declaredcolor in color.sty
119 % This is the starting string of the special
122 \special
{PyX
:color_begin \current@color
123 }\aftergroup
\reset@color
} % the
'group' is the one in \@textcolor
: arguments
1 and
3
124 \def
\reset@color
{\special
{PyX
:color_end
}}
126 % BACKGROUND COLOR is disabled
127 \def\set@page@color
{\PackageError
{color
}{Please adjust the pagecolor in PyX
, not in LaTeX
!}}
130 % %%%%%% (2) eps
-file inclusion
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///
132 \def\Ginclude@eps#
1{%
136 \dimen@
=0.996264009963\Gin@req@width
137 \@tempdima
=0.996264009963\Gin@req@height
138 \special
{PyX
:epsinclude\space
144 \ifx\Gin@scalex\@tempa\else width
=\strip@pt\dimen@\space
\fi
145 \ifx\Gin@scaley\@tempa\else height
=\strip@pt\@tempdima\space
\fi
146 \ifGin@clip clip
\fi
}%
149 % bmp
, oztex
, pntg
, pict file inclusions
:
150 % not available anymore
151 % \Ginclude@bmp eventually used in
graphics(x
).sty
152 % \Ginclude@pntg eventually used in
graphics(x
).sty
153 % \Ginclude@pict eventually used in
graphics(x
).sty
155 \def\Ginclude@bmp#
1{%
156 \PackageError
{color
}{bmp file inclusion is not supported in PyX. Please use eps files.
}}
157 \def\Ginclude@pntg#
1{
158 \PackageError
{color
}{pntg file inclusion is not supported in PyX. Please use eps files.
}}
159 \def\Ginclude@pict#
1{
160 \PackageError
{color
}{pict file inclusion is not supported in PyX. Please use eps files.
}}
164 %\def\Gin@PS@raw#
1{\special
{ps
: #
1}}
165 %\def\Gin@PS@restored#
1{\special
{" #1}}
166 %\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{! #1}}}
167 %\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}}
169 \def\Gin@extensions{.eps,.ps}
170 \@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}}
171 \@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}}
172 \@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}}
176 % %%%%%% (3) rotations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///
177 \def\Grot@start{\special{PyX:rotate_begin angle=\Grot@angle}}
178 \def\Grot@end{\special{PyX:rotate_end}}
181 % %%%%%% (4) scalings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///
183 \def\Gscale@start{\special{PyX:scale_begin xscale=\Gscale@x\space yscale=\Gscale@y}}
184 \def\Gscale@end{\special{PyX:scale_end}}
188 % vim:fdm=marker:fmr=///,//\\
190 %% End of file `pyx.def'.