summaryrefslogtreecommitdiff
path: root/macros/context/contrib/context-simpleslides/tex/context/third/simpleslides/s-simpleslides-RainbowStripe.tex
blob: e982bec0a0721160425dccf84a1ff651d07b71d1 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
%D \module
%D   [      file=simpleslides-t-RainbowStripe,
%D        version=2022.07.13,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module RainbowStripe,
%D         author=Aditya Mahajan and Thomas A. Schmitz,
%D           date=\currentdate,
%D      copyright={Aditya Mahajan and Thomas A. Schmitz}]
%C
%C Copyright 2007 Aditya Mahajan and Thomas A. Schmitz
%C This file may be distributed under the GNU General Public License v. 2.0.

%D This file provides the \quotation{RainbowStripe} style for the presentation
%D module. It is loaded at runtime.

\writestatus{simpleslides}{loading RainbowStripe style}

\startmodule[simpleslides-s-RainbowStripe]

\unprotect

%D First, we provide the page layout.

\setuplayout [width=fit,
              margin=1.5cm,
              height=fit,
              header=11mm,
              footer=0cm,
              topspace=15mm,
              backspace=2cm,
              location=singlesided]

\setuplayout [simpleslides:layout:horizontal][header=11mm]
\setuplayout [simpleslides:layout:vertical]  [header=0mm]
\setuplayout [simpleslides:layout:title]     [header=0mm]


%D These macros are used for placing figures/pictures:

\define\NormalHeight            {\textheight}
\define\NormalWidth             {.476\textwidth}
\define\PictureFrameHeight      {\textheight}
\define\PictureFrameWidth       {.476\textwidth}

\setuplayer
  [simpleslides:layer:slidetitle]
    [y=12mm,
     x=20mm]

%D We define our colorscheme:

\definecolor [simpleslides:backgroundcolor]	       [s=.88]
\definecolor [simpleslides:itemize:color]              [s=0]
\definecolor [simpleslides:rainbowone]                 [r=.5,g=0,b=.5]
\definecolor [simpleslides:rainbowtwo] 	               [b=1]
\definecolor [simpleslides:rainbowthree]               [g=1,b=1]
\definecolor [simpleslides:rainbowfour]                [g=1]
\definecolor [simpleslides:rainbowfive]                [r=1,g=1]
\definecolor [simpleslides:rainbowsix]                 [r=1]

%D In a first attempt to achieve the rainbow effect, I produced the rainbow
%D background with asymptote and then converted it to a pdf file which was then
%D used as a background. In that case, it was necessary to instruct \CONTEXT\
%D to look in the default \TeX\ input paths for figures. The background spans
%D the entire height of the page and the width of the text area; the gray
%D background was then calculated so that the two stripes at the top and at the
%D bottom were left unfilled so the rainbow background would then be visible.
%D Here is the code:

%\setupexternalfigures[location={global}]

%\defineoverlay[rainb][{\externalfigure[rainbow.pdf][width=1.05\textwidth,height=1.4\textheight]}]

% \startuniqueMPgraphic{gray}
% StartPage ;
% pair zf[] ;
% path gr[] ;
% numeric a; a = 2cm ;
% numeric b; b = 0.8cm ;
% z.f1 = ulcorner Page shifted (a,0) ;
% z.f2 = urcorner Page shifted (-a,0) ;
% z.f3 = lrcorner Page shifted (-a,0) ;
% z.f4 = llcorner Page shifted (a,0) ;
% z.f5 = z.f1 shifted (0,-b) ;
% z.f6 = z.f2 shifted (0,-b) ;
% z.f7 = z.f3 shifted (0,b) ;
% z.f8 = z.f4 shifted (0,b) ;
% z.f9 = z.f5 shifted (0,-b) ;
% z.f10 = z.f6 shifted (0,-b) ;
% z.f11 = z.f7 shifted (0,b) ;
% z.f12 = z.f8 shifted (0,b) ;
% gr[1] = ulcorner Page -- urcorner Page -- lrcorner Page -- llcorner Page -- z.f8 -- z.f7 -- z.f6 -- z.f5 -- z.f4 -- llcorner Page -- cycle ;
% gr[2] = z.f9 -- z.f10 -- z.f11 -- z.f12 -- cycle ;
% gr[2] := gr[2] enlarged (.5cm,0cm) ;
% fill gr[1] withcolor \MPcolor{a} ;
% fill gr[2] withcolor \MPcolor{a} ;
% StopPage ;
% \stopuniqueMPgraphic

%D However, it seemed more portable to let Metapost calculate the background.
%D The rainbow effect takes some lines of code, but it's not too bad:

\startuniqueMPgraphic{simpleslides:MP:horizontal}
StartPage ;
pair zf[] ;
fill Page withcolor \MPcolor{simpleslides:backgroundcolor} ;
path gr[] ;
numeric a; a = 2cm ;
numeric b; b = 0.4cm ;
numeric c; c = 0.7cm ;
z.f1 = ulcorner Page shifted (a,-c) ;
z.f2 = urcorner Page shifted (-a,-c) ;
z.f3 = z.f2 shifted (0,-b) ;
z.f4 = z.f1 shifted (0,-b) ;
gr[1] = z.f1 -- z.f2 ;
gr[2] = z.f4 -- z.f3 ;
z.f5 = point .2 along gr[1] ;
z.f6 = point .2 along gr[2] ;
z.f7 = point .4 along gr[1] ;
z.f8 = point .4 along gr[2] ;
z.f9 = point .6 along gr[1] ;
z.f10 = point .6 along gr[2] ;
z.f11 = point .8 along gr[1] ;
z.f12 = point .8 along gr[2] ;
gr[3] = z.f1 -- z.f5 -- z.f6 -- z.f4 -- cycle ;
gr[4] = z.f7 -- z.f5 -- z.f6 -- z.f8 -- cycle ;
gr[4] := gr[4] enlarged (.02cm,0) ;
gr[5] = z.f9 -- z.f7 -- z.f8 -- z.f10 -- cycle ;
gr[5] := gr[5] enlarged (.02cm,0) ;
gr[6] = z.f11 -- z.f9 -- z.f10 -- z.f12 -- cycle ;
gr[6] := gr[6] enlarged (.02cm,0) ;
gr[7] = z.f11 -- z.f2 -- z.f3 -- z.f12 -- cycle ;
linear_shade(gr[3],0,\MPcolor{simpleslides:rainbowone},\MPcolor{simpleslides:rainbowtwo}) ;
linear_shade(gr[4],0,\MPcolor{simpleslides:rainbowtwo},\MPcolor{simpleslides:rainbowthree}) ;
linear_shade(gr[5],0,\MPcolor{simpleslides:rainbowthree},\MPcolor{simpleslides:rainbowfour}) ;
linear_shade(gr[6],0,\MPcolor{simpleslides:rainbowfour},\MPcolor{simpleslides:rainbowfive}) ;
linear_shade(gr[7],0,\MPcolor{simpleslides:rainbowfive},\MPcolor{simpleslides:rainbowsix}) ;
z.f21 = llcorner Page shifted (a,c) ;
z.f22 = lrcorner Page shifted (-a,c) ;
z.f23 = z.f22 shifted (0,b) ;
z.f24 = z.f21 shifted (0,b) ;
gr[21] = z.f21 -- z.f22 ;
gr[22] = z.f24 -- z.f23 ;
z.f25 = point .2 along gr[21] ;
z.f26 = point .2 along gr[22] ;
z.f27 = point .4 along gr[21] ;
z.f28 = point .4 along gr[22] ;
z.f29 = point .6 along gr[21] ;
z.f30 = point .6 along gr[22] ;
z.f31 = point .8 along gr[21] ;
z.f32 = point .8 along gr[22] ;
gr[23] = z.f21 -- z.f25 -- z.f26 -- z.f24 -- cycle ;
gr[24] = z.f27 -- z.f25 -- z.f26 -- z.f28 -- cycle ;
gr[24] := gr[24] enlarged (.02cm,0) ;
gr[25] = z.f29 -- z.f27 -- z.f28 -- z.f30 -- cycle ;
gr[25] := gr[25] enlarged (.02cm,0) ;
gr[26] = z.f31 -- z.f29 -- z.f30 -- z.f32 -- cycle ;
gr[26] := gr[26] enlarged (.02cm,0) ;
gr[27] = z.f31 -- z.f22 -- z.f23 -- z.f32 -- cycle ;
linear_shade(gr[23],0,\MPcolor{simpleslides:rainbowone},\MPcolor{simpleslides:rainbowtwo}) ;
linear_shade(gr[24],0,\MPcolor{simpleslides:rainbowtwo},\MPcolor{simpleslides:rainbowthree}) ;
linear_shade(gr[25],0,\MPcolor{simpleslides:rainbowthree},\MPcolor{simpleslides:rainbowfour}) ;
linear_shade(gr[26],0,\MPcolor{simpleslides:rainbowfour},\MPcolor{simpleslides:rainbowfive}) ;
linear_shade(gr[27],0,\MPcolor{simpleslides:rainbowfive},\MPcolor{simpleslides:rainbowsix}) ;
StopPage ;
\stopuniqueMPgraphic

\startuseMPgraphic{simpleslides:MP:ornament}
StartPage
path p[] ;
p[1] := unitsquare xyscaled(MakeupWidth,.4cm) shifted (2cm,0.7cm) ;
numeric i;
if NOfPages <= 1 :
  i = (RealPageNumber - 1) ;
else :
  i = (RealPageNumber - 1)/(NOfPages - 1) ;
fi ;
p[2] = ulcorner p[1] -- urcorner p[1] ;
p[3] = llcorner p[1] -- lrcorner p[1] ;
pair o[] ;
o[1] := point i along p[2] ;
o[2] := point i along p[3] ;
p[4] = o[1] -- o[2] ;
p[4] := p[4] enlarged (0,-1pt) ;
pickup pensquare scaled 2pt ;
draw p[4] ;
StopPage
\stopuseMPgraphic

%D We define these backgrounds as overlays:

\defineoverlay
  [simpleslides:background:horizontal]
  [\useMPgraphic{simpleslides:MP:horizontal}]

\defineoverlay
  [simpleslides:background:vertical]
  [\useMPgraphic{simpleslides:MP:horizontal}]

\defineoverlay
  [simpleslides:background:title]
  [\useMPgraphic{simpleslides:MP:horizontal}]

\defineoverlay
  [simpleslides:background:ornament]
  [\useMPgraphic{simpleslides:MP:ornament}]

%D We set up our SlideTitles:

\setupSlideTitle
   [\c!after=,
    \c!alternative=layer,
    \c!width=\textwidth,
    \c!align=\v!center,
    \c!height=1.5cm]

%D The symbol for the first level of itemizations.

\definesymbol[1][\useMPgraphic{simpleslides:itemize:square}]
\setupitemize[1][inmargin]

\protect
\stopmodule

\endinput