Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/tex/latex/graphics/vtex.def

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


\ProvidesFile{vtex.def}[1998/05/20 v6.01 graphics/color for vtex]

\IfFileExists{bitmap.sty}
  {\usepackage{bitmap}} %% Why do the work twice?
  {}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% LaTeX Colour and Graphics support for VTeX
%%
%% [Entirely based on other drivers by] David Carlisle
%%
%% NOTE::: This package MUST NOT be used with VTeX drivers prior to
%% version 6.01. It has no chance of working and the results are
%% not predictable.
%%
%% It may be used by specifying the vtex option to any of the
%% supported packages, for example:
%%
%% \usepackage[vtex]{graphicx}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% If you downloaded the file from CTAN, make sure that the file version
%% matches the VTeX version and obtain an updated version of this file
%% from MicroPress, if needed.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%       04/20/98
%       "LaTeX run out of counters" error fixed. All "\newcount"
%       stuff is put outside the "Ginclude@eps" command body.
%       Why does L2E use global allocation of counters???
%
\makeatletter

\def\@xxx#1"#2#3{%
  \ifx\@empty#30\fi#2#3}

\def\foo#1{%
  \dimen@255sp
  \dimen@#1\dimen@
  \chardef\@tempa\dimen@
  \xdef\@tempa{\expandafter\@xxx\meaning\@tempa\@empty}}

% Colour Support. The following models may be used.
%   * cmyk   supported directly.
%   * rgb    supported directly.
%   * RGB    converted to rgb by this file.
%   * gray   converted to rgb by this file.
%   * named  converted to cmyk by this file.
%
\def\c@lor@arg#1{%
  \dimen@#1\p@
  \ifdim\dimen@<\z@\dimen@\maxdimen\fi
  \ifdim\dimen@>\p@
    \PackageError{color}{Argument `#1' not in range [0,1]}\@ehd
  \fi}
\def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1}
\def\c@lor@@cmyk#1,#2,#3,#4\@@#5{%
  \c@lor@arg{#1}\foo{#1}\let\@@a=\@tempa%
  \c@lor@arg{#2}\foo{#2}\let\@@b=\@tempa%
  \c@lor@arg{#3}\foo{#3}\let\@@c=\@tempa%
  \c@lor@arg{#4}\foo{#4}\let\@@d=\@tempa%
  \edef#5{c:\@@a\@@b\@@c\@@d}
  }
\def\color@gray#1#2{\c@lor@@rgb#2,#2,#2\@@#1}
\def\color@rgb#1#2{\c@lor@@rgb#2\@@#1}
\def\c@lor@@rgb#1,#2,#3\@@#4{%\
  \c@lor@arg{#1}\foo{#1}\let\@tempc=\@tempa%
  \c@lor@arg{#2}\foo{#2}\let\@tempb=\@tempa%
  \c@lor@arg{#3}\foo{#3}%
  \edef#4{c"\@tempc\@tempb\@tempa}%
  }
\def\color@RGB#1#2{\c@lor@@RGB#2\@@#1}
\def\c@lor@@RGB#1,#2,#3\@@#4{%
 \c@lor@RGB@rgb{#1}\@tempa
 \c@lor@RGB@rgb{#2}\@tempb
 \c@lor@RGB@rgb{#3}\@tempc
 \c@lor@@rgb\@tempa,\@tempb,\@tempc\@@#4%
  }
\def\c@lor@RGB@rgb#1#2{%
  \dimen@#1\p@
  \divide\dimen@\@cclv
  \edef#2{\strip@pt\dimen@}}

\def\color@named#1#2{\c@lor@@named#2,,\@@#1}
\def\c@lor@@named#1,#2,#3\@@#4{%
  \@ifundefined{col@#1}%
    {\PackageError{color}{Undefined color `#1'}\@ehd}%
  {\edef#4{\csname col@#1\endcsname}}%
  }

\def\pdfliteral#1{\special{!=#1}}

\def\set@color{%
  \special{\current@color}\aftergroup\reset@color}
\def\reset@color{\special{\current@color}}
\def\define@color@named#1#2{%
   \expandafter\edef\csname col@#1\endcsname{#2}}
%\def\current@color{c"FFFFFF}
\def\current@color{c"000000}

%%% PSTricks support added 05/15/98 : MK
\def\c@lor@to@ps#1#2 #3 #4\@@{%
  <<<<#1#2 255 div #3 255 div #4 255 div setrgbcolor>>>>}
\def\c@lor@to@ps#1 #2\@@{\csname c@lor@ps@#1\endcsname#2 \@@}
\def\c@lor@to@ps#1\@@{\message{OOPS![#1]}}
%% MK convert stuff like 'c"XXXXXX to PostScript Command
\def\c@lor@to@ps#1#2#3\@@{%
        (#3) (#2) 0 get 58 ne {dorgb} {docmyk} ifelse}

% Need the `colorfix' modifications as no internal colour stack
% is maintained
%<*colorfix>
\AtBeginDocument{%
  \let\@ldc@l@r\color
  \def\color{\if@inlabel\leavevmode\fi\@ldc@l@r}%
  \let\@lduseb@x\usebox
  \def\usebox#1{\@lduseb@x{#1}\set@color}}
%</colorfix>

%
% Graphic inclusion. Currently supports BMP GIF JPG TGA PCX PNG TIF EPS
%

% Same code is used for all bitmapped files.
\def\Gread@@#1{%
  \message{<#1>,\the\Gin@req@width,\the\Gin@req@height,\Gin@scalex,\Gin@scaley}%
  \sizegraph<#1>
  \def\Gin@llx{0}\let\Gin@lly\Gin@llx
  \def\Gin@urx{\the\graphx}%
  \def\Gin@ury{\the\graphy}}
\let\Gread@gif=\Gread@@
\let\Gread@png=\Gread@@
\let\Gread@bmp=\Gread@@
\let\Gread@pcx=\Gread@@
\let\Gread@tga=\Gread@@
\let\Gread@tif=\Gread@@
\let\Gread@jpg=\Gread@@

\def\Ginclude@@#1{%
 \message{<#1>,\the\Gin@req@width,\the\Gin@req@height,\Gin@scalex,\Gin@scaley}%
 \InsertBitmapXY{\Gin@req@width}{\Gin@req@height}{#1}%
 }

\let\Ginclude@gif=\Ginclude@@
\let\Ginclude@png=\Ginclude@@
\let\Ginclude@bmp=\Ginclude@@
\let\Ginclude@pcx=\Ginclude@@
\let\Ginclude@tga=\Ginclude@@
\let\Ginclude@tif=\Ginclude@@
\let\Ginclude@jpg=\Ginclude@@

\newcount\@llx
\newcount\@lly
\newcount\@urx
\newcount\@ury
\newcount\@w
\newcount\@h
\newdimen\@T
\newdimen\@T
\newcount\@clip
%
\def\Ginclude@eps#1{%
 \message{<#1>}%
  \bgroup
  \def\@tempa{!}%
  \dimen@\Gin@req@width
  \dimen@ii.1bp%
  \divide\dimen@\dimen@ii
  \@tempdima\Gin@req@height
  \divide\@tempdima\dimen@ii
    \@T=\Gin@llx pt\@llx=\@T
    \@T=\Gin@lly pt\@lly=\@T
    \@T=\Gin@urx pt\@urx=\@T
    \@T=\Gin@ury pt\@ury=\@T
    \@T=\Gin@req@width   \@w=\@T
    \@T=\Gin@req@height  \@h=\@T
    \special{ps?vpsfig.pro}%  Stupid to do it every time, but c'est la vie.
    \@clip=\ifGin@clip1\else0\fi
    \special{Psbb: 1\the\@clip\space \the\@llx\space
       \the\@lly\space \the\@urx\space \the\@ury\space
       \the\@w\space \the\@h\space }\special{ps=#1}%
       \special{ps>}
  \egroup}


\def\Ginclude@mps#1{%
   \def\@tempa{!}%
   \ifx\Gin@scaley\@tempa
     \let\Gin@scaley\Gin@scalex
   \else
    \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
   \fi
   \hbox{%
     \convertMPtoPDF{#1}{\Gin@scalex}{\Gin@scaley}%
        }%
}

\def\Gread@mps{\Gread@eps}
\def\Ginclude@pdf#1{%
   \def\@tempa{!}%
   \ifx\Gin@scaley\@tempa
     \let\Gin@scaley\Gin@scalex
   \else
    \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
   \fi
   \hbox{%
\convertPDFtoPDF{#1}{\Gin@scalex}{\Gin@scaley} {0bp} {0bp}{\Gin@req@width}{\Gin@req@height}%
        }%
}

\def\Gin@extensions{.gif,.png,.jpg,.tif,.bmp,.tga,.pcx,.eps,.ps}
\@namedef{Gin@rule@.png}#1{{png}{.png}{#1}}
\@namedef{Gin@rule@.gif}#1{{gif}{.gif}{#1}}
\@namedef{Gin@rule@.pcx}#1{{pcx}{.pcx}{#1}}
\@namedef{Gin@rule@.tif}#1{{tif}{.tif}{#1}}
\@namedef{Gin@rule@.tif}#1{{tif}{.tiff}{#1}}
\@namedef{Gin@rule@.bmp}#1{{bmp}{.bmp}{#1}}
\@namedef{Gin@rule@.tga}#1{{tga}{.tga}{#1}}
\@namedef{Gin@rule@.tga}#1{{tga}{.targa}{#1}}
\@namedef{Gin@rule@.jpg}#1{{jpg}{.jpg}{#1}}
\@namedef{Gin@rule@.jpg}#1{{jpg}{.jpeg}{#1}}
\@namedef{Gin@rule@.pdf}#1{{pdf}{.pdf}{#1}}
\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}}
\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}}
\@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}}

% Rotation

\def\Grot@start{%
 \special{r(\Grot@cos,\Grot@sin,-\Grot@sin,\Grot@cos,0,0}%
}

\def\Grot@end{
 \special{r)}%
}

\def\Gscale@start{%
 \special{r(\Gscale@x,0,0,\Gscale@y,0,0}%
}

\let\Gscale@end\Grot@end

% undo the trig.sty `optimisation' so that these 0 1 and -1 values
% get written out as digits, not unexpandable TeX primitives.
\AtBeginDocument{%
\expandafter\def\csname sin(0)\endcsname{0}%
\expandafter\def\csname cos(0)\endcsname{1}%
\expandafter\def\csname sin(90)\endcsname{1}%
\expandafter\def\csname cos(90)\endcsname{0}%
\expandafter\def\csname sin(-90)\endcsname{-1}%
\expandafter\def\csname cos(-90)\endcsname{0}%
\expandafter\def\csname sin(180)\endcsname{0}%
\expandafter\def\csname cos(180)\endcsname{-1}}

% Are we running under VTeX?
\ifx\OpMode\@undefined
   {\newcount\OpMode\OpMode=0}\fi      %Pre-6.0 VTeX.
% At the moment we do not need OpMode, but we might (again).

\endinput


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.