% gradient background
%% File: gradback.sty  Copyright (C) 2002 Bjoern Pedersen
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gradback}[2002/05/08 gradient background]
\RequirePackage{pst-grad}
\def\gr@dBOPhook{/bop-hook}
\def\gr@dUserDictCmd{! userdict }

%%\gr@dientbackground{firstcolor}{lastcolor}{lines}{midpoint}{angle}
\DeclareRobustCommand{\gr@dientbackground}[5]{%
\AtBeginDvi{\special{
    \gr@dUserDictCmd begin
    /gr@d-old-BOPhook { } def
    userdict \gr@dBOPhook\ known{
      /gr@d-old-BOPhook \gr@dBOPhook load def
      } if
    \gr@dBOPhook { gr@d-old-BOPhook
      gsave  clippath tx@Dict begin 
      gsave #1 grestore 
      gsave #2 grestore
      #3 #4 #5 tx@GradientDict begin GradientFill end end grestore } 
    def end
}}%
}%end newcommand
%%\rgbgradientbackground{r g b}{r g b}{lines}{midpoint}{angle}
\DeclareRobustCommand{\rgbgradientbackground}[5]{\gr@dientbackground{#1
    setrgbcolor}{#2 setrgbcolor}{#3}{#4}{#5}}
%%\hsbgradientbackground{h s b}{h s b}{lines}{midpoint}{angle}
\DeclareRobustCommand{\hsbgradientbackground}[5]{\gr@dientbackground{#1
    sethsbcolor currentrgbcolor }{#2 sethsbcolor currentrgbcolor}{#3}{#4}{#5}}
%%\cymkgradientbackground{c y m k}{c y m k}{lines}{midpoint}{angle}
\DeclareRobustCommand{\cymkgradientbackground}[5]{\gr@dientbackground{#1
    setcymkcolor currentrgbcolor }{#2 setcymkcolor currentrgbcolor}{#3}{#4}{#5}}
%% end gradient background
