| 1 |
%% xycolor.tex from $Id: xycolor.doc,v 3.11 2011/03/14 20:14:00 krisrose Exp $ |
| 2 |
%% |
| 3 |
%% Xy-pic ``Colour extension'' option. |
| 4 |
%% Copyright (c) 1993-1996 Ross Moore <[email protected]> |
| 5 |
%% |
| 6 |
%% This file is part of the Xy-pic package for graphs and diagrams in TeX. |
| 7 |
%% See the companion README and INSTALL files for further information. |
| 8 |
%% Copyright (c) 1991-2011 Kristoffer H. Rose <[email protected]> |
| 9 |
%% |
| 10 |
%% The Xy-pic package is free software; you can redistribute it and/or modify |
| 11 |
%% it under the terms of the GNU General Public License as published by the |
| 12 |
%% Free Software Foundation; either version 2 of the License, or (at your |
| 13 |
%% option) any later version. |
| 14 |
%% |
| 15 |
%% The Xy-pic package is distributed in the hope that it will be useful, but |
| 16 |
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 17 |
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 |
%% for more details. |
| 19 |
%% |
| 20 |
%% You should have received a copy of the GNU General Public License along |
| 21 |
%% with this package; if not, see http://www.gnu.org/licenses/. |
| 22 |
%% |
| 23 |
\ifx\xyloaded\undefined \input xy \fi |
| 24 |
\xyprovide{color}{Colour extension}{\stripRCS$Revision: 3.11 $}% |
| 25 |
{Ross Moore}{[email protected]}% |
| 26 |
{Mathematics Department, Macquarie University, NSW~2109, Australia} |
| 27 |
\xydef@\xycolorwarning@@{\xycolormessage@ |
| 28 |
\gdef\xycolorwarning@{\xycolormessage@ |
| 29 |
\xywarning@{...no further colour warnings will be given.}% |
| 30 |
\global\let\xycolorwarning@=\relax }} |
| 31 |
\xylet@\xycolorwarning@=\xycolorwarning@@ |
| 32 |
\xydef@\xycolormessage@{% |
| 33 |
\xywarning@{Current driver does not support colour.}}% |
| 34 |
\xydef@\xyNoColor@#1{} |
| 35 |
\xylet@\xycolor@@=\xyNoColor@ |
| 36 |
\xydef@\xyNoColor@@#1#2{\xycolorwarning@} |
| 37 |
\xydef@\xycolor@{\xycolor@@} |
| 38 |
\xylet@\xylocalColor@=\xyNoColor@@ |
| 39 |
\xydef@\UnloadColor@{% |
| 40 |
\let\xylocalColor@=\xyNoColor@@ |
| 41 |
\let\xycolor@@=\xyNoColor@ |
| 42 |
\let\xycolorwarning@=\xycolorwarning@@ } |
| 43 |
\xylet@\UnloadColor@@=\UnloadColor@ |
| 44 |
\xyaddunsupport{color}{\UnloadColor@@\relax} |
| 45 |
\ifx\current@color\undefined \xydef@\xybasecolor@{}% |
| 46 |
\else \def\xybasecolor@{\current@color}\fi |
| 47 |
\xydef@\xystackcolor@{\bgroup \DN@##1##2{\egroup}% |
| 48 |
\ifInvisible@\else\ifHidden@\else\DNii@{\no@@}\ifx\nextii@\Connect@@ |
| 49 |
\else\DN@{\xystackcolor@i}\fi\fi\fi \next@ } |
| 50 |
\xydef@\xystackcolor@i#1#2{\checkXyStyle@ |
| 51 |
\DN@{#2}\ifx\next@\empty |
| 52 |
\def\tmp@##1{\DN@{\xycolor@push{#1}##1\xycolor@pop}}% |
| 53 |
\else\def\tmp@##1{\DN@{\xycolor@push{#2 #1}##1\xycolor@pop}}\fi |
| 54 |
\toks@={\egroup \let\xy@style@=\relax \def\Drop@@}% |
| 55 |
\expandafter\tmp@\expandafter{\Drop@@}% |
| 56 |
\expandafter\addtotoks@\expandafter{\expandafter{\next@}\def\Connect@@}% |
| 57 |
\expandafter\tmp@\expandafter{\Connect@@}% |
| 58 |
\expandafter\addtotoks@\expandafter{\expandafter{\next@}}% |
| 59 |
\the\toks@ }% |
| 60 |
\xydef@\xycolor@push@@#1{\special{color push #1}} |
| 61 |
\xydef@\xycolor@pop{\special{color pop}} |
| 62 |
\xylet@\xycolor@push=\xycolor@push@@ |
| 63 |
\xydef@\newxycolor#1#2{\newxyColor{#1}{}{}{#2}{}} |
| 64 |
\xydef@\newxyColor#1#2#3#4{\newxycolor@{#1}{#2}{#3}{#4}{}} |
| 65 |
\xydef@\newxycolor@#1#2#3#4#5{% |
| 66 |
\expandafter\let\expandafter\next@\csname shape [#1]\endcsname |
| 67 |
\ifx\next@\relax |
| 68 |
\DN@{#4}\ifx\next@\empty |
| 69 |
\DN@{#2}\ifx\next@\empty |
| 70 |
\DN@{\newxystyle{#1}{\xylocalColor@{}{#3}\xycolor@{#3}}}% |
| 71 |
\else |
| 72 |
\DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#2 #3}}}% |
| 73 |
\fi |
| 74 |
\else\DN@{#2#3}\ifx\next@\empty |
| 75 |
\DN@{\newxystyle{#1}{\xylocalColor@{#4}{}\xycolor@{#4}}}% |
| 76 |
\else |
| 77 |
\DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#4}}}% |
| 78 |
\fi \fi |
| 79 |
\else \def\tmp@{\relax}\DNii@{#5}% |
| 80 |
\ifx\nextii@\tmp@ |
| 81 |
\DN@{#4}\ifx\next@\empty |
| 82 |
\DN@{#2}\ifx\next@\empty |
| 83 |
\DN@{\newxystyle{#1}{\xylocalColor@{}{#3}\xycolor@{#3}}}% |
| 84 |
\else |
| 85 |
\DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#2 #3}}}% |
| 86 |
\fi |
| 87 |
\else |
| 88 |
\DN@{#2#3}\ifx\next@\empty |
| 89 |
\DN@{\newxystyle{#1}{\xylocalColor@{#4}{}\xycolor@{#4}}}% |
| 90 |
\else |
| 91 |
\DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#4}}}% |
| 92 |
\fi \fi |
| 93 |
\else\DN@{}\fi\fi \next@\relax} |
| 94 |
\xydef@\xystandardcolors@{% |
| 95 |
\newxycolor@{black}{0. 0. 0.}{rgb}{}\relax |
| 96 |
\newxycolor@{white}{1. 1. 1.}{rgb}{}\relax |
| 97 |
\newxycolor@{gray}{.5}{gray}{}\relax |
| 98 |
\newxycolor@{grey}{.5}{gray}{}\relax |
| 99 |
\newxycolor@{red}{1. 0. 0.}{rgb}{}\relax |
| 100 |
\newxycolor@{green}{0. 1. 0.}{rgb}{}\relax |
| 101 |
\newxycolor@{blue}{0. 0. 1.}{rgb}{}\relax |
| 102 |
\newxycolor@{cyan}{0. 1. 1.}{rgb}{}\relax |
| 103 |
\newxycolor@{magenta}{1. 0. 1.}{rgb}{}\relax |
| 104 |
\newxycolor@{yellow}{1. 1. 0.}{rgb}{}\relax |
| 105 |
\xyuncatcodes } |
| 106 |
\xydef@\UseCrayolaColors{\xyrequire{crayon}\xyuncatcodes}% |
| 107 |
\xydef@\xyBEcolorcheck@{\ifx\xycolor@@\xyNoColor@\else |
| 108 |
\xywarning@{PostScript colour support should be OK.}\fi }% |
| 109 |
\xywithoption{ps}{% |
| 110 |
\xyinputorelse@{xyps-c}{\xyerror@{Could not load xyps-c}{}}}% |
| 111 |
\xycatcodes |
| 112 |
\xyendinput |