summaryrefslogtreecommitdiff
path: root/themes/openSUSE/src/bsplash.inc
blob: d43b258594b6da21fe40c7aeaad4fb312f1e695d (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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%
% Boot loader splash code.
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Some global vars.

/.b1_init	 0 def
/.b1_done	 1 def
/.b1_run	 2 def
/.b1_start	 3 def
/.b1_end	 4 def
/.b1_x		 5 def
/.b1_y		 6 def
/.b1_x0	 	 7 def
/.b1_dx		 8 def
/.b1_pic_name	 9 def
/.b1_mask_name	10 def
/.b1_count	11 def
/.b1_pic	12 def
/.b1_mask	13 def
/.b1_back	14 def
/.b1_w		15 def
/.b1_h		16 def
/.b1_tmp1	17 def
/.b1_tmp2	18 def

/.b2_init	 0 def
/.b2_done	 1 def
/.b2_run	 2 def
/.b2_start	 3 def
/.b2_end	 4 def
/.b2_x		 5 def
/.b2_y		 6 def
/.b2_x0	 	 7 def
/.b2_dx		 8 def
/.b2_pic_name	 9 def
/.b2_grad_name	10 def
/.b2_count	11 def
/.b2_pic	12 def
/.b2_grad	13 def
/.b2_back	14 def
/.b2_w		15 def
/.b2_h		16 def
/.b2_tmp1	17 def
/.b2_tmp2	18 def

/bsplash.list [
  % [ /b1.init /b1.done /b1.run  0 10   0   0    0  10 "cd.jpg" "cd_a.jpg" 8 { .undef } repeat ]

  [ /b2.init /b2.done /b2.run  0 16 540 260    0  25 "w1.jpg" "grad1.jpg" 8 { .undef } repeat ]
  [ /b2.init /b2.done /b2.run  2 18 540 310    0  25 "w2.jpg" "grad1.jpg" 8 { .undef } repeat ]
  [ /b2.init /b2.done /b2.run  4 20 540 360    0  25 "w3.jpg" "grad1.jpg" 8 { .undef } repeat ]
  [ /b2.init /b2.done /b2.run  6 22 540 410    0  25 "w4.jpg" "grad1.jpg" 8 { .undef } repeat ]
  [ /b2.init /b2.done /b2.run 10 50 540 460  400 -10 "w5.jpg" "grad2.jpg" 8 { .undef } repeat ]
  [ /b2.init /b2.done /b2.run  8 24 540 510    0  25 "w6.jpg" "grad1.jpg" 8 { .undef } repeat ]
] def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Init splash.
%
% ( ) ==> ( )
%
/bsplash.init {
  bsplash.list { dup .b2_init get exec } forall
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Free splash memory.
%
% ( ) ==> ( )
%
/bsplash.free {
  bsplash.list { dup .b2_done get exec } forall
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Show boot loader splash.
%
% ( ) ==> ( )
%
/bsplash.show {
  currentimage

  "welcome.jpg" findfile /splash.file over def setimage

  0 0 moveto 0 0 image.size image

  bsplash.init

  bsplash.skip not { 100000 usleep } if

  bsplash.skip not {
    {
      0 usleep
      bsplash.skip { exit } if
      bsplash.run { exit } if
    } loop
  } if

  bsplash.free

  setimage

  splash.file free /splash.file .undef def

} def


% Run splash animations. Return 'true' when done.
%
% ( ) ==> ( true|false )
%
/bsplash.run {
  true

  bsplash.list { dup .b2_run get exec and } forall
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Just wait.
%
% ( ) ==> ( )
%
/bsplash.done {
  bsplash.skip not {
    1500000 usleep
  } if
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Check if we should skip the intro.
%
% ( ) ==> ( true|false )
%
/bsplash.skip {
  % any key pressed?
  getkey 0xffff and {
    /bsplash.skip true def
    true
  } {
    false
  } ifelse
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Init array.
%
% ( array ) ==> ( )
%
/b1.init {
  dup .b1_count -1 put
  dup .b1_pic_name get readimage over .b1_pic rot put
  dup .b1_mask_name get readimage over .b1_mask rot put

  dup .b1_pic get .undef eq
  over .b1_mask get .undef eq or {
    .b1_count .undef put
    return
  } if

  dup .b1_pic get imgsize
  2 index .b1_h rot put over .b1_w rot put

  dup .b1_x get over .b1_y get moveto

  dup .b1_w get over .b1_h get savescreen over .b1_back rot put

  % just a buffer
  dup .b1_w get over .b1_h get savescreen over .b1_tmp1 rot put
  dup .b1_w get over .b1_h get savescreen over .b1_tmp2 rot put

  pop
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Cleanup.
%
% ( array ) ==> ( )
%
/b1.done {
  dup .b1_pic get free
  dup .b1_mask get free
  dup .b1_back get free
  dup .b1_tmp1 get free
  dup .b1_tmp2 get free

  pop
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Run animation.
%
% Return true when finished.
%
% ( array ) ==> ( true|false )
%
/b1.run {
  dup .b1_count get .undef eq { pop true return } if

  dup .b1_count get 1 add over .b1_count rot put

  dup .b1_count get over .b1_start get lt { pop false return } if

  % count runs from  .b1_start ... .b1_end inclusive

  dup .b1_tmp2 get over .b1_back get over length memcpy

  0 0 moveto
  dup .b1_mask get 0 2 index .b1_tmp1 get blend
  dup .b1_mask get over .b1_count get 255 mul 2 index .b1_end get div 2 index .b1_tmp1 get blend

  dup .b1_pic get over .b1_tmp1 get 2 index .b1_tmp2 get blend

  
  dup .b1_x get over .b1_y get moveto
  dup .b1_tmp2 get restorescreen




  dup .b1_count get over .b1_end get eq { dup .b1_count .undef put } if

  pop

  false

  dtrace

} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Init array.
%
% ( array ) ==> ( )
%
/b2.init {
  dup .b2_count -1 put
  dup .b2_pic_name get readimage over .b2_pic rot put
  dup .b2_grad_name get readimage over .b2_grad rot put

  dup .b2_pic get .undef eq
  over .b2_grad get .undef eq or {
    .b2_count .undef put
    return
  } if

  dup .b2_pic get imgsize
  2 index .b2_h rot put over .b2_w rot put

  dup .b2_x get over .b2_y get moveto

  dup .b2_w get over .b2_h get savescreen over .b2_back rot put

  % just a buffer
  dup .b2_w get over .b2_h get savescreen over .b2_tmp1 rot put
  dup .b2_w get over .b2_h get savescreen over .b2_tmp2 rot put

  pop
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Cleanup.
%
% ( array ) ==> ( )
%
/b2.done {
  dup .b2_pic get free
  dup .b2_grad get free
  dup .b2_back get free
  dup .b2_tmp1 get free
  dup .b2_tmp2 get free

  pop
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Run animation.
%
% Return true when finished.
%
% ( array ) ==> ( true|false )
%
/b2.run {
  dup .b2_count get .undef eq { pop true return } if

  dup .b2_count get 1 add over .b2_count rot put

  dup .b2_count get over .b2_start get lt { pop false return } if

  % count runs from  .b2_start ... .b2_end inclusive

  dup .b2_count get over .b2_start get sub over .b2_dx get mul over .b2_x0 get add 0 moveto
  dup .b2_grad get 0xff 2 index .b2_tmp1 get blend

  dup .b2_tmp2 get over .b2_back get over length memcpy

  0 0 moveto
  white over .b2_pic get 2 index .b2_tmp2 get blend

  0 0 moveto
  dup .b2_back get over .b2_tmp1 get 2 index .b2_tmp2 get blend

  dup .b2_x get over .b2_y get moveto
  dup .b2_tmp2 get restorescreen

  dup .b2_count get over .b2_end get eq { dup .b2_count .undef put } if

  pop

  false

} def