summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/gradback/gradback.sty
blob: ca307a51732caad79dd33e0c341008d48589219d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
% 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