| 1 |
%% dvips.def Copyright (C) 1994 David Carlisle Sebastian Rahtz |
| 2 |
%% Copyright (C) 1995-1999 David Carlisle |
| 3 |
%% Copyright (C) 2000-2025 David Carlisle, LaTeX3 Project |
| 4 |
%% |
| 5 |
%% This work may be distributed and/or modified under the |
| 6 |
%% conditions of the LaTeX Project Public License, either version 1.3c |
| 7 |
%% of this license or (at your option) any later version. |
| 8 |
%% The latest version of this license is in |
| 9 |
%% http://www.latex-project.org/lppl.txt |
| 10 |
%% and version 1.3c or later is part of all distributions of LaTeX |
| 11 |
%% version 2005/12/01 or later. |
| 12 |
%% |
| 13 |
%% This work has the LPPL maintenance status `maintained'. |
| 14 |
%% |
| 15 |
%% The Current Maintainer of this work is the LaTeX3 Project. |
| 16 |
%% |
| 17 |
%% https://github.com/latex3/graphics-def/issues |
| 18 |
%% |
| 19 |
\ProvidesFile{dvips.def} |
| 20 |
[2025/01/21 v3.2a Graphics/color driver for dvips] |
| 21 |
\def\GPT@space{ } |
| 22 |
\def\c@lor@arg#1{% |
| 23 |
\dimen@#1\p@ |
| 24 |
\ifdim\dimen@<\z@\dimen@\maxdimen\fi |
| 25 |
\ifdim\dimen@>\p@ |
| 26 |
\PackageError{color}{Argument `#1' not in range [0,1]}\@ehd |
| 27 |
\fi} |
| 28 |
\def\color@gray#1#2{% |
| 29 |
\c@lor@arg{#2}% |
| 30 |
\edef#1{gray #2}% |
| 31 |
} |
| 32 |
\def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1} |
| 33 |
\def\c@lor@@cmyk#1,#2,#3,#4\@@#5{% |
| 34 |
\c@lor@arg{#4}% |
| 35 |
\c@lor@arg{#1}% |
| 36 |
\c@lor@arg{#2}% |
| 37 |
\c@lor@arg{#3}% |
| 38 |
\edef#5{cmyk #1 #2 #3 #4}% |
| 39 |
} |
| 40 |
\def\color@rgb#1#2{\c@lor@@rgb#2\@@#1} |
| 41 |
\def\c@lor@@rgb#1,#2,#3\@@#4{% |
| 42 |
\c@lor@arg{#1}% |
| 43 |
\c@lor@arg{#2}% |
| 44 |
\c@lor@arg{#3}% |
| 45 |
\edef#4{rgb #1 #2 #3}% |
| 46 |
} |
| 47 |
\def\color@RGB#1#2{\c@lor@@RGB#2\@@#1} |
| 48 |
\def\c@lor@@RGB#1,#2,#3\@@#4{% |
| 49 |
\c@lor@RGB@rgb{#1}\@tempa |
| 50 |
\c@lor@RGB@rgb{#2}\@tempb |
| 51 |
\c@lor@RGB@rgb{#3}\@tempc |
| 52 |
\c@lor@@rgb\@tempa,\@tempb,\@tempc\@@#4% |
| 53 |
} |
| 54 |
\def\c@lor@RGB@rgb#1#2{% |
| 55 |
\dimen@#1\p@ |
| 56 |
\divide\dimen@\@cclv |
| 57 |
\edef#2{\strip@pt\dimen@}} |
| 58 |
\def\color@hsb#1#2{\c@lor@@hsb#2\@@#1} |
| 59 |
\def\c@lor@@hsb#1,#2,#3\@@#4{% |
| 60 |
\c@lor@arg{#1}% |
| 61 |
\c@lor@arg{#2}% |
| 62 |
\c@lor@arg{#3}% |
| 63 |
\edef#4{hsb #1 #2 #3}% |
| 64 |
} |
| 65 |
\def\color@named#1#2{\c@lor@@named#2,,\@@#1} |
| 66 |
\def\c@lor@@named#1,#2,#3\@@#4{% |
| 67 |
\@ifundefined{col@#1}% |
| 68 |
{\PackageError{color}{Undefined color `#1'}\@ehd}% |
| 69 |
{\edef#4{ #1}}% |
| 70 |
} |
| 71 |
\def\c@lor@to@ps#1 #2\@@{\csname c@lor@ps@#1\endcsname#2 \@@} |
| 72 |
\def\c@lor@ps@#1 #2\@@{TeXDict begin #1 end} |
| 73 |
\def\c@lor@ps@rgb#1\@@{#1 setrgbcolor} |
| 74 |
\def\c@lor@ps@hsb#1\@@{#1 sethsbcolor} |
| 75 |
\def\c@lor@ps@cmyk#1\@@{#1 setcmykcolor} |
| 76 |
\def\c@lor@ps@gray#1\@@{#1 setgray} |
| 77 |
\def\current@color{ Black} |
| 78 |
\def\set@color{% |
| 79 |
\special{color push \current@color |
| 80 |
}\aftergroup\reset@color} |
| 81 |
\def\reset@color{\special{% |
| 82 |
color pop}} |
| 83 |
\def\set@page@color{\special{% |
| 84 |
background \current@color}} |
| 85 |
\def\define@color@named#1#2{% |
| 86 |
\expandafter\let\csname col@#1\endcsname\@nnil} |
| 87 |
\def\no@page@color{\special{background \string"newpath clip}} |
| 88 |
\def\Ginclude@eps#1{% |
| 89 |
\message{<#1>}% |
| 90 |
\bgroup |
| 91 |
\def\@tempa{!}% |
| 92 |
\dimen@\Gin@req@width |
| 93 |
\[email protected]% |
| 94 |
\divide\dimen@\dimen@ii |
| 95 |
\@tempdima\Gin@req@height |
| 96 |
\divide\@tempdima\dimen@ii |
| 97 |
\special{PSfile="#1"\GPT@space |
| 98 |
llx=\Gin@llx\GPT@space |
| 99 |
lly=\Gin@lly\GPT@space |
| 100 |
urx=\Gin@urx\GPT@space |
| 101 |
ury=\Gin@ury\GPT@space |
| 102 |
\ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\GPT@space\fi |
| 103 |
\ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\GPT@space\fi |
| 104 |
\ifGin@clip clip\fi}% |
| 105 |
\egroup} |
| 106 |
|
| 107 |
|
| 108 |
\ifx\directlua\@undefined\else |
| 109 |
\directlua{ |
| 110 |
function convert_line_bytes (line) |
| 111 |
return string.gsub(line, ".", |
| 112 |
function (char) return unicode.utf8.char(string.byte(char)) end) |
| 113 |
end |
| 114 |
} |
| 115 |
\AtBeginDocument{%Tiff Previews are not UTF-8 |
| 116 |
\def\Gread@eps#1{% |
| 117 |
\directlua{luatexbase.add_to_callback("process_input_buffer", convert_line_bytes, "8 bit input")}% |
| 118 |
\Gread@generic{#1}\Gread@eps@aux |
| 119 |
\directlua{luatexbase.remove_from_callback("process_input_buffer","8 bit input")}% |
| 120 |
}% |
| 121 |
} |
| 122 |
\fi |
| 123 |
|
| 124 |
|
| 125 |
\def\Ginclude@bmp#1{% |
| 126 |
\message{<#1>}% |
| 127 |
\dimen@\Gin@req@height |
| 128 |
\advance\dimen@ by-\Gin@lly bp |
| 129 |
\kern-\Gin@llx bp\raise\Gin@req@height\hbox{% |
| 130 |
\ifdim\Gin@urx bp=\z@ |
| 131 |
\ifdim\Gin@ury bp=\z@ |
| 132 |
\special{em: graph #1}% |
| 133 |
\else |
| 134 |
\special{em: graph #1,\Gin@urx bp}% |
| 135 |
\fi |
| 136 |
\else |
| 137 |
\special{em: graph #1,\Gin@urx bp,\Gin@ury bp}% |
| 138 |
\fi |
| 139 |
}% |
| 140 |
} |
| 141 |
\def\oztex@include#1#2{% |
| 142 |
\dimen@1bp% |
| 143 |
\divide\Gin@req@width\dimen@ |
| 144 |
\divide\Gin@req@height\dimen@ |
| 145 |
\special{#1=#2\GPT@space |
| 146 |
\@width=\number\Gin@req@width \GPT@space |
| 147 |
\@height=\number\Gin@req@height}} |
| 148 |
\def\Ginclude@pntg{\oztex@include{pntg}} |
| 149 |
\def\Ginclude@pict{\oztex@include{pict}} |
| 150 |
\def\Grot@start{% |
| 151 |
\special{ps: gsave currentpoint |
| 152 |
currentpoint translate \Grot@angle\GPT@space neg |
| 153 |
rotate neg exch neg exch translate}} |
| 154 |
\def\Grot@end{\special{ps: currentpoint grestore moveto}} |
| 155 |
\def\Gscale@start{\special{ps: currentpoint currentpoint translate |
| 156 |
\Gscale@x\GPT@space \Gscale@y\GPT@space scale neg exch neg exch translate}} |
| 157 |
\def\Gscale@end{\special{ps: currentpoint currentpoint translate |
| 158 |
1 \Gscale@x\GPT@space div 1 \Gscale@y\GPT@space div scale |
| 159 |
neg exch neg exch translate}} |
| 160 |
\def\Gin@PS@raw#1{\special{ps: #1}} |
| 161 |
\def\Gin@PS@restored#1{\special{" #1}} |
| 162 |
\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{! #1}}} |
| 163 |
\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}} |
| 164 |
\@ifundefined{ifGin@setpagesize} |
| 165 |
{\expandafter\let\csname ifGin@setpagesize\expandafter\endcsname |
| 166 |
\csname iftrue\endcsname} |
| 167 |
{} |
| 168 |
\@ifundefined{stockwidth}{\newdimen\stockwidth}{} |
| 169 |
\@ifundefined{stockheight}{\newdimen\stockheight}{} |
| 170 |
\ifGin@setpagesize |
| 171 |
\ifx\paperwidth\@undefined\else |
| 172 |
\AtBeginDocument{% |
| 173 |
% If a package has changed \mag, assume it knows what it is doing |
| 174 |
% and leave page size alone |
| 175 |
\ifnum\mag=\@m |
| 176 |
\AtBeginDvi{% |
| 177 |
\begingroup |
| 178 |
\ifdim\stockwidth>\z@ |
| 179 |
\ifdim\stockheight>\z@ |
| 180 |
\special{papersize=\the\stockwidth,\the\stockheight}% |
| 181 |
\else |
| 182 |
\ifdim\paperwidth>\z@ |
| 183 |
\ifdim\paperheight>\z@ |
| 184 |
\special{papersize=\the\paperwidth,\the\paperheight}% |
| 185 |
\fi |
| 186 |
\fi |
| 187 |
\fi |
| 188 |
\else |
| 189 |
\ifdim\stockwidth=\z@ |
| 190 |
\ifdim\paperwidth>\z@ |
| 191 |
\ifdim\paperheight>\z@ |
| 192 |
\special{papersize=\the\paperwidth,\the\paperheight}% |
| 193 |
\fi |
| 194 |
\fi |
| 195 |
\fi |
| 196 |
\fi |
| 197 |
\endgroup}% |
| 198 |
\fi |
| 199 |
} |
| 200 |
\fi |
| 201 |
\fi |
| 202 |
\def\Gin@extensions{.eps,.ps,.eps.gz,.ps.gz,.eps.Z,.mps} |
| 203 |
\@namedef{Gin@[email protected]}#1{{eps}{.ps}{#1}} |
| 204 |
\@namedef{Gin@[email protected]}#1{{eps}{.eps}{#1}} |
| 205 |
\@namedef{Gin@[email protected]}#1{{eps}{.mps}{#1}} |
| 206 |
\@namedef{Gin@[email protected]}#1{{eps}{.bb}{#1}} |
| 207 |
\@namedef{Gin@[email protected]}#1{{eps}{.eps.bb}{#1}} |
| 208 |
\@namedef{Gin@[email protected]}#1{{eps}{.ps.bb}{#1}} |
| 209 |
\@namedef{Gin@[email protected]}#1{{eps}{.ps.bb}{#1}} |
| 210 |
\@namedef{Gin@[email protected]}#1{{eps}{.eps.bb}{#1}} |
| 211 |
\@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}} |
| 212 |
\@namedef{Gin@[email protected]}#1{{bmp}{}{#1}} |
| 213 |
\@namedef{Gin@[email protected]}#1{{bmp}{}{#1}} |
| 214 |
\@namedef{Gin@[email protected]}#1{{bmp}{}{#1}} |
| 215 |
\@namedef{Gin@[email protected]}#1{{pict}{}{#1}} |
| 216 |
\@namedef{Gin@[email protected]}#1{{pntg}{}{#1}} |
| 217 |
\endinput |