eh, make ’em volatile, this is not time-critical code anyway
[alioth/magicpoint.git] / sample / gradation.mgp
1 %include "default.mgp"
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %page
4 %nodefault
5 %size 7, font "standard", fore "white", vgap 20, back "black"
6 %bquality 10
7
8 %center
9
10
11 How to use
12 background gradation
13 (tentative)
14
15
16 %size 4
17 Yojiro UO
18 yuo@Nui.org
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20 %page
21 %bgrad
22
23 Usage
24
25         Specify the "bgrad" keyword for background gradation
26
27         By default
28                 entire screen
29                 from up to down
30                 from blue to black
31
32         Without arguments, displayed with these default values.
33
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %page
36 %bgrad 0 0 128 90 1 "black" "blue"
37
38 Principles of drawing gradation background
39
40 Gradation drawing is 2-phase process:
41                 generate raw material of gradaton image
42                 superimpose to screen image
43
44 The first five arguments to "bgrad" can be separate as follows:
45                 Args. for image generation
46                 Args. for superimpose method
47
48 Following the above, the list of color name (to be used for gradation) \
49 may be specified.
50
51
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 %page
54 %bgrad 50 50
55
56 Args. for image generation
57
58 Args. to specify the size of genarated images
59         1st arg:
60                 Relative size against X axis (percentage)
61
62         2nd arg:
63                 Relative size against Y axis (percentage)
64
65 Args. to specify the property of genarated images
66         3rd arg:
67                 # of colors
68
69         4th arg:
70                 Rotation Angle
71
72
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 %page
75 %bgrad 50 50
76
77 Args. for superimpose method
78
79 Args. to specify how image should be enlarged to fit to the screen.
80
81         5th arg:
82                 Zooming flag:
83                         0: Tiling
84                         1: Zoom
85
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 %page
88 %bgrad
89
90 Syntax of bgrad (conclusion)
91
92         1st arg: Relative size against X direction
93                 Range: 1 to 100 (0 means 100%)/default: 100%
94         2nd arg: Relative size against Y direction
95                 Range: 1 to 100 (0 means 100%)/default: 100%
96         3rd arg: # of colors
97                 default: 128 colors
98         4th arg: Rotation Angle
99                 Range: -360 to 360/default: 0
100         5th arg: Zooming flag
101                 1:Zoom, 0:Repeat to the edges of screen
102                 Default: 1
103         Rests are colors
104                 Defualt: blue,black
105
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 %page
108 %bgrad
109
110 Background gallary (Basic technics)
111
112 Here are basic examples:
113
114         Vertical Stripes
115         Horizontal Stripes(1)
116         Horizontal Stripes(2)
117         Rotating with a specific angle
118         Zooming & Vertical Stripes
119         Auto adjustment
120
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 %page
123 %bgrad 0 0 128 90 1 "black" "red" "black" "red" "black" "red" "black"
124
125 Vertical Stripes
126
127 %size 4
128 bgrad 0 0 128 90 1 "black" "red" "black" "red" "black" "red" "black"
129
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 %page
132 %bgrad 0 0 128 0 1 "black" "red" "black"
133
134 Horizontal Stripes(1)
135
136 %size 4
137 bgrad 0 0 128 0 1 "black" "red" "black"
138
139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140 %page
141 %bgrad 0 0 128 0 1 "blue2" "black" "black" "black" "blue4" "blue3" "blue4"
142
143 Horizontal Stripes(2)
144
145 %size 4
146 bgrad 0 0 128 0 1 "blue2" "black" "black" "black" "blue4" "blue3" "blue4"
147
148
149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150 %page
151 %bgrad 25 25 128 45 1 "black" "red2" "black"
152
153 Rotating with a specific angle
154
155 %size 4
156 bgrad 25 25 128 45 1 "black" "red2" "black"
157
158         Rotation takes some time
159
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %page
162 %bgrad 100 100 128 90 1 "black" "red" "black"
163
164 Zooming & Vertical Stripes
165
166 %size 4
167 bgrad 100 100 128 90 0 "black" "red" "black"
168
169
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 %page
172 %bgrad 0 0 128 0 1 "blue" "cyan" "black" "black" "black" "black" "black" "green" "black"
173
174 Auto adjustment
175
176 %size 3
177 bgrad 0 0 128 0 1 "blue" "cyan" "black" "black" "black" "black" "black" "green" "black"
178
179         Auto adjust with size (0,0)
180         zoomflag is necessary
181         blue/cyan/black ... black/green/black
182
183
184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185 %page
186 %bgrad
187
188 Background gallary (Advanced technics)
189
190 Let's see some uses of advanced technics:
191
192         Colorful
193         Traditional Japanese
194         Effects by zooming a small pattern
195         Filling with small patterns(1)
196         Filling with small patterns(2)
197         Tricky(1)
198         Tricky(2)
199         Circle gradation(1)
200         Circle gradation(2)
201         Circle gradation(3)
202
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204 %page
205 %fore "white"
206 %bgrad 0 0 128 180 1 "black" "white" "black" "red" "orange" "green3" "black" "blue"
207
208 Colorful
209
210
211 %size 3
212 bgrad 0 0 128 180 1 "black" "white" "black" "red" "orange" "green3" "black" "blue"
213
214         You can do this!
215         Since rotated by 180, color lists are turned over.
216
217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218 %page
219 %bgrad 10 0 128 90 0 "black" "orange" "black" "black" "black" "black" "black" "green" "black"
220
221 Traditional Japanese
222
223 %size 3
224 bgrad 10 0 128 90 0 "black" "orange" "black" "black" "black" "black" "black" "green" "black"
225
226         Rotate the pattern of 10%x100% by 90 then repeat
227         black/orange/black ... black/green/black
228
229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
230 %page
231 %bgrad 10 10 128 0 1 "black" "blue" "red" "black" "black" "black" "black" "black" "green" "black"
232
233 Effects by zooming a small pattern
234
235 %size 3
236 bgrad 10 10 128 0 1 "black" "blue" "red" "black" "black" "black" "black" "black" "green" "black"
237
238         Zoom the pattern of 10%x10%
239         black/blue/red/black ... black/green/black
240
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242 %page
243 %bgrad 10 10 128 45 1 "black" "orange" "black" "black" "black" "black" "black" "green" "black"
244
245 Filling with small patterns(1)
246
247 %size 3
248 bgrad 10 10 128 45 1 "black" "orange" "black" "black" "black" "black" "black" "green" "black"
249
250         Rotate the pattern of 10%x10% by 45 then repeat then zoom
251         black/orange/black ... black/green/black
252
253
254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255 %page
256 %bgrad 5 5 128 60 1 "black" "orange" "black" "black" "black" "black" "black" "green" "black"
257
258 Filling with small patterns(2)
259
260 %size 3
261 bgrad 5 5 128 60 1 "black" "orange" "black" "black" "black" "black" "black" "green" "black"
262
263         Rotate the pattern of 5%x5% by 60 then repeat then zoom
264         black/orange/black ... black/green/black
265
266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267 %page
268 %bgrad 25 25 128 45 1 "blue" "blue2" "black" "black" "black" "black" "blue"
269
270 Tricky(1)
271
272 %size 3
273 bgrad 25 25 128 45 1 "blue" "blue2" "black" "black" "black" "black" "blue"
274
275         Rotate the pattern of 25%x25% by 45 then repeat then zoom
276
277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278 %page
279 %bgrad 12 0 128 45 0 "blue" "blue2" "black" "black" "black" "black" "blue"
280
281 Tricky(2)
282
283 %size 3
284 bgrad 12 0 128 45 0 "blue" "blue2" "black" "black" "black" "black" "blue"
285
286         Rotate the pattern of 12%x100% by 45 then repeat
287
288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289 %page
290 %bgrad 25 25 128 -45 1 "black" "red" "black"
291
292 Circle gradation(1)
293
294 %size 4
295 bgrad 25 25 128 -45 1 "black" "red" "black"
296
297         The "easter egg" feature
298         If angle is minus, it becomes non-liner.
299
300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
301 %page
302 %bgrad 25 25 128 -45 1 "red2" "black" "red2"
303
304 Circle gradation(2)
305
306 %size 4
307 bgrad 25 25 128 -45 1 "red2" "black" "red2"
308
309         The reverse
310         List colors symmetrically
311
312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
313 %page
314 %bgrad 25 25 128 -45 0 "blue" "blue2" "black" "black" "black" "black" "blue"
315
316 Circle gradation(3)
317
318 %size 3
319 bgrad 25 25 128 -45 1 "blue" "blue2" "black" "black" "black" "black" "blue"
320
321         Rotate the pattern of 25%x25% by 45,
322         zoom then repeat
323
324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325 %page
326 %bgrad 25 25 128 -45 1 "white" "blue" "black" "black" "orange" "black" "black" "orange" "black" "black" "blue" "white"
327
328 Fin