Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1805 yogev_ezra 1
 
2
3
 
4
      mov ebx,[Line.x1]
5
      mov ecx,[Line.y1]
6
      mov edx,[Line.color]
7
      shl ebx,16
8
      shl ecx,16
9
      add ebx,[Line.x2]
10
      add ecx,[Line.y2]
11
      mcall
12
13
 
14
15
 
16
17
 
18
      inc al
19
      mov ebx,[Pixel.x]
20
      mov ecx,[Pixel.y]
21
      mov edx,[Pixel.color]
22
      mcall
23
24
 
25
26
 
27
28
 
29
      mov ebx,[Rectangle.x]
30
      mov ecx,[Rectangle.y]
31
      mov edx,[Rectangle.color]
32
      mov esi,ebx
33
      mov edi,ecx
34
      shl ebx,16
35
      shl ecx,16
36
      add ebx,esi
37
      add ecx,edi
38
      add ebx,[Rectangle.width]
39
      mcall
40
41
 
42
      mov ebx,[Rectangle.x]
43
      mov ecx,[Rectangle.y]
44
      mov edx,[Rectangle.color]
45
      add ecx,[Rectangle.height]
46
      mov esi,ebx
47
      mov edi,ecx
48
      shl ebx,16
49
      shl ecx,16
50
      add ebx,esi
51
      add ecx,edi
52
      add ebx,[Rectangle.width]
53
      mcall
54
55
 
56
      mov ebx,[Rectangle.x]
57
      mov ecx,[Rectangle.y]
58
      mov edx,[Rectangle.color]
59
      mov esi,ebx
60
      mov edi,ecx
61
      shl ebx,16
62
      shl ecx,16
63
      add ebx,esi
64
      add ecx,edi
65
      add ecx,[Rectangle.height]
66
      mcall
67
68
 
69
      mov ebx,[Rectangle.x]
70
      mov ecx,[Rectangle.y]
71
      mov edx,[Rectangle.color]
72
      add ebx,[Rectangle.width]
73
      mov esi,ebx
74
      mov edi,ecx
75
      shl ebx,16
76
      shl ecx,16
77
      add ebx,esi
78
      add ecx,edi
79
      add ecx,[Rectangle.height]
80
      mcall
81
82
 
83
84
 
85
;ebx- second color
86
;OUT
87
;eax - averege color
88
calculate_average_color:
89
90
 
91
      and ebx,0xffffff
92
93
 
94
      mov [b_max],bl
95
      shr eax,8
96
      shr ebx,8
97
      mov [g_min],al
98
      mov [g_max],bl
99
      shr eax,8
100
      shr ebx,8
101
      mov [r_min],al
102
      mov [r_max],bl
103
104
 
105
      xor ebx,ebx
106
      mov al,[r_max]
107
      mov bl,[r_min]
108
      add eax,ebx
109
      shr eax,1
110
      mov [r],al
111
112
 
113
      xor ebx,ebx
114
      mov al,[g_max]
115
      mov bl,[g_min]
116
      add eax,ebx
117
      shr eax,1
118
      mov [g],al
119
120
 
121
      xor ebx,ebx
122
      mov al,[b_max]
123
      mov bl,[b_min]
124
      add eax,ebx
125
      shr eax,1
126
      mov [b],al
127
128
 
129
      mov al,[r]
130
      shl eax,8
131
      mov al,[g]
132
      shl eax,8
133
      mov al,[b]
134
135
 
136
137
 
138
;ebx- sub value
139
;OUT
140
;eax - sabved color
141
calculate_sabved_color:
142
143
 
144
145
 
146
      shr eax,8
147
      mov [g],al
148
      shr eax,8
149
      mov [r],al
150
151
 
152
      sub [g],bl
153
      sub [b],bl
154
155
 
156
      mov al,[r]
157
      shl eax,8
158
      mov al,[g]
159
      shl eax,8
160
      mov al,[b]
161
162
 
163
164
 
165
166
 
167
      call GetLengthString
168
      mov esi,eax
169
170
 
171
      mov ebx,[Font.x]
172
      shl ebx,16
173
      add ebx,[Font.y]
174
      mov ecx,[Button.textcolor]
175
      mov edx,[Button.text]
176
      mcall
177
178
 
179
180
 
181
;ebx- second color
182
;ecx- x coordinat of rectangle
183
;edx- y coordinat of rectangle
184
;esi- rectangle size x
185
;edi- rectangle size y
186
187
 
188
189
 
190
      mov [line_coordinat_y],edx
191
      mov [line_size_x],esi
192
      mov [line_size_y],edi
193
194
 
195
      mov edx,dword pointer
196
      call gradient
197
198
 
199
      shl ecx,16
200
      add ecx,[line_coordinat_y]
201
      add ecx,[line_size_y]
202
203
 
204
      add [line_coordinat_x],eax
205
206
 
207
      mov edi,[line_size_x]
208
209
 
210
211
 
212
	mov ebx,[line_coordinat_x]
213
	shl ebx,16
214
	add ebx,[line_coordinat_x]
215
	mov edx,[esi]
216
	and edx,0xffffff
217
	mcall
218
219
 
220
	sub [line_coordinat_x],1
221
222
 
223
      jnz  next_vertical_line_draw_right
224
225
 
226
227
 
228
;ebx- second color
229
;ecx- x coordinat of rectangle
230
;edx- y coordinat of rectangle
231
;esi- rectangle size x
232
;edi- rectangle size y
233
234
 
235
236
 
237
      mov [line_coordinat_y],edx
238
      mov [line_size_x],esi
239
      mov [line_size_y],edi
240
241
 
242
      mov edx,dword pointer
243
      call gradient
244
245
 
246
      shl ecx,16
247
      add ecx,[line_coordinat_y]
248
      add ecx,[line_size_y]
249
250
 
251
      mov edi,[line_size_x]
252
253
 
254
255
 
256
	mov ebx,[line_coordinat_x]
257
	shl ebx,16
258
	add ebx,[line_coordinat_x]
259
	mov edx,[esi]
260
	and edx,0xffffff
261
	mcall
262
263
 
264
	add [line_coordinat_x],1
265
266
 
267
      jnz  next_vertical_line_draw_left
268
269
 
270
271
 
272
;ebx- second color
273
;ecx- x coordinat of rectangle
274
;edx- y coordinat of rectangle
275
;esi- rectangle size x
276
;edi- rectangle size y
277
278
 
279
280
 
281
      mov [line_coordinat_y],edx
282
      mov [line_size_x],esi
283
      mov [line_size_y],edi
284
285
 
286
      mov edx,dword pointer
287
      call gradient
288
289
 
290
      shl ebx,16
291
      add ebx,[line_coordinat_x]
292
      add ebx,[line_size_x]
293
294
 
295
      add [line_coordinat_y],eax
296
297
 
298
      mov edi,[line_size_y]
299
300
 
301
302
 
303
	mov ecx,[line_coordinat_y]
304
	shl ecx,16
305
	add ecx,[line_coordinat_y]
306
	mov edx,[esi]
307
	and edx,0xffffff
308
	mcall
309
310
 
311
	sub [line_coordinat_y],1
312
313
 
314
      jnz  next_horizontal_line_draw_up
315
316
 
317
318
 
319
;ebx- second color
320
;ecx- x coordinat of rectangle
321
;edx- y coordinat of rectangle
322
;esi- rectangle size x
323
;edi- rectangle size y
324
325
 
326
327
 
328
      mov [line_coordinat_y],edx
329
      mov [line_size_x],esi
330
      mov [line_size_y],edi
331
332
 
333
      mov edx,dword pointer
334
      call gradient
335
336
 
337
      shl ebx,16
338
      add ebx,[line_coordinat_x]
339
      add ebx,[line_size_x]
340
341
 
342
      mov edi,[line_size_y]
343
344
 
345
346
 
347
	mov ecx,[line_coordinat_y]
348
	shl ecx,16
349
	add ecx,[line_coordinat_y]
350
	mov edx,[esi]
351
	and edx,0xffffff
352
	mcall
353
354
 
355
	add [line_coordinat_y],1
356
357
 
358
      jnz  next_horizontal_line_draw_down
359
360
 
361
362
 
363
;ebx- second color
364
;ecx- length of line
365
;edx- pointer to memory for colors of gradient
366
367
 
368
369
 
370
371
 
372
      and eax,0xffffff
373
374
 
375
      mov [b_max],bl
376
      shr eax,8
377
      shr ebx,8
378
      mov [g_min],al
379
      mov [g_max],bl
380
      shr eax,8
381
      shr ebx,8
382
      mov [r_min],al
383
      mov [r_max],bl
384
385
 
386
      dec eax
387
      mov [v],eax
388
      fild [v]
389
390
 
391
      mov al,[r_max]
392
      sub al,[r_min]
393
      mov [v],eax
394
      fild [v]
395
      fdiv st0,st1
396
      fstp [step_r]
397
398
 
399
      mov al,[g_max]
400
      sub al,[g_min]
401
      mov [v],eax
402
      fild [v]
403
      fdiv st0,st1
404
      fstp [step_g]
405
406
 
407
      mov al,[b_max]
408
      sub al,[b_min]
409
      mov [v],eax
410
      fild [v]
411
      fdiv st0,st1
412
      fstp [step_b]
413
414
 
415
416
 
417
      mov al,[r_min]
418
      mov [r],al
419
      mov [v],eax
420
      fild [v]
421
      fstp [r_f]
422
423
 
424
      mov al,[g_min]
425
      mov [g],al
426
      mov [v],eax
427
      fild [v]
428
      fstp [g_f]
429
430
 
431
      mov al,[b_min]
432
      mov [b],al
433
      mov [v],eax
434
      fild [v]
435
      fstp [b_f]
436
437
 
438
439
 
440
	xor eax,eax
441
	mov al,[r]
442
	mov bl,al
443
	shl eax,8
444
	mov al,[g]
445
	shl eax,8
446
	mov al,[b]
447
448
 
449
	mov [edx+2],bl
450
451
 
452
	fld [r_f]
453
	fadd st0,st1
454
	fst [r_f]
455
	fistp [v]
456
	xor eax,eax
457
	mov eax,[v]
458
	mov [r],al
459
	fstp [v]
460
461
 
462
	fld [g_f]
463
	fadd st0,st1
464
	fst [g_f]
465
	fistp [v]
466
	xor eax,eax
467
	mov eax,[v]
468
	mov [g],al
469
	fstp [v]
470
471
 
472
	fld [b_f]
473
	fadd st0,st1
474
	fst [b_f]
475
	fistp [v]
476
	xor eax,eax
477
	mov eax,[v]
478
	mov [b],al
479
	fstp [v]
480
481
 
482
483
 
484
      jnz  next_gradient_color_save
485
486
 
487
488
 
489
;NON
490
;OUT
491
;variable [skin_height]
492
493
 
494
495
 
496
497
 
498
      mov ebx,4
499
      int 0x40
500
501
 
502
      popad
503
504
 
505
;eax - x
506
;ebx - y
507
;ecx - size x
508
;edx - size y
509
;esi - pointer to memory for rectangle
510
SaveFonForRectangle:
511
512
 
513
     mov [Rectangle.y],ebx
514
     mov [Rectangle.width],ecx
515
     mov [Rectangle.height],edx
516
     mov [PointerToMem],esi
517
518
 
519
     mov eax,61
520
     mov ebx,2
521
     mcall
522
     mov [BitsPerPixel],eax
523
524
 
525
     mov ebx,3
526
     mcall
527
     mov [BytesPerString],eax
528
529
 
530
 
531
     mov eax,9
532
     mov ebx,dword IPC_table
533
     or ecx,-1
534
     mcall
535
536
 
537
     mov ebx,dword[IPC_table+38]
538
     ;mov ecx,dword[IPC_table+42]
539
     ;mov edx,dword[IPC_table+46]
540
     ;mov [WindowCoordinatX],eax
541
     ;mov [WindowCoordinatY],ebx
542
     ;mov [WindowSizeX],ecx
543
     ;mov [WindowSizeY],edx
544
545
 
546
     add ebx,[Rectangle.y]
547
548
 
549
     mov esi,[Rectangle.width]
550
551
 
552
     jne no_24
553
554
 
555
     lea esi,[esi+esi*2]
556
     mov edi,3
557
     jmp exit_bits_per_pixel
558
     no_24:
559
560
 
561
     shl esi,2
562
     mov edi,4
563
     exit_bits_per_pixel:
564
565
 
566
567
 
568
     sub ebx,esi
569
     mov [offset],ebx
570
571
 
572
     mov edx,[Rectangle.height]
573
     next_string_pixels_save:
574
575
 
576
       next_pixel_save:
577
578
 
579
	 and ebx,0xffffff
580
	 mov [esi],bx
581
	 shr ebx,16
582
	 mov [esi+2],bl
583
584
 
585
	 add eax,edi
586
       dec ecx
587
       jnz next_pixel_save
588
589
 
590
     dec edx
591
     jnz next_string_pixels_save
592
593
 
594
     ret
595