Subversion Repositories Kolibri OS

Rev

Rev 255 | Rev 6352 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
255 heavyiron 1
;-----------------------------------------------------------
2
;-----instruments of panel(icon's instruments)--------------
3
;-----------------------------------------------------------
4
TakeButtonInstruments:
5
 
6
	mov eax,[Current_instrument]
7
 
8
	;*************************brush 1***********************
9
	cmp eax,40
10
	jne no_brush1
11
 
12
	mov [Brush_SizeX],4
13
	mov [Brush_SizeY],4
14
	mov [Number_Brush],0
15
	mov ebx,[Last_instrument]
16
	mov [Current_instrument],ebx
17
 
18
	mov [line_width],1
19
 
20
	jmp still
21
	no_brush1:
22
 
23
	;*************************brush 2***********************
24
	cmp eax,41
25
	jne no_brush2
26
 
27
	mov [Brush_SizeX],6
28
	mov [Brush_SizeY],4
29
	mov [Number_Brush],1
30
	mov ebx,[Last_instrument]
31
	mov [Current_instrument],ebx
32
 
33
	mov [line_width],2
34
 
35
	jmp still
36
	no_brush2:
37
 
38
	;*************************brush 3***********************
39
	cmp eax,42
40
	jne no_brush3
41
 
42
	mov [Brush_SizeX],8
43
	mov [Brush_SizeY],7
44
	mov [Number_Brush],2
45
	mov ebx,[Last_instrument]
46
	mov [Current_instrument],ebx
47
 
48
	mov [line_width],3
49
 
50
	jmp still
51
	no_brush3:
52
 
53
	;************************brush 4************************
54
	cmp eax,43
55
	jne no_brush4
56
 
57
	mov [Brush_SizeX],14
58
	mov [Brush_SizeY],14
59
	mov [Number_Brush],3
60
	mov ebx,[Last_instrument]
61
	mov [Current_instrument],ebx
62
 
63
	mov [line_width],4
64
 
65
	jmp still
66
	no_brush4:
67
 
68
	;************************brush 5************************
69
	cmp eax,44
70
	jne no_brush5
71
 
72
	mov [Brush_SizeX],6
73
	mov [Brush_SizeY],6
74
	mov [Number_Brush],4
75
	mov ebx,[Last_instrument]
76
	mov [Current_instrument],ebx
77
 
78
	mov [line_width],5
79
 
80
	jmp still
81
	no_brush5:
82
 
83
	;*************************pensil************************
84
	cmp eax,10
85
	jne no_pensil
86
 
87
	mov al,[exit_from_work_arrea]
88
 
89
	test al,al
90
	jz no_exit_from_work_arrea
91
 
92
	and [Activate_instrument],0
93
	and [exit_from_work_arrea],0
94
 
95
	no_exit_from_work_arrea:
96
 
97
	mov al,[Activate_instrument]
98
 
99
	test al,al
100
	jnz no_activated_later
101
 
102
	call GetScreenCordinats
103
	mov eax,[ScreenX]
104
	mov ebx,[ScreenY]
105
	add eax,[PosX]
106
	add ebx,[PosY]
107
	mov [OldX],eax
108
	mov [OldY],ebx
109
 
110
	no_activated_later:
111
 
112
	mov eax,[MaxWorkScreen_SizeX]
113
	mov ebx,[MaxWorkScreen_SizeY]
114
 
115
	mov eax,[PointerToPicture]
116
	mov ebx,[ReserveArray]
117
	mov ecx,[Picture_SizeX]
118
	mov edx,[OldX]
119
	shl edx,16
120
	add edx,[OldY]
121
	mov esi,[ScreenX]
122
	mov edi,[ScreenY]
123
	add esi,[PosX]
124
	add edi,[PosY]
125
	call calculate_line
126
 
127
	mov ecx,eax
128
	mov edx,[Color]
129
	mov esi,[Color]
130
	shr edx,16
131
	xor ebx,ebx
132
	mov eax,[ReserveArray]
133
 
134
	pensil_next_pixel_draw:
135
 
136
	  mov ebx,[eax]
137
	  mov [ebx],si
138
	  mov [ebx+2],dl
139
	  add eax,4
140
 
141
	dec ecx
142
	jnz pensil_next_pixel_draw
143
 
144
	mov eax,[ScreenX]
145
	mov ebx,[ScreenY]
146
	add eax,[PosX]
147
	add ebx,[PosY]
148
	mov [OldX],eax
149
	mov [OldY],ebx
150
 
151
	call MovePictureToWorkScreen
152
	mov [Activate_instrument],1
153
	jmp still
154
	no_pensil:
155
 
156
	;**********************pipetka**************************
157
	cmp eax,15
158
	jne no_pipetka
159
 
160
	mov eax,[ScreenY]
161
	mov ebx,[Picture_SizeX]
162
	add eax,[PosY]
163
	imul eax,ebx
164
	add eax,[ScreenX]
165
	add eax,[PosX]
166
	lea eax,[eax+eax*2]
167
	add eax,[PointerToPicture]
168
	mov ebx,[eax]
169
	and ebx,0xffffff
170
	mov [Color],ebx
171
 
172
	mov eax,13
173
	mov ebx,136*65536+20
174
	mov ecx,65*65536+21
175
	mov edx,[Color]
485 heavyiron 176
	mcall
255 heavyiron 177
 
178
	jmp still
179
	no_pipetka:
180
 
181
	;**********************draw brush***********************
182
	cmp eax,11
183
	jne no_brush
184
 
185
	mov [Last_instrument],eax
186
 
187
	jmp no_lastik_
188
 
189
	lastik_in:
190
	mov eax,[Color]
191
	mov [SColor],eax
192
	mov [Color],0xffffff
193
	no_lastik_:
194
 
195
	mov eax,[ScreenX]
196
	mov ebx,[ScreenY]
197
	mov ecx,[Brush_SizeX]
198
	mov edx,[Brush_SizeY]
199
	add eax,[PosX]
200
	add ebx,[PosY]
201
	add eax,ecx
202
	add ebx,edx
203
 
204
	cmp eax,[Picture_SizeX]
205
	jl no_max_pos_x
206
	mov eax,[Picture_SizeX]
207
	no_max_pos_x:
208
 
209
	cmp ebx,[Picture_SizeY]
210
	jl no_max_pos_y
211
	mov ebx,[Picture_SizeY]
212
	no_max_pos_y:
213
 
214
	cmp eax,ecx
215
	ja no_min_pos_x
216
	mov eax,[Brush_SizeX]
217
	no_min_pos_x:
218
 
219
	cmp ebx,edx
220
	ja no_min_pos_y
221
	mov ebx,[Brush_SizeY]
222
	no_min_pos_y:
223
 
224
	sub eax,[Brush_SizeX]
225
	sub ebx,[Brush_SizeY]
226
 
227
	mov [x],eax
228
	mov [y],ebx
229
 
230
	mov al,[exit_from_work_arrea]
231
	test al,al
232
	jz no_exit_from_work_arrea_brush
233
	and [Activate_instrument],0
234
	and [exit_from_work_arrea],0
235
	no_exit_from_work_arrea_brush:
236
 
237
	mov al,[Activate_instrument]
238
	test al,al
239
	jnz no_new_brush_xy
240
	mov eax,[x]
241
	mov ebx,[y]
242
	mov [OldX],eax
243
	mov [OldY],ebx
244
	mov [Activate_instrument],1
245
	no_new_brush_xy:
246
 
247
	mov eax,[PointerToPicture]
248
	mov ebx,[ReserveArray]
249
	add ebx,4
250
	mov ecx,[Picture_SizeX]
251
	mov edx,[OldX]
252
	shl edx,16
253
	add edx,[OldY]
254
	mov esi,[x]
255
	mov edi,[y]
256
 
257
	call calculate_line
258
 
259
	mov ebx,[ReserveArray]
260
	mov [ebx],eax
261
 
262
	;procedure drawing of brush
263
	mov ebx,[ReserveArray]
264
	mov ecx,[ebx]
265
	mov edx,[Color]
266
	mov esi,[Color]
267
	shr edx,16
268
	add ebx,4
269
	mov edi,[Number_Brush]
270
	imul edi,20*20
271
 
272
	next_pixel_put_brush:
273
 
274
	mov eax,[ebx]
275
	push eax
276
	push ecx
277
	xor ebp,ebp
278
	and [counter2],0
279
 
280
	vertical_width_brush:
281
	   and [counter],0
282
 
283
	   horizontal_width_brush:
284
	   xor ecx,ecx
285
	   mov cl,byte[Brush_color+edi+ebp]
286
	   test cl,cl
287
	     jz no_draw_pixel_brush
288
	      mov [eax],si
289
	      mov [eax+2],dl
290
	     no_draw_pixel_brush:
291
	   add eax,3
292
	   inc ebp
293
	   inc [counter]
294
	   cmp [counter],20
295
	   jne horizontal_width_brush
296
 
297
	   mov ecx,[Picture_SizeX]
298
	   sub ecx,20
299
	   lea ecx,[ecx+ecx*2]
300
	   add eax,ecx
301
	inc [counter2]
302
	cmp [counter2],20
303
	jne vertical_width_brush
304
 
305
	pop ecx
306
	pop eax
307
	add ebx,4
308
	dec ecx
309
	jnz next_pixel_put_brush
310
 
311
	mov eax,[x]
312
	mov ebx,[y]
313
	mov [OldX],eax
314
	mov [OldY],ebx
315
 
316
	mov al,[lastik_is_active]
317
	test al,al
318
	jz no_lastik_active
319
 
320
	mov eax,[SColor]
321
	mov [Color],eax
322
	and [lastik_is_active],0
323
	no_lastik_active:
324
 
325
	call MovePictureToWorkScreen
326
	mov eax,[Current_instrument]
327
	mov [Last_instrument],eax
328
 
329
	jmp still
330
	no_brush:
331
 
332
	;************************Flood Fill*******************
333
	cmp eax,14
334
	jne no_FloodFill
335
 
336
	mov eax,[PointerToPicture]
337
	mov ebx,[PointerToEditBufer]
338
 
339
	mov ecx,[Picture_SizeX]
340
	imul ecx,[Picture_SizeY]
341
	lea ecx,[ecx+ecx*2]
342
	shl ecx,1
343
 
344
	cmp ecx,500000
345
	ja normal_size_of_bufer
346
 
347
	mov ebx,[ReserveArray]
348
 
349
	normal_size_of_bufer:
350
 
351
	add ebx,4
352
	mov ecx,[Picture_SizeX]
353
	mov edx,[ScreenX]
354
	add edx,[PosX]
355
	shl edx,16
356
	add edx,[ScreenY]
357
	add edx,[PosY]
358
	mov esi,[Picture_SizeX]
359
	dec esi
360
	shl esi,16
361
	add esi,[Picture_SizeY]
362
	dec esi
363
	mov edi,[Color]
364
 
365
	call flood_fill
366
	call MovePictureToWorkScreen
367
 
368
	jmp still
369
	no_FloodFill:
370
 
371
	;************************lastik*************************
372
	cmp eax,13
373
	jne no_lastik
374
 
375
	 mov [Last_instrument],eax
376
	 mov [lastik_is_active],1
377
	jmp lastik_in
378
 
379
	no_lastik:
380
 
381
	;******************************************************
382
	cmp eax,12
383
	jne  no_spray
384
 
385
	cmp [Activate_instrument],0
386
	jne no_null_spray
387
	mov [Activate_instrument],1
388
	jmp still
389
	no_null_spray:
390
 
391
	mov eax,[ScreenX]
392
	mov ebx,[ScreenY]
393
	mov ecx,[Brush_SizeX]
394
	mov edx,[Brush_SizeY]
395
	add eax,[PosX]
396
	add ebx,[PosY]
397
	add eax,ecx
398
	add ebx,edx
399
 
400
	cmp eax,[Picture_SizeX]
401
	jl no_max_pos_x_spray
402
	mov eax,[Picture_SizeX]
403
	no_max_pos_x_spray:
404
 
405
	cmp ebx,[Picture_SizeY]
406
	jl no_max_pos_y_spray
407
	mov ebx,[Picture_SizeY]
408
	no_max_pos_y_spray:
409
 
410
	cmp eax,ecx
411
	ja no_min_pos_x_spray
412
	mov eax,[Brush_SizeX]
413
	no_min_pos_x_spray:
414
 
415
	cmp ebx,edx
416
	ja no_min_pos_y_spray
417
	mov ebx,[Brush_SizeY]
418
	no_min_pos_y_spray:
419
 
420
	sub eax,[Brush_SizeX]
421
	sub ebx,[Brush_SizeY]
422
	mov edi,0;[Number_Brush]
423
	imul edi,20*20
424
 
425
	mov [x],eax
426
	mov [y],ebx
427
	mov ebp,[Picture_SizeX]
428
	xor edx,edx
429
	brush_y_spray:
430
	  xor ecx,ecx
431
	  brush_x_spray:
432
	   ;calculate position in array of spray
433
	   mov esi,edx
434
	   lea esi,[esi+esi*4] ;esi=esi*5
435
	   shl esi,2	       ;esi=(esi*3)*4
436
	   add esi,ecx
437
	   add esi,edi
438
	   ;read byte from array
439
	   xor eax,eax
440
	   mov al,[Spray_color+esi]
441
	   test eax,eax
442
	   jz no_color_spray
443
	   mov eax,[x]
444
	   mov ebx,[y]
445
	   add eax,ecx
446
	   add ebx,edx
447
	   imul ebx,ebp; ebp=[Picture_SizeX]
448
	   add eax,ebx
449
	   lea eax,[eax+eax*2]
450
	   add eax,[PointerToPicture]
451
	   mov ebx,[Color]
452
	   mov [eax],bx
453
	   shr ebx,16
454
	   mov [eax+2],bl
455
	   no_color_spray:
456
	   inc ecx
457
	   cmp ecx,20
458
	  jl brush_x_spray
459
	inc edx
460
	cmp edx,20
461
	jl brush_y_spray
462
 
463
	call MovePictureToWorkScreen
464
	jmp still
465
 
466
	no_spray:
467
 
468
	;***********************palette*************************
469
	cmp eax,51
470
	jne no_palette
471
 
472
	mov eax,20
473
	mov ebx,100
474
	mov ecx,32*10+32*5+7
475
	mov edx,8*10+7*10
476
	mov  esi,1
477
	call draw_volume_rectangle
478
	mov [x],20+5
479
	mov [y],100+10
480
	mov edi,256
481
	xor esi,esi
482
	next_rectangle:
483
	mov eax,13
484
	mov ebx,[x]
485
	mov ecx,[y]
486
	mov edx,[palitra+esi]
487
	and edx,0xffffff
488
	shl ebx,16
489
	shl ecx,16
490
	add ebx,13
491
	add ecx,13
485 heavyiron 492
	mcall
255 heavyiron 493
	add [x],15
494
	cmp [x],20+15*32
495
	jl no_new_line
496
	mov [x],20+5
497
	add [y],15
498
	no_new_line:
499
	add esi,4
500
	dec edi
501
	jnz next_rectangle
502
 
503
	wait_events:
504
	call event
505
 
506
	cmp eax,1
507
	je still
508
 
509
	cmp eax,2
510
	jne no_keys
511
 
512
	mov eax,2
485 heavyiron 513
	mcall
255 heavyiron 514
 
515
	no_keys:
516
 
517
	cmp eax,3
518
	jne no_buttons
519
	mov eax,17
485 heavyiron 520
	mcall
255 heavyiron 521
 
522
	no_buttons:
523
 
524
	cmp eax,6
525
	jne wait_events
526
 
527
	call GetMouseClick
528
 
529
	test eax,eax
530
	jz wait_events
531
	call GetMouseCoordinats
532
	mov [x],20+5
533
	mov [y],100+10
534
	mov [counter],0
535
	next_rectangle_column:
536
	mov eax,[x]
537
	mov ebx,[y]
538
	mov ecx,[MouseX]
539
	mov edx,[MouseY]
540
	mov esi,13
541
	mov edi,13
542
	call columnus
543
	test eax,eax
544
	jz no_columnus_color
545
 
546
	mov eax,[counter]
547
	shl eax,2
548
	mov ebx,[palitra+eax]
549
	and ebx,0xffffff
550
	mov [Color],ebx
551
	no_columnus_color:
552
 
553
	add [x],15
554
 
555
	cmp [x],20+15*32
556
	jl no_new_line_column
557
 
558
	mov [x],20+5
559
	add [y],15
560
	no_new_line_column:
561
 
562
	inc [counter]
563
 
564
	cmp [counter],257
565
	jne next_rectangle_column
566
 
567
	mov eax,5
568
	mov ebx,10
485 heavyiron 569
	mcall
255 heavyiron 570
 
571
	call drawwin
572
 
573
	mov eax,[Last_instrument]
574
	mov [Current_instrument],eax
575
 
576
	jmp still
577
	no_palette:
578
 
579
	;************************draw line**********************
580
	cmp eax,16
581
	jne no_line
582
 
583
	mov [Last_instrument],eax
584
 
585
	mov al,[Activate_instrument]
586
	test al,al
587
	jnz no_new_line_xy
588
	mov eax,[ScreenX]
589
	mov ebx,[ScreenY]
590
	add eax,[PosX]
591
	add ebx,[PosY]
592
	mov [OldX],eax
593
	mov [OldY],ebx
594
	mov [Activate_instrument],1
595
	mov eax,[ReserveArray]
596
	mov ecx,60000
597
	clear_array_line:
598
	mov [eax],dword 0
599
	add eax,4
600
	dec ecx
601
	jnz clear_array_line
602
	jmp still
603
	no_new_line_xy:
604
 
605
	;put saved pixels
606
	mov ebx,[ReserveArray]
607
	mov eax,[ebx]
608
	test eax,eax
609
	jz no_put_line_to_screen_line
610
	mov ecx,[ebx]
611
	add ebx,4
612
	xor ebp,ebp
613
	next_color_put_line:
614
	;put saved pixels in ReserveArray
615
	push ecx
616
	and [counter2],0
617
	mov edi,[ebx]
618
	push edi
619
	vertical_width_put:
620
	   and [counter],0
621
 
622
	   horizontal_width_put:
623
	      mov edx,[ebx+4807*4+ebp]
624
	      and edx,0xffffff
625
	      mov [edi],dx
626
	      shr edx,16
627
	      mov [edi+2],dl
628
 
629
	   add edi,3
630
	   add ebp,4
631
	   inc [counter]
632
	   cmp [counter],5
633
	   jne horizontal_width_put
634
 
635
	   mov ecx,[Picture_SizeX]
636
	   sub ecx,5
637
	   lea ecx,[ecx+ecx*2]
638
	   add edi,ecx
639
	inc [counter2]
640
	cmp [counter2],5
641
	jne vertical_width_put
642
	pop edi
643
	pop ecx
644
	add ebx,4
645
	dec ecx
646
	jnz next_color_put_line
647
 
648
	no_put_line_to_screen_line:
649
 
650
	;calculate line
651
	mov ebx,[ReserveArray]
652
	add ebx,4
653
	mov eax,[PointerToPicture]
654
	mov ecx,[Picture_SizeX]
655
	mov edx,[OldX]
656
	shl edx,16
657
	add edx,[OldY]
658
	mov esi,[ScreenX]
659
	mov edi,[ScreenY]
660
	add esi,[PosX]
661
	add edi,[PosY]
662
 
663
	mov ebp,[Picture_SizeX]
664
	sub ebp,[line_width]
665
	cmp esi,ebp
666
	jl no_minimum_x_line
667
	mov esi,ebp
668
	no_minimum_x_line:
669
 
670
	mov ebp,[Picture_SizeY]
671
	sub ebp,[line_width]
672
	cmp edi,ebp
673
	jl no_minimum_y_line
674
	mov edi,ebp
675
	no_minimum_y_line:
676
 
677
	call calculate_line
678
	;call calculate_rectangle
679
	mov [counter],eax
680
 
681
	;save color pixels in ReserveArray
682
	mov eax,[counter]
683
	mov ebx,[ReserveArray]
684
	mov [ebx],eax
685
 
686
	mov ecx,[ebx]
687
	add ebx,4
688
 
689
	xor ebp,ebp
690
	next_color_save_line:
691
	;save color of pixel in ReserveArray
692
	push ecx
693
	and [counter2],0
694
	mov edi,[ebx]
695
	vertical_width_save:
696
	   and [counter],0
697
 
698
	   horizontal_width_save:
699
	      mov eax,edi
700
	      mov edx,[eax]
701
	      and edx,0xffffff
702
	      mov [ebx+4807*4+ebp],dx
703
	      shr edx,16
704
	      mov [ebx+4807*4+2+ebp],dl
705
 
706
	   add edi,3
707
	   add ebp,4
708
	   inc [counter]
709
	   cmp [counter],5
710
	   jne horizontal_width_save
711
 
712
	   mov ecx,[Picture_SizeX]
713
	   sub ecx,5
714
	   lea ecx,[ecx+ecx*2]
715
	   add edi,ecx
716
	inc [counter2]
717
	cmp [counter2],5
718
	jne vertical_width_save
719
	pop ecx
720
	add ebx,4
721
	dec ecx
722
	jnz next_color_save_line
723
 
724
	;draw calculated pixels on work arrea
725
	mov ebx,[ReserveArray]
726
	mov ecx,[ebx]
727
	mov edx,[Color]
728
	mov esi,[Color]
729
	shr edx,16
730
	add ebx,4
731
	mov edi,[line_width]
732
	dec edi
733
	imul edi,25
734
	next_pixel_put_line:
735
 
736
	mov eax,[ebx]
737
	push eax
738
	push ecx
739
	xor ebp,ebp
740
	and [counter2],0
741
 
742
	vertical_width:
743
	   and [counter],0
744
 
745
	   horizontal_width:
746
	   xor ecx,ecx
747
	   mov cl,byte[width_pixels+edi+ebp]
748
	   test cl,cl
749
	     jz no_draw_pixel_line
750
	      mov [eax],si
751
	      mov [eax+2],dl
752
	     no_draw_pixel_line:
753
	   add eax,3
754
	   inc ebp
755
	   inc [counter]
756
	   cmp [counter],5
757
	   jne horizontal_width
758
 
759
	   mov ecx,[Picture_SizeX]
760
	   sub ecx,5
761
	   lea ecx,[ecx+ecx*2]
762
	   add eax,ecx
763
	inc [counter2]
764
	cmp [counter2],5
765
	jne vertical_width
766
 
767
	pop ecx
768
	pop eax
769
	add ebx,4
770
	dec ecx
771
	jnz next_pixel_put_line
772
 
773
	call MovePictureToWorkScreen
774
 
775
	jmp still
776
	no_line:
777
 
778
	;*********************************DRAW RECTANGLE****************************
779
	cmp eax,17
780
	jne no_rectangle
781
 
782
	mov [Last_instrument],eax
783
 
784
	mov al,[Activate_instrument]
785
	test al,al
786
	jnz no_new_rectangle_xy
787
	mov eax,[ScreenX]
788
	mov ebx,[ScreenY]
789
	add eax,[PosX]
790
	add ebx,[PosY]
791
	mov [OldX],eax
792
	mov [OldY],ebx
793
	mov [Activate_instrument],1
794
	mov eax,[ReserveArray]
795
	mov ecx,60000
796
	clear_array_rectangle:
797
	mov [eax],dword 0
798
	add eax,4
799
	dec ecx
800
	jnz clear_array_rectangle
801
	jmp still
802
	no_new_rectangle_xy:
803
 
804
	;put saved pixels
805
	mov ebx,[ReserveArray]
806
	mov eax,[ebx]
807
	test eax,eax
808
	jz no_put_rectangle_to_screen_line
809
	mov ecx,[ebx]
810
	add ebx,4
811
	xor ebp,ebp
812
	next_color_put_rectangle:
813
	;put saved pixels in ReserveArray
814
	push ecx
815
	and [counter2],0
816
	mov edi,[ebx]
817
	push edi
818
	vertical_width_put_rectangle:
819
	   and [counter],0
820
 
821
	   horizontal_width_put_rectangle:
822
	      mov edx,[ebx+4807*4+ebp]
823
	      and edx,0xffffff
824
	      mov [edi],dx
825
	      shr edx,16
826
	      mov [edi+2],dl
827
 
828
	   add edi,3
829
	   add ebp,4
830
	   inc [counter]
831
	   cmp [counter],5
832
	   jne horizontal_width_put_rectangle
833
 
834
	   mov ecx,[Picture_SizeX]
835
	   sub ecx,5
836
	   lea ecx,[ecx+ecx*2]
837
	   add edi,ecx
838
	inc [counter2]
839
	cmp [counter2],5
840
	jne vertical_width_put_rectangle
841
	pop edi
842
	pop ecx
843
	add ebx,4
844
	dec ecx
845
	jnz next_color_put_rectangle
846
 
847
	no_put_rectangle_to_screen_line:
848
 
849
	;calculate line
850
	mov ebx,[ReserveArray]
851
	add ebx,4
852
	mov eax,[PointerToPicture]
853
	mov ecx,[Picture_SizeX]
854
	mov edx,[OldX]
855
	shl edx,16
856
	add edx,[OldY]
857
	mov esi,[ScreenX]
858
	mov edi,[ScreenY]
859
	add esi,[PosX]
860
	add edi,[PosY]
861
 
862
	mov ebp,[Picture_SizeX]
863
	sub ebp,[line_width]
864
	cmp esi,ebp
865
	jl no_minimum_x_rectangle
866
	mov esi,ebp
867
	no_minimum_x_rectangle:
868
 
869
	mov ebp,[Picture_SizeY]
870
	sub ebp,[line_width]
871
	cmp edi,ebp
872
	jl no_minimum_y_rectangle
873
	mov edi,ebp
874
	no_minimum_y_rectangle:
875
 
876
	call calculate_rectangle
877
	mov [counter],eax
878
 
879
	;save color pixels in ReserveArray
880
	mov eax,[counter]
881
	mov ebx,[ReserveArray]
882
	mov [ebx],eax
883
 
884
	mov ecx,[ebx]
885
	add ebx,4
886
 
887
	xor ebp,ebp
888
	next_color_save_rectangle:
889
	;save color of pixel in ReserveArray
890
	push ecx
891
	and [counter2],0
892
	mov edi,[ebx]
893
	vertical_width_save_rectangle:
894
	   and [counter],0
895
 
896
	   horizontal_width_save_rectangle:
897
	      mov eax,edi
898
	      mov edx,[eax]
899
	      and edx,0xffffff
900
	      mov [ebx+4807*4+ebp],dx
901
	      shr edx,16
902
	      mov [ebx+4807*4+2+ebp],dl
903
 
904
	   add edi,3
905
	   add ebp,4
906
	   inc [counter]
907
	   cmp [counter],5
908
	   jne horizontal_width_save_rectangle
909
 
910
	   mov ecx,[Picture_SizeX]
911
	   sub ecx,5
912
	   lea ecx,[ecx+ecx*2]
913
	   add edi,ecx
914
	inc [counter2]
915
	cmp [counter2],5
916
	jne vertical_width_save_rectangle
917
	pop ecx
918
	add ebx,4
919
	dec ecx
920
	jnz next_color_save_rectangle
921
 
922
	;draw calculated pixels on work arrea
923
	mov ebx,[ReserveArray]
924
	mov ecx,[ebx]
925
	mov edx,[Color]
926
	mov esi,[Color]
927
	shr edx,16
928
	add ebx,4
929
	mov edi,[line_width]
930
	dec edi
931
	imul edi,25
932
	next_pixel_put_rectangle:
933
 
934
	mov eax,[ebx]
935
	push eax
936
	push ecx
937
	xor ebp,ebp
938
	and [counter2],0
939
 
940
	vertical_width_rectangle:
941
	   and [counter],0
942
 
943
	   horizontal_width_rectangle:
944
	   xor ecx,ecx
945
	   mov cl,byte[width_pixels_rectangle+edi+ebp]
946
	   test cl,cl
947
	     jz no_draw_pixel_rectangle
948
	      mov [eax],si
949
	      mov [eax+2],dl
950
	     no_draw_pixel_rectangle:
951
	   add eax,3
952
	   inc ebp
953
	   inc [counter]
954
	   cmp [counter],5
955
	   jne horizontal_width_rectangle
956
 
957
	   mov ecx,[Picture_SizeX]
958
	   sub ecx,5
959
	   lea ecx,[ecx+ecx*2]
960
	   add eax,ecx
961
	inc [counter2]
962
	cmp [counter2],5
963
	jne vertical_width_rectangle
964
 
965
	pop ecx
966
	pop eax
967
	add ebx,4
968
	dec ecx
969
	jnz next_pixel_put_rectangle
970
 
971
	call MovePictureToWorkScreen
972
	jmp still
973
	no_rectangle:
974
 
975
	;*********************************DRAW CIRCLE****************************
976
	cmp eax,18
977
	jne no_circle
978
 
979
	mov [Last_instrument],eax
980
 
981
	mov al,[Activate_instrument]
982
	test al,al
983
	jnz no_new_circle_xy
984
	mov eax,[ScreenX]
985
	mov ebx,[ScreenY]
986
	add eax,[PosX]
987
	add ebx,[PosY]
988
	mov [OldX],eax
989
	mov [OldY],ebx
990
	mov [Activate_instrument],1
991
	mov eax,[ReserveArray]
992
	mov ecx,60000
993
	clear_array_circle:
994
	mov [eax],dword 0
995
	add eax,4
996
	dec ecx
997
	jnz clear_array_circle
998
	jmp still
999
	no_new_circle_xy:
1000
 
1001
	;put saved pixels
1002
	mov ebx,[ReserveArray]
1003
	mov eax,[ebx]
1004
	test eax,eax
1005
	jz no_put_line_to_screen_circle
1006
	mov ecx,[ebx]
1007
	add ebx,4
1008
	xor ebp,ebp
1009
	next_color_put_circle:
1010
	;put saved pixels in ReserveArray
1011
	push ecx
1012
	and [counter2],0
1013
	mov edi,[ebx]
1014
	push edi
1015
	vertical_width_put_circle:
1016
	   and [counter],0
1017
 
1018
	   horizontal_width_put_circle:
1019
	      mov edx,[ebx+4807*4+ebp]
1020
	      and edx,0xffffff
1021
	      mov [edi],dx
1022
	      shr edx,16
1023
	      mov [edi+2],dl
1024
 
1025
	   add edi,3
1026
	   add ebp,4
1027
	   inc [counter]
1028
	   cmp [counter],5
1029
	   jne horizontal_width_put_circle
1030
 
1031
	   mov ecx,[Picture_SizeX]
1032
	   sub ecx,5
1033
	   lea ecx,[ecx+ecx*2]
1034
	   add edi,ecx
1035
	inc [counter2]
1036
	cmp [counter2],5
1037
	jne vertical_width_put_circle
1038
	pop edi
1039
	pop ecx
1040
	add ebx,4
1041
	dec ecx
1042
	jnz next_color_put_circle
1043
 
1044
	no_put_line_to_screen_circle:
1045
 
1046
	mov esi,[ScreenX]
1047
	mov edi,[ScreenY]
1048
	add esi,[PosX]
1049
	add edi,[PosY]
1050
 
1051
	sub esi,[OldX]
1052
	jns no_sign_x_circle
1053
	neg esi
1054
	shr esi,1
1055
	neg esi
1056
	add esi,[OldX]
1057
	jmp no_plus_sign_x_circle
1058
	no_sign_x_circle:
1059
 
1060
	shr esi,1
1061
	add esi,[OldX]
1062
	no_plus_sign_x_circle:
1063
 
1064
	sub edi,[OldY]
1065
	jns no_sign_y_circle
1066
	neg edi
1067
	shr edi,1
1068
	neg edi
1069
	add edi,[OldY]
1070
	jmp no_plus_sign_y_circle
1071
	no_sign_y_circle:
1072
 
1073
	shr edi,1
1074
	add edi,[OldY]
1075
	no_plus_sign_y_circle:
1076
 
1077
	mov [x],esi
1078
	mov [y],edi
1079
 
1080
	mov esi,[ScreenX]
1081
	mov edi,[ScreenY]
1082
	add esi,[PosX]
1083
	add edi,[PosY]
1084
 
1085
	sub esi,[OldX]
1086
	jns no_sign_x_circle_r
1087
	neg esi
1088
	no_sign_x_circle_r:
1089
 
1090
	sub edi,[OldY]
1091
	jns no_sign_y_circle_r
1092
	neg edi
1093
	no_sign_y_circle_r:
1094
 
1095
	mov [Dx_],esi
1096
	mov [Dy_],edi
1097
 
1098
	;finit
1099
	fild [Dx_]
1100
	fmul st0,st0
1101
	fild [Dy_]
1102
	fmul st0,st0
1103
	fadd st0,st1
1104
	fsqrt
1105
	fistp [Radius]
1106
	fistp [Icon_X]
1107
	mov esi,[Radius]
1108
	shr esi,1
1109
	cmp esi,0
1110
	jne no_null_radius
1111
	mov [Radius],1
1112
	no_null_radius:
1113
 
1114
	mov [Radius],esi
1115
 
1116
	mov edi,[x]
1117
	mov ebp,[y]
1118
	add edi,esi
1119
	add ebp,esi
1120
 
1121
	mov edx,[Picture_SizeX]
1122
	sub edx,[line_width]
1123
	cmp edi,edx
1124
	jl no_limit_x_circle
1125
	sub edi,edx
1126
	sub [Radius],edi
1127
	no_limit_x_circle:
1128
 
1129
	mov edx,[Picture_SizeY]
1130
	sub edx,[line_width]
1131
	cmp ebp,edx
1132
	jl no_limit_y_circle
1133
	sub ebp,edx
1134
	sub [Radius],ebp
1135
	no_limit_y_circle:
1136
 
1137
 
1138
	mov edi,[x]
1139
	mov ebp,[y]
1140
 
1141
	sub edi,[Radius]
1142
	jns no_minimum_x_circle
1143
	add [Radius],edi
1144
	no_minimum_x_circle:
1145
 
1146
	sub ebp,[Radius]
1147
	jns no_minimum_y_circle
1148
	add [Radius],ebp
1149
	no_minimum_y_circle:
1150
 
1151
	;calculate circle
1152
	mov ebx,[ReserveArray]
1153
	add ebx,4
1154
	mov eax,[PointerToPicture]
1155
	mov ecx,[Picture_SizeX]
1156
	mov edx,[x]
1157
	shl edx,16
1158
	add edx,[y]
1159
	mov esi,[Radius]
1160
	call calculate_circle
1161
 
1162
	mov [counter],eax
1163
 
1164
	;save color pixels in ReserveArray
1165
	mov eax,[counter]
1166
	mov ebx,[ReserveArray]
1167
	mov [ebx],eax
1168
 
1169
	mov ecx,[ebx]
1170
	add ebx,4
1171
 
1172
	xor ebp,ebp
1173
	next_color_save_circle:
1174
	;save color of pixel in ReserveArray
1175
	push ecx
1176
	and [counter2],0
1177
	mov edi,[ebx]
1178
	vertical_width_save_circle:
1179
	   and [counter],0
1180
 
1181
	   horizontal_width_save_circle:
1182
	      mov eax,edi
1183
	      mov edx,[eax]
1184
	      and edx,0xffffff
1185
	      mov [ebx+4807*4+ebp],dx
1186
	      shr edx,16
1187
	      mov [ebx+4807*4+2+ebp],dl
1188
 
1189
	   add edi,3
1190
	   add ebp,4
1191
	   inc [counter]
1192
	   cmp [counter],5
1193
	   jne horizontal_width_save_circle
1194
 
1195
	   mov ecx,[Picture_SizeX]
1196
	   sub ecx,5
1197
	   lea ecx,[ecx+ecx*2]
1198
	   add edi,ecx
1199
	inc [counter2]
1200
	cmp [counter2],5
1201
	jne vertical_width_save_circle
1202
	pop ecx
1203
	add ebx,4
1204
	dec ecx
1205
	jnz next_color_save_circle
1206
 
1207
	;draw calculated pixels on work arrea
1208
	mov ebx,[ReserveArray]
1209
	mov ecx,[ebx]
1210
	mov edx,[Color]
1211
	mov esi,[Color]
1212
	shr edx,16
1213
	add ebx,4
1214
	mov edi,[line_width]
1215
	dec edi
1216
	imul edi,25
1217
	next_pixel_put_circle:
1218
 
1219
	mov eax,[ebx]
1220
	push eax
1221
	push ecx
1222
	xor ebp,ebp
1223
	and [counter2],0
1224
 
1225
	vertical_width_circle:
1226
	   and [counter],0
1227
 
1228
	   horizontal_width_circle:
1229
	   xor ecx,ecx
1230
	   mov cl,byte[width_pixels+edi+ebp]
1231
	   test cl,cl
1232
	     jz no_draw_pixel_circle
1233
	      mov [eax],si
1234
	      mov [eax+2],dl
1235
	     no_draw_pixel_circle:
1236
	   add eax,3
1237
	   inc ebp
1238
	   inc [counter]
1239
	   cmp [counter],5
1240
	   jne horizontal_width_circle
1241
 
1242
	   mov ecx,[Picture_SizeX]
1243
	   sub ecx,5
1244
	   lea ecx,[ecx+ecx*2]
1245
	   add eax,ecx
1246
	inc [counter2]
1247
	cmp [counter2],5
1248
	jne vertical_width_circle
1249
 
1250
	pop ecx
1251
	pop eax
1252
	add ebx,4
1253
	dec ecx
1254
	jnz next_pixel_put_circle
1255
 
1256
	call MovePictureToWorkScreen
1257
	jmp still
1258
	no_circle:
1259
 
1260
	;************************zoom 1*************************
1261
	cmp eax,45
1262
	jne no_1_
1263
	mov [k],1
1264
	mov [Scroll1CoordinatX],9
1265
	mov [Scroll2CoordinatY],89
1266
	and [Current_instrument],0
1267
	call drawwin
1268
	jmp still
1269
	no_1_:
1270
 
1271
	;*************************zoom 2************************
1272
	cmp eax,46
1273
	jne no_2_
1274
	mov [k],2
1275
	call drawwin
1276
	mov [Scroll1CoordinatX],9
1277
	mov [Scroll2CoordinatY],89
1278
	and [Current_instrument],0
1279
	jmp still
1280
	no_2_:
1281
 
1282
 
1283
	;*************************zoom 3************************
1284
	cmp eax,47
1285
	jne no_3_
1286
	mov [k],3
1287
	call drawwin
1288
	mov [Scroll1CoordinatX],9
1289
	mov [Scroll2CoordinatY],89
1290
	and [Current_instrument],0
1291
	jmp still
1292
	no_3_:
1293
 
1294
	;*************************zoom 4************************
1295
	cmp eax,48
1296
	jne no_4_
1297
	mov [k],4
1298
	call drawwin
1299
	mov [Scroll1CoordinatX],9
1300
	mov [Scroll2CoordinatY],89
1301
	and [Current_instrument],0
1302
	jmp still
1303
	no_4_:
1304
 
1305
	;************************zoom 8*************************
1306
	cmp eax,49
1307
	jne no_8_
1308
	mov [k],8
1309
	call drawwin
1310
	mov [Scroll1CoordinatX],9
1311
	mov [Scroll2CoordinatY],89
1312
	and [Current_instrument],0
1313
	jmp still
1314
	no_8_:
1315
 
1316
	;************************zoom 16************************
1317
	cmp eax,50
1318
	jne no_16_
1319
	mov [k],16
1320
	call drawwin
1321
	mov [Scroll1CoordinatX],9
1322
	mov [Scroll2CoordinatY],89
1323
	and [Current_instrument],0
1324
	jmp still
1325
	no_16_:
1326
 
1327
	;***************allocation of a countour*********************
1328
	cmp eax,21
1329
	jne no_allocation
1330
 
1331
	cmp [instrument_used],0
1332
	jnz instrument_not_finished_work
1333
 
1334
	mov al,[Activate_instrument]
1335
	test al,al
1336
	jnz no_new_allocation_xy
1337
	mov eax,[ScreenX]
1338
	mov ebx,[ScreenY]
1339
	add eax,[PosX]
1340
	add ebx,[PosY]
1341
	mov [OldX],eax
1342
	mov [OldY],ebx
1343
	inc eax
1344
	inc ebx
1345
	mov [rectangular_shade_x],eax
1346
	mov [rectangular_shade_y],ebx
1347
	mov [Activate_instrument],1
1348
	mov [instrument_used],1
1349
	and [crossing],0
1350
	and [finishing_crossing],0
1351
	mov eax,[ReserveArray]
1352
	mov ecx,60000
1353
	clear_array_allocation:
1354
	mov [eax],dword 0
1355
	add eax,4
1356
	dec ecx
1357
	jnz clear_array_allocation
1358
	jmp still
1359
	no_new_allocation_xy:
1360
	instrument_not_finished_work:
1361
 
1362
	mov al,[instrument_used]
1363
	test al,al
1364
	jz no_change_coordinats
1365
 
1366
	cmp [Activate_instrument],0
1367
	jnz no_change_coordinats
1368
 
1369
	;save coordinates as old if crossing=0
1370
	cmp [crossing],0
1371
	jnz no_save_coordinate_of_crossing
1372
 
1373
	mov eax,[OldX]
1374
	mov ebx,[OldY]
1375
 
1376
	cmp eax,[rectangular_shade_x]
1377
	jl no_remove_x
1378
	mov ecx,[rectangular_shade_x]
1379
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
1380
	mov [rectangular_shade_x],eax
1381
	no_remove_x:
1382
 
1383
	cmp ebx,[rectangular_shade_y]
1384
	jl no_remove_y
1385
	mov ecx,[rectangular_shade_y]
1386
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
1387
	mov [rectangular_shade_y],ebx
1388
	no_remove_y:
1389
 
1390
	mov eax,[ScreenX]
1391
	mov ebx,[ScreenY]
1392
	add eax,[PosX]
1393
	add ebx,[PosY]
1394
	mov [crossing_old_x],eax
1395
	mov [crossing_old_y],ebx
1396
	mov [crossing],1
1397
 
1398
 
1399
	mov eax,[OldX]
1400
	mov ebx,[OldY]
1401
	inc eax
1402
	inc ebx
1403
	mov [SpriteCoordinatX],eax
1404
	mov [SpriteCoordinatY],ebx
1405
	mov [SpriteOldCoordinatX],eax
1406
	mov [SpriteOldCoordinatY],ebx
1407
	mov esi,[rectangular_shade_x]
1408
	mov edi,[rectangular_shade_y]
1409
 
1410
	sub esi,eax
1411
	jns no_sign_sprite_size_x
1412
	neg esi
1413
	no_sign_sprite_size_x:
1414
 
1415
	sub edi,ebx
1416
	jns no_sign_sprite_size_y
1417
	neg edi
1418
	no_sign_sprite_size_y:
1419
 
1420
	test esi,esi
1421
	jnz no_null_sprite_x
1422
	mov esi,1
1423
	no_null_sprite_x:
1424
 
1425
	test edi,edi
1426
	jnz no_null_sprite_y
1427
	mov edi,1
1428
	no_null_sprite_y:
1429
 
1430
	mov [SpriteSizeX],esi
1431
	mov [SpriteSizeY],edi
1432
 
1433
	call SaveFonForSprite
1434
 
1435
	no_save_coordinate_of_crossing:
1436
 
1437
	cmp [crossing],0
1438
	je no_test_crossing_with_work_arrea
1439
	;if mouse situatad after allocation than exit
1440
	push [ScreenX]
1441
	push [ScreenY]
1442
 
1443
	call GetScreenCordinats
1444
 
1445
	mov eax,[OldX]
1446
	mov ebx,[OldY]
1447
	mov ecx,[ScreenX]
1448
	mov edx,[ScreenY]
1449
	mov esi,[SpriteSizeX]
1450
	mov edi,[SpriteSizeY]
1451
	add ecx,[PosX]
1452
	add edx,[PosY]
1453
	inc esi;eax
1454
	inc edi;ebx
1455
	call columnus
1456
 
1457
	test eax,eax
1458
	jnz crossing_with_work_area
1459
	mov [finishing_crossing],1
1460
	mov [register],1
1461
	crossing_with_work_area:
1462
 
1463
	pop [ScreenY]
1464
	pop [ScreenX]
1465
 
1466
	no_test_crossing_with_work_arrea:
1467
 
1468
	mov eax,[ScreenX]
1469
	mov ebx,[ScreenY]
1470
	add eax,[PosX]
1471
	add ebx,[PosY]
1472
	mov ecx,eax
1473
	mov edx,ebx
1474
	sub eax,[crossing_old_x]  ;dx=(x-oldx)
1475
	sub ebx,[crossing_old_y]  ;dy=(y-oldy)
1476
	mov [crossing_old_x],ecx
1477
	mov [crossing_old_y],edx
1478
 
1479
	add [OldX],eax		       ;x1=x1+dx
1480
	add [OldY],ebx		       ;y1=y1+dy
1481
	add [rectangular_shade_x],eax  ;x2=x2+dx
1482
	add [rectangular_shade_y],ebx  ;y2+y2+dy
1483
 
1484
	mov eax,[OldX]
1485
	mov ebx,[OldY]
1486
	inc eax
1487
	inc ebx
1488
	mov [SpriteCoordinatX],eax
1489
	mov [SpriteCoordinatY],ebx
1490
 
1491
	cmp [SpriteCoordinatX],0
1492
	jns no_null_sprite_coordinat_x
1493
	mov [SpriteCoordinatX],1
1494
	no_null_sprite_coordinat_x:
1495
 
1496
	cmp [SpriteCoordinatY],0
1497
	jns no_null_sprite_coordinat_y
1498
	mov [SpriteCoordinatY],1
1499
	no_null_sprite_coordinat_y:
1500
 
1501
	mov esi,[rectangular_shade_x]
1502
	mov edi,[rectangular_shade_y]
1503
 
1504
	sub esi,[OldX]
1505
	jns no_znak_size_of_rectangulare_crossing_x
1506
	neg esi
1507
	no_znak_size_of_rectangulare_crossing_x:
1508
 
1509
	sub edi,[OldY]
1510
	jns no_znak_size_of_rectangulare_crossing_y
1511
	neg edi
1512
	no_znak_size_of_rectangulare_crossing_y:
1513
 
1514
	mov ecx,[OldX]
1515
	mov edx,[OldY]
1516
 
1517
	sub ecx,[PosX]
1518
	jns no_minimum_x_crossing
1519
	mov ecx,0
1520
	add ecx,[PosX]
1521
	mov [OldX],ecx
1522
	add ecx,esi
1523
	mov [rectangular_shade_x],ecx
1524
	no_minimum_x_crossing:
1525
 
1526
	sub edx,[PosY]
1527
	jns no_minimum_y_crossing
1528
	mov edx,0
1529
	add edx,[PosY]
1530
	mov [OldY],edx
1531
	add edx,edi
1532
	mov [rectangular_shade_y],edx
1533
	no_minimum_y_crossing:
1534
 
1535
	mov ecx,[Picture_SizeX]
1536
	sub ecx,esi
1537
	cmp [OldX],ecx
1538
	jl no_maximum_x_crossing
1539
	dec ecx
1540
	mov [OldX],ecx
1541
	add ecx,esi
1542
	mov [rectangular_shade_x],ecx
1543
	no_maximum_x_crossing:
1544
 
1545
	mov edx,[Picture_SizeY]
1546
	sub edx,edi
1547
	cmp [OldY],edx
1548
	jl no_maximum_y_crossing
1549
	dec edx
1550
	mov [OldY],edx
1551
	add edx,edi
1552
	mov [rectangular_shade_y],edx
1553
	no_maximum_y_crossing:
1554
 
1555
	mov eax,[rectangular_shade_x]
1556
	mov ebx,[rectangular_shade_y]
1557
	sub eax,[PosX]
1558
	sub ebx,[PosY]
1559
	mov [ScreenX],eax
1560
	mov [ScreenY],ebx
1561
	no_change_coordinats:
1562
 
1563
	;put saved pixels
1564
	mov ebx,[ReserveArray]
1565
	mov eax,[ebx]
1566
	test eax,eax
1567
	jz no_put_line_to_screen_allocation
1568
	mov ecx,[ebx]
1569
	add ebx,4
1570
	xor ebp,ebp
1571
	next_color_put_allocation:
1572
	;put saved pixels in ReserveArray
1573
	push ecx
1574
	and [counter2],0
1575
	mov edi,[ebx]
1576
	push edi
1577
	vertical_width_put_allocation:
1578
	   and [counter],0
1579
 
1580
	   horizontal_width_put_allocation:
1581
	      mov edx,[ebx+4807*4+ebp]
1582
	      and edx,0xffffff
1583
	      mov [edi],dx
1584
	      shr edx,16
1585
	      mov [edi+2],dl
1586
 
1587
	   add edi,3
1588
	   add ebp,4
1589
	   inc [counter]
1590
	   cmp [counter],1;5
1591
	   jne horizontal_width_put_allocation
1592
 
1593
	   mov ecx,[Picture_SizeX]
1594
	   sub ecx,1;5
1595
	   lea ecx,[ecx+ecx*2]
1596
	   add edi,ecx
1597
	inc [counter2]
1598
	cmp [counter2],1;5
1599
	jne vertical_width_put_allocation
1600
	pop edi
1601
	pop ecx
1602
	add ebx,4
1603
	dec ecx
1604
	jnz next_color_put_allocation
1605
 
1606
	no_put_line_to_screen_allocation:
1607
 
1608
	cmp [DrawSprite_flag],1
1609
	jne no_activate_put_fon_
1610
 
1611
	cmp [Paste_flag],1
1612
	je no_put_fon___
1613
	call PutFonForSprite
1614
	no_put_fon___:
1615
	and [Paste_flag],0
1616
	no_activate_put_fon_:
1617
 
1618
	cmp [finishing_crossing],0
1619
	jz not_finish_from_instrument_crossing
1620
	and [Activate_instrument],0
1621
	and [crossing],0
1622
	and [instrument_used],0
1623
	and [DrawSprite_flag],0
1624
	call MovePictureToWorkScreen
1625
	jmp still
1626
	not_finish_from_instrument_crossing:
1627
 
1628
	;calculate line
1629
	mov ebx,[ReserveArray]
1630
	add ebx,4
1631
	mov eax,[PointerToPicture]
1632
	mov ecx,[Picture_SizeX]
1633
	mov edx,[OldX]
1634
	shl edx,16
1635
	add edx,[OldY]
1636
	mov esi,[ScreenX]
1637
	mov edi,[ScreenY]
1638
	add esi,[PosX]
1639
	add edi,[PosY]
1640
 
1641
	mov ebp,[Picture_SizeX]
1642
	dec ebp
1643
	cmp esi,ebp
1644
	jl no_minimum_x_allocation
1645
	mov esi,ebp
1646
	no_minimum_x_allocation:
1647
 
1648
	mov ebp,[Picture_SizeY]
1649
	dec ebp
1650
	cmp edi,ebp
1651
	jl no_minimum_y_allocation
1652
	mov edi,ebp
1653
	no_minimum_y_allocation:
1654
 
1655
	call calculate_rectangle
1656
	mov [counter],eax
1657
 
1658
	;save color pixels in ReserveArray
1659
	mov eax,[counter]
1660
	mov ebx,[ReserveArray]
1661
	mov [ebx],eax
1662
 
1663
	mov ecx,[ebx]
1664
	add ebx,4
1665
 
1666
	xor ebp,ebp
1667
	next_color_save_allocation:
1668
	;save color of pixel in ReserveArray
1669
	push ecx
1670
	and [counter2],0
1671
	mov edi,[ebx]
1672
	vertical_width_save_allocation:
1673
	   and [counter],0
1674
 
1675
	   horizontal_width_save_allocation:
1676
	      mov eax,edi
1677
	      mov edx,[eax]
1678
	      and edx,0xffffff
1679
	      mov [ebx+4807*4+ebp],dx
1680
	      shr edx,16
1681
	      mov [ebx+4807*4+2+ebp],dl
1682
 
1683
	   add edi,3
1684
	   add ebp,4
1685
	   inc [counter]
1686
	   cmp [counter],1;5
1687
	   jne horizontal_width_save_allocation
1688
 
1689
	   mov ecx,[Picture_SizeX]
1690
	   sub ecx,1;5
1691
	   lea ecx,[ecx+ecx*2]
1692
	   add edi,ecx
1693
	inc [counter2]
1694
	cmp [counter2],1;5
1695
	jne vertical_width_save_allocation
1696
	pop ecx
1697
	add ebx,4
1698
	dec ecx
1699
	jnz next_color_save_allocation
1700
 
1701
	cmp [DrawSprite_flag],1
1702
	jne no_save_fon_for_sprite_
1703
	;save current coordinats as old
1704
	mov eax,[SpriteCoordinatX]
1705
	mov ebx,[SpriteCoordinatY]
1706
	mov [SpriteOldCoordinatX],eax
1707
	mov [SpriteOldCoordinatY],ebx
1708
 
1709
	call SaveFonForSprite
1710
 
1711
	no_save_fon_for_sprite_:
1712
 
1713
	;draw calculated pixels on work arrea
1714
	mov ebx,[ReserveArray]
1715
	mov ecx,[ebx]
1716
	add ebx,4
1717
	next_pixel_put_allocation:
1718
 
1719
	mov edx,0x1f3fff
1720
	mov esi,edx
1721
	shr edx,16
1722
 
1723
	mov ebp,ecx
1724
	and ebp,8
1725
	cmp ebp,8
1726
	jne black_color
1727
	mov si,0xffff
1728
	mov dl,0xff
1729
	black_color:
1730
 
1731
	mov eax,[ebx]
1732
	mov [eax],si
1733
	mov [eax+2],dl
1734
 
1735
	add ebx,4
1736
	dec ecx
1737
	jnz next_pixel_put_allocation
1738
 
1739
	cmp [DrawSprite_flag],1
1740
	jne no_activate_draw_sprite_
1741
 
1742
	call DrawSprite
1743
 
1744
	no_activate_draw_sprite_:
1745
 
1746
	mov al,[instrument_used]
1747
	test al,al
1748
	jz no_change_coordinats
1749
	cmp [Activate_instrument],0
1750
	jz no_save_shades
1751
	mov eax,[ScreenX]
1752
	mov ebx,[ScreenY]
1753
	add eax,[PosX]
1754
	add ebx,[PosY]
1755
	mov [rectangular_shade_x],eax
1756
	mov [rectangular_shade_y],ebx
1757
	no_save_shades:
1758
 
1759
	call MovePictureToWorkScreen
1760
	jmp still
1761
	no_allocation:
1762
 
1763
	;*************reflection from left to right******************
1764
	cmp eax,23
1765
	jne no_reflection_from_left_to_right
1766
 
1767
	mov ebp,[PointerToPicture]
1768
	mov edx,[ReserveArray]
1769
	mov esi,[Picture_SizeX]
1770
	mov ebx,[Picture_SizeX]
1771
	lea ebx,[ebx+ebx*2]
1772
	shr esi,1
1773
	next_line_reflection_x:
1774
	;copy vertical line to array
1775
	mov ecx,[Picture_SizeX]
1776
	shr ecx,1
1777
	sub ecx,esi
1778
	lea ecx,[ecx+ecx*2]
1779
	add ecx,[PointerToPicture]
1780
	mov edx,[ReserveArray]
1781
	and edi,0
1782
	copy_to_array_line_reflection_y:
1783
	xor eax,eax
1784
	mov eax,[ecx]
1785
	mov ebp,edi
1786
	lea ebp,[ebp+ebp*2]
1787
	mov [edx+ebp],ax
1788
	shr eax,16
1789
	mov [edx+ebp+2],al
1790
	add ecx,ebx
1791
	inc edi
1792
	cmp edi,[Picture_SizeY]
1793
	jne copy_to_array_line_reflection_y
1794
 
1795
	mov ecx,[Picture_SizeX]
1796
	shr ecx,1
1797
	mov ebp,ecx
1798
	add ecx,esi
1799
	dec ecx
1800
	lea ecx,[ecx+ecx*2]
1801
	add ecx,[PointerToPicture]
1802
	sub ebp,esi
1803
	lea ebp,[ebp+ebp*2]
1804
	add ebp,[PointerToPicture]
1805
	and edi,0
1806
	next_line_reflection_y:
1807
	mov eax,[ecx]
1808
	and eax,0xffffff
1809
	mov [ebp],ax
1810
	shr eax,16
1811
	mov [ebp+2],al
1812
	add ebp,ebx
1813
	add ecx,ebx
1814
	inc edi
1815
	cmp edi,[Picture_SizeY]
1816
	jnz next_line_reflection_y
1817
 
1818
	;copy vertical line  from array to screen
1819
	mov ecx,[Picture_SizeX]
1820
	shr ecx,1
1821
	add ecx,esi
1822
	dec ecx
1823
	lea ecx,[ecx+ecx*2]
1824
	add ecx,[PointerToPicture]
1825
	mov edx,[ReserveArray]
1826
	and edi,0
1827
	copy_from_array_to_screen_reflection_y:
1828
	mov ebp,edi
1829
	lea ebp,[ebp+ebp*2]
1830
	xor eax,eax
1831
	mov eax,[edx+ebp]
1832
	mov [ecx],ax
1833
	shr eax,16
1834
	mov [ecx+2],al
1835
	add ecx,ebx
1836
	inc edi
1837
	cmp edi,[Picture_SizeY]
1838
	jne copy_from_array_to_screen_reflection_y
1839
 
1840
	dec esi
1841
	jnz next_line_reflection_x
1842
 
1843
	call MovePictureToWorkScreen
1844
	jmp still
1845
	no_reflection_from_left_to_right:
1846
 
1847
	;*************reflection from up to down******************
1848
	cmp eax,24
1849
	jne no_reflection_from_up_to_down
1850
	mov esi,[Picture_SizeX]
1851
	mov edi,esi
1852
	lea esi,[esi+esi*2]
1853
	lea edi,[edi+edi*2]
1854
	imul edi,[Picture_SizeY]
1855
	mov edx,[ReserveArray]
1856
	mov ecx,[Picture_SizeY]
1857
	shr ecx,1
1858
	add edi,[PointerToPicture]
1859
	sub edi,esi
1860
	mov ebp,[PointerToPicture]
1861
	next_lines_reflection:
1862
	;copy line
1863
	xor ebx,ebx
1864
	copy_line_1:
1865
	xor eax,eax
1866
	mov al,[edi+ebx]
1867
	mov [edx+ebx],al
1868
	inc ebx
1869
	cmp ebx,esi
1870
	jne copy_line_1
1871
 
1872
	xor ebx,ebx
1873
	copy_line_2:
1874
	xor eax,eax
1875
	mov al,[ebp+ebx]
1876
	mov [edi+ebx],al
1877
	inc ebx
1878
	cmp ebx,esi
1879
	jne copy_line_2
1880
 
1881
	xor ebx,ebx
1882
	copy_line_3:
1883
	xor eax,eax
1884
	mov al,[edx+ebx]
1885
	mov [ebp+ebx],al
1886
	inc ebx
1887
	cmp ebx,esi
1888
	jne copy_line_3
1889
 
1890
	add ebp,esi
1891
	sub edi,esi
1892
	dec ecx
1893
	jnz next_lines_reflection
1894
 
1895
	call MovePictureToWorkScreen
1896
	jmp still
1897
	no_reflection_from_up_to_down:
1898
 
1899
	;*********************draw hard contour*******************
1900
	cmp eax,20
1901
	jne no_kontur_
1902
 
1903
	mov [Last_instrument],eax
1904
 
1905
	mov al,[Activate_instrument]
1906
	test al,al
1907
	jnz no_new_konture_xy
1908
 
1909
	mov al,[instrument_used]
1910
	test al,al
1911
	jz instrument_not_used
1912
	mov eax,[used_OldX]
1913
	mov ebx,[used_OldY]
1914
	mov [OldX],eax
1915
	mov [OldY],ebx
1916
	jmp exit_used_instrument
1917
	instrument_not_used:
1918
 
1919
	mov eax,[ScreenX]
1920
	mov ebx,[ScreenY]
1921
	add eax,[PosX]
1922
	add ebx,[PosY]
1923
	mov [OldX],eax
1924
	mov [OldY],ebx
1925
	exit_used_instrument:
1926
 
1927
	mov al,[instrument_used]
1928
	test al,al
1929
	jnz instrument_used_true
1930
	mov [instrument_used],byte 1
1931
	instrument_used_true:
1932
 
1933
	mov [Activate_instrument],1
1934
	mov eax,[ReserveArray]
1935
	mov ecx,60000
1936
	clear_array_konture:
1937
	mov [eax],dword 0
1938
	add eax,4
1939
	dec ecx
1940
	jnz clear_array_line
1941
 
1942
	no_new_konture_xy:
1943
 
1944
	;put saved pixels
1945
	mov ebx,[ReserveArray]
1946
	mov eax,[ebx]
1947
	test eax,eax
1948
	jz no_put_line_to_screen_konture
1949
	mov ecx,[ebx]
1950
	add ebx,4
1951
	xor ebp,ebp
1952
	next_color_put_konture:
1953
	;put saved pixels in ReserveArray
1954
	push ecx
1955
	and [counter2],0
1956
	mov edi,[ebx]
1957
	push edi
1958
	vertical_width_put_konture:
1959
	   and [counter],0
1960
 
1961
	   horizontal_width_put_konture:
1962
	      mov edx,[ebx+4807*4+ebp]
1963
	      and edx,0xffffff
1964
	      mov [edi],dx
1965
	      shr edx,16
1966
	      mov [edi+2],dl
1967
 
1968
	   add edi,3
1969
	   add ebp,4
1970
	   inc [counter]
1971
	   cmp [counter],5
1972
	   jne horizontal_width_put_konture
1973
 
1974
	   mov ecx,[Picture_SizeX]
1975
	   sub ecx,5
1976
	   lea ecx,[ecx+ecx*2]
1977
	   add edi,ecx
1978
	inc [counter2]
1979
	cmp [counter2],5
1980
	jne vertical_width_put_konture
1981
	pop edi
1982
	pop ecx
1983
	add ebx,4
1984
	dec ecx
1985
	jnz next_color_put_konture
1986
 
1987
	no_put_line_to_screen_konture:
1988
 
1989
	;calculate line
1990
	mov ebx,[ReserveArray]
1991
	add ebx,4
1992
	mov eax,[PointerToPicture]
1993
	mov ecx,[Picture_SizeX]
1994
	mov edx,[OldX]
1995
	shl edx,16
1996
	add edx,[OldY]
1997
	mov esi,[ScreenX]
1998
	mov edi,[ScreenY]
1999
	add esi,[PosX]
2000
	add edi,[PosY]
2001
 
2002
	mov ebp,[Picture_SizeX]
2003
	sub ebp,[line_width]
2004
	cmp esi,ebp
2005
	jl no_minimum_x_konture
2006
	mov esi,ebp
2007
	no_minimum_x_konture:
2008
 
2009
	mov ebp,[Picture_SizeY]
2010
	sub ebp,[line_width]
2011
	cmp edi,ebp
2012
	jl no_minimum_y_konture
2013
	mov edi,ebp
2014
	no_minimum_y_konture:
2015
 
2016
	call calculate_line
2017
	;call calculate_rectangle
2018
	mov [counter],eax
2019
 
2020
	;save color pixels in ReserveArray
2021
	mov eax,[counter]
2022
	mov ebx,[ReserveArray]
2023
	mov [ebx],eax
2024
 
2025
	mov ecx,[ebx]
2026
	add ebx,4
2027
 
2028
	xor ebp,ebp
2029
	next_color_save_konture:
2030
	;save color of pixel in ReserveArray
2031
	push ecx
2032
	and [counter2],0
2033
	mov edi,[ebx]
2034
	vertical_width_save_konture:
2035
	   and [counter],0
2036
 
2037
	   horizontal_width_save_konture:
2038
	      mov eax,edi
2039
	      mov edx,[eax]
2040
	      and edx,0xffffff
2041
	      mov [ebx+4807*4+ebp],dx
2042
	      shr edx,16
2043
	      mov [ebx+4807*4+2+ebp],dl
2044
 
2045
	   add edi,3
2046
	   add ebp,4
2047
	   inc [counter]
2048
	   cmp [counter],5
2049
	   jne horizontal_width_save_konture
2050
 
2051
	   mov ecx,[Picture_SizeX]
2052
	   sub ecx,5
2053
	   lea ecx,[ecx+ecx*2]
2054
	   add edi,ecx
2055
	inc [counter2]
2056
	cmp [counter2],5
2057
	jne vertical_width_save_konture
2058
	pop ecx
2059
	add ebx,4
2060
	dec ecx
2061
	jnz next_color_save_konture
2062
 
2063
	;draw calculated pixels on work arrea
2064
	mov ebx,[ReserveArray]
2065
	mov ecx,[ebx]
2066
	mov edx,[Color]
2067
	mov esi,[Color]
2068
	shr edx,16
2069
	add ebx,4
2070
	mov edi,[line_width]
2071
	dec edi
2072
	imul edi,25
2073
	next_pixel_put_konture:
2074
 
2075
	mov eax,[ebx]
2076
	push eax
2077
	push ecx
2078
	xor ebp,ebp
2079
	and [counter2],0
2080
 
2081
	vertical_width_konture:
2082
	   and [counter],0
2083
 
2084
	   horizontal_width_konture:
2085
	   xor ecx,ecx
2086
	   mov cl,byte[width_pixels+edi+ebp]
2087
	   test cl,cl
2088
	     jz no_draw_pixel_konture
2089
	      mov [eax],si
2090
	      mov [eax+2],dl
2091
	     no_draw_pixel_konture:
2092
	   add eax,3
2093
	   inc ebp
2094
	   inc [counter]
2095
	   cmp [counter],5
2096
	   jne horizontal_width_konture
2097
 
2098
	   mov ecx,[Picture_SizeX]
2099
	   sub ecx,5
2100
	   lea ecx,[ecx+ecx*2]
2101
	   add eax,ecx
2102
	inc [counter2]
2103
	cmp [counter2],5
2104
	jne vertical_width_konture
2105
 
2106
	pop ecx
2107
	pop eax
2108
	add ebx,4
2109
	dec ecx
2110
	jnz next_pixel_put_konture
2111
 
2112
	mov eax,[ScreenX]
2113
	mov ebx,[ScreenY]
2114
	add eax,[PosX]
2115
	add ebx,[PosY]
2116
	mov [used_OldX],eax
2117
	mov [used_OldY],ebx
2118
 
2119
	call MovePictureToWorkScreen
2120
 
2121
	jmp still
2122
 
2123
	no_kontur_:
2124
	;************************Draw ellips***********************
2125
	cmp eax,19
2126
	jne no_ellips
2127
 
2128
	mov [Last_instrument],eax
2129
 
2130
	mov al,[Activate_instrument]
2131
	test al,al
2132
	jnz no_new_ellips_xy
2133
	mov eax,[ScreenX]
2134
	mov ebx,[ScreenY]
2135
	add eax,[PosX]
2136
	add ebx,[PosY]
2137
	mov [OldX],eax
2138
	mov [OldY],ebx
2139
	mov [Activate_instrument],1
2140
	mov eax,[ReserveArray]
2141
	mov ecx,60000
2142
	clear_array_ellips:
2143
	mov [eax],dword 0
2144
	add eax,4
2145
	dec ecx
2146
	jnz clear_array_ellips
2147
	jmp still
2148
	no_new_ellips_xy:
2149
 
2150
	;put saved pixels
2151
	mov ebx,[ReserveArray]
2152
	mov eax,[ebx]
2153
	test eax,eax
2154
	jz no_put_line_to_screen_ellips
2155
	mov ecx,[ebx]
2156
	add ebx,4
2157
	xor ebp,ebp
2158
	next_color_put_ellips:
2159
	;put saved pixels in ReserveArray
2160
	push ecx
2161
	and [counter2],0
2162
	mov edi,[ebx]
2163
	push edi
2164
	vertical_width_put_ellips:
2165
	   and [counter],0
2166
 
2167
	   horizontal_width_put_ellips:
2168
	      mov edx,[ebx+4807*4+ebp]
2169
	      and edx,0xffffff
2170
	      mov [edi],dx
2171
	      shr edx,16
2172
	      mov [edi+2],dl
2173
 
2174
	   add edi,3
2175
	   add ebp,4
2176
	   inc [counter]
2177
	   cmp [counter],5
2178
	   jne horizontal_width_put_ellips
2179
 
2180
	   mov ecx,[Picture_SizeX]
2181
	   sub ecx,5
2182
	   lea ecx,[ecx+ecx*2]
2183
	   add edi,ecx
2184
	inc [counter2]
2185
	cmp [counter2],5
2186
	jne vertical_width_put_ellips
2187
	pop edi
2188
	pop ecx
2189
	add ebx,4
2190
	dec ecx
2191
	jnz next_color_put_ellips
2192
 
2193
	no_put_line_to_screen_ellips:
2194
 
2195
	mov esi,[ScreenX]
2196
	mov edi,[ScreenY]
2197
	add esi,[PosX]
2198
	add edi,[PosY]
2199
 
2200
	sub esi,[OldX]
2201
	jns no_sign_x_ellips
2202
	neg esi
2203
	shr esi,1
2204
	neg esi
2205
	add esi,[OldX]
2206
	jmp no_plus_sign_x_ellips
2207
	no_sign_x_ellips:
2208
 
2209
	shr esi,1
2210
	add esi,[OldX]
2211
	no_plus_sign_x_ellips:
2212
 
2213
	sub edi,[OldY]
2214
	jns no_sign_y_ellips
2215
	neg edi
2216
	shr edi,1
2217
	neg edi
2218
	add edi,[OldY]
2219
	jmp no_plus_sign_y_ellips
2220
	no_sign_y_ellips:
2221
 
2222
	shr edi,1
2223
	add edi,[OldY]
2224
	no_plus_sign_y_ellips:
2225
 
2226
	mov [x],esi
2227
	mov [y],edi
2228
 
2229
	mov esi,[ScreenX]
2230
	mov edi,[ScreenY]
2231
	add esi,[PosX]
2232
	add edi,[PosY]
2233
 
2234
	sub esi,[OldX]
2235
	jns no_sign_x_ellips_r
2236
	neg esi
2237
	no_sign_x_ellips_r:
2238
 
2239
	sub edi,[OldY]
2240
	jns no_sign_y_ellips_r
2241
	neg edi
2242
	no_sign_y_ellips_r:
2243
 
2244
	cmp edi,0
2245
	jnz no_null_a_ellips
2246
	mov edi,1
2247
	no_null_a_ellips:
2248
 
2249
	shr esi,1
2250
	shr edi,1
2251
	mov [a_ellips],esi
2252
	mov [b_ellips],edi
2253
 
2254
	mov edi,[x]
2255
	mov ebp,[y]
2256
	add edi,esi
2257
	add ebp,esi
2258
 
2259
	mov edx,[Picture_SizeX]
2260
	sub edx,[line_width]
2261
	cmp edi,edx
2262
	jl no_limit_x_ellips
2263
	sub edi,edx
2264
	sub [a_ellips],edi
2265
	no_limit_x_ellips:
2266
 
2267
	mov edx,[Picture_SizeY]
2268
	sub edx,[line_width]
2269
	cmp ebp,edx
2270
	jl no_limit_y_ellips
2271
	sub ebp,edx
2272
	sub [b_ellips],ebp
2273
	no_limit_y_ellips:
2274
 
2275
 
2276
	mov edi,[x]
2277
	mov ebp,[y]
2278
 
2279
	sub edi,[a_ellips]
2280
	jns no_minimum_x_ellips
2281
	add [a_ellips],edi
2282
	no_minimum_x_ellips:
2283
 
2284
	sub ebp,[b_ellips]
2285
	jns no_minimum_y_ellips
2286
	add [b_ellips],ebp
2287
	no_minimum_y_ellips:
2288
 
2289
	;calculate circle
2290
	mov ebx,[ReserveArray]
2291
	add ebx,4
2292
	mov eax,[PointerToPicture]
2293
	mov ecx,[Picture_SizeX]
2294
	mov edx,[x]
2295
	shl edx,16
2296
	add edx,[y]
2297
	mov esi,[a_ellips]
2298
	shl esi,16
2299
	add esi,[b_ellips]
2300
	call calculate_ellips
2301
 
2302
	mov [counter],eax
2303
 
2304
	;save color pixels in ReserveArray
2305
	mov eax,[counter]
2306
	mov ebx,[ReserveArray]
2307
	mov [ebx],eax
2308
 
2309
	mov ecx,[ebx]
2310
	add ebx,4
2311
 
2312
	xor ebp,ebp
2313
	next_color_save_ellips:
2314
	;save color of pixel in ReserveArray
2315
	push ecx
2316
	and [counter2],0
2317
	mov edi,[ebx]
2318
	vertical_width_save_ellips:
2319
	   and [counter],0
2320
 
2321
	   horizontal_width_save_ellips:
2322
	      mov eax,edi
2323
	      mov edx,[eax]
2324
	      and edx,0xffffff
2325
	      mov [ebx+4807*4+ebp],dx
2326
	      shr edx,16
2327
	      mov [ebx+4807*4+2+ebp],dl
2328
 
2329
	   add edi,3
2330
	   add ebp,4
2331
	   inc [counter]
2332
	   cmp [counter],5
2333
	   jne horizontal_width_save_ellips
2334
 
2335
	   mov ecx,[Picture_SizeX]
2336
	   sub ecx,5
2337
	   lea ecx,[ecx+ecx*2]
2338
	   add edi,ecx
2339
	inc [counter2]
2340
	cmp [counter2],5
2341
	jne vertical_width_save_ellips
2342
	pop ecx
2343
	add ebx,4
2344
	dec ecx
2345
	jnz next_color_save_ellips
2346
 
2347
	;draw calculated pixels on work arrea
2348
	mov ebx,[ReserveArray]
2349
	mov ecx,[ebx]
2350
	mov edx,[Color]
2351
	mov esi,[Color]
2352
	shr edx,16
2353
	add ebx,4
2354
	mov edi,[line_width]
2355
	dec edi
2356
	imul edi,25
2357
	next_pixel_put_ellips:
2358
 
2359
	mov eax,[ebx]
2360
	push eax
2361
	push ecx
2362
	xor ebp,ebp
2363
	and [counter2],0
2364
 
2365
	vertical_width_ellips:
2366
	   and [counter],0
2367
 
2368
	   horizontal_width_ellips:
2369
	   xor ecx,ecx
2370
	   mov cl,byte[width_pixels+edi+ebp]
2371
	   test cl,cl
2372
	     jz no_draw_pixel_ellips
2373
	      mov [eax],si
2374
	      mov [eax+2],dl
2375
	     no_draw_pixel_ellips:
2376
	   add eax,3
2377
	   inc ebp
2378
	   inc [counter]
2379
	   cmp [counter],5
2380
	   jne horizontal_width_ellips
2381
 
2382
	   mov ecx,[Picture_SizeX]
2383
	   sub ecx,5
2384
	   lea ecx,[ecx+ecx*2]
2385
	   add eax,ecx
2386
	inc [counter2]
2387
	cmp [counter2],5
2388
	jne vertical_width_ellips
2389
 
2390
	pop ecx
2391
	pop eax
2392
	add ebx,4
2393
	dec ecx
2394
	jnz next_pixel_put_ellips
2395
 
2396
	call MovePictureToWorkScreen
2397
	jmp still
2398
	no_ellips:
2399
 
2400
 
2401
	jmp still
2402
	ret