Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
6354 IgorA 1
macro square_width_put
2
{
3
local .no_put_to_screen
4
local .next_color_put
5
local .vertical_width_put
6
local .horizontal_width_put
7
 
8
	mov ebx,[ReserveArray]
9
	mov eax,[ebx]
10
	test eax,eax
11
	jz .no_put_to_screen
12
	mov ecx,[ebx]
13
	add ebx,4
14
	xor ebp,ebp
15
 
16
	.next_color_put:
17
	;put saved pixels in ReserveArray
18
	push ecx
19
	mov [counter2],5
20
	mov edi,[ebx]
21
	push edi
22
	.vertical_width_put:
23
		mov [counter],5
24
 
25
		.horizontal_width_put:
26
			mov edx,[ebx+4807*4+ebp]
27
			;and edx,0xffffff
28
			mov [edi],dx
29
			shr edx,16
30
			mov [edi+2],dl
31
 
32
		add edi,3
33
		add ebp,4
34
		dec [counter]
35
		jnz .horizontal_width_put
36
 
37
		mov ecx,[Picture_SizeX]
38
		sub ecx,5
39
		lea ecx,[ecx+ecx*2]
40
		add edi,ecx
41
	dec [counter2]
42
	jnz .vertical_width_put
43
	pop edi
44
	pop ecx
45
 
46
	add ebx,4
47
	dec ecx
48
	jnz .next_color_put
49
 
50
	.no_put_to_screen:
51
}
52
 
53
macro square_width_save
54
{
55
local .next_color_save
56
local .vertical_width_save
57
local .horizontal_width_save
58
	mov ebx,[ReserveArray]
59
	mov [ebx],eax
60
	mov ecx,eax
61
	add ebx,4
62
	xor ebp,ebp
63
 
64
	.next_color_save:
65
	;save color of pixel in ReserveArray
66
	push ecx
67
	mov [counter2],5
68
	mov edi,[ebx]
69
	.vertical_width_save:
70
		mov [counter],5
71
 
72
		.horizontal_width_save:
73
			mov eax,edi
74
			mov edx,[eax]
75
			;and edx,0xffffff
76
			mov [ebx+4807*4+ebp],dx
77
			shr edx,16
78
			mov [ebx+4807*4+2+ebp],dl
79
 
80
		add edi,3
81
		add ebp,4
82
		dec [counter]
83
		jnz .horizontal_width_save
84
 
85
		mov ecx,[Picture_SizeX]
86
		sub ecx,5
87
		lea ecx,[ecx+ecx*2]
88
		add edi,ecx
89
	dec [counter2]
90
	jnz .vertical_width_save
91
	pop ecx
92
 
93
	add ebx,4
94
	dec ecx
95
	jnz .next_color_save
96
}
97
 
6355 IgorA 98
macro draw_calc_pixels brush
99
{
100
local .next_pixel_put
101
local .vertical_width
102
local .horizontal_width
103
local .no_draw_pixel
104
 
105
	mov ebx,[ReserveArray]
106
	mov ecx,[ebx]
107
	mov edx,[Color]
108
	mov esi,[Color]
109
	shr edx,16
110
	add ebx,4
111
	mov edi,[line_width]
112
	dec edi
113
	imul edi,25
114
	add edi,brush
115
	.next_pixel_put:
116
 
117
	mov eax,[ebx]
118
	push eax
119
	push ecx
120
	xor ebp,ebp
121
	mov [counter2],5
122
 
123
	.vertical_width:
124
		mov [counter],5
125
 
126
		.horizontal_width:
127
		xor ecx,ecx
128
		mov cl,byte[edi+ebp]
129
		test cl,cl
130
		jz .no_draw_pixel
131
			mov [eax],si
132
			mov [eax+2],dl
133
		.no_draw_pixel:
134
		add eax,3
135
		inc ebp
136
		dec [counter]
137
		jnz .horizontal_width
138
 
139
		mov ecx,[Picture_SizeX]
140
		sub ecx,5
141
		lea ecx,[ecx+ecx*2]
142
		add eax,ecx
143
	dec [counter2]
144
	jnz .vertical_width
145
 
146
	pop ecx
147
	pop eax
148
	add ebx,4
149
	dec ecx
150
	jnz .next_pixel_put
151
}
152
 
255 heavyiron 153
;-----------------------------------------------------------
154
;-----instruments of panel(icon's instruments)--------------
155
;-----------------------------------------------------------
156
TakeButtonInstruments:
157
 
158
	mov eax,[Current_instrument]
159
 
160
	;*************************brush 1***********************
161
	cmp eax,40
162
	jne no_brush1
163
 
164
	mov [Brush_SizeX],4
165
	mov [Brush_SizeY],4
166
	mov [Number_Brush],0
167
	mov ebx,[Last_instrument]
168
	mov [Current_instrument],ebx
169
 
170
	mov [line_width],1
171
 
172
	jmp still
173
	no_brush1:
174
 
175
	;*************************brush 2***********************
176
	cmp eax,41
177
	jne no_brush2
178
 
179
	mov [Brush_SizeX],6
180
	mov [Brush_SizeY],4
181
	mov [Number_Brush],1
182
	mov ebx,[Last_instrument]
183
	mov [Current_instrument],ebx
184
 
185
	mov [line_width],2
186
 
187
	jmp still
188
	no_brush2:
189
 
190
	;*************************brush 3***********************
191
	cmp eax,42
192
	jne no_brush3
193
 
194
	mov [Brush_SizeX],8
195
	mov [Brush_SizeY],7
196
	mov [Number_Brush],2
197
	mov ebx,[Last_instrument]
198
	mov [Current_instrument],ebx
199
 
200
	mov [line_width],3
201
 
202
	jmp still
203
	no_brush3:
204
 
6354 IgorA 205
	;*************************brush 4***********************
255 heavyiron 206
	cmp eax,43
207
	jne no_brush4
208
 
209
	mov [Brush_SizeX],14
210
	mov [Brush_SizeY],14
211
	mov [Number_Brush],3
212
	mov ebx,[Last_instrument]
213
	mov [Current_instrument],ebx
214
 
215
	mov [line_width],4
216
 
217
	jmp still
218
	no_brush4:
219
 
6354 IgorA 220
	;*************************brush 5***********************
255 heavyiron 221
	cmp eax,44
222
	jne no_brush5
223
 
224
	mov [Brush_SizeX],6
225
	mov [Brush_SizeY],6
226
	mov [Number_Brush],4
227
	mov ebx,[Last_instrument]
228
	mov [Current_instrument],ebx
229
 
230
	mov [line_width],5
231
 
232
	jmp still
233
	no_brush5:
234
 
235
	;*************************pensil************************
236
	cmp eax,10
237
	jne no_pensil
238
 
239
	mov al,[exit_from_work_arrea]
240
 
241
	test al,al
242
	jz no_exit_from_work_arrea
243
 
244
	and [Activate_instrument],0
245
	and [exit_from_work_arrea],0
246
 
247
	no_exit_from_work_arrea:
248
 
249
	mov al,[Activate_instrument]
250
 
251
	test al,al
252
	jnz no_activated_later
253
 
254
	call GetScreenCordinats
255
	mov eax,[ScreenX]
256
	mov ebx,[ScreenY]
257
	add eax,[PosX]
258
	add ebx,[PosY]
259
	mov [OldX],eax
260
	mov [OldY],ebx
261
 
262
	no_activated_later:
263
 
6352 IgorA 264
;	mov eax,[MaxWorkScreen_SizeX] ???
265
;	mov ebx,[MaxWorkScreen_SizeY] ???
255 heavyiron 266
 
267
	mov eax,[PointerToPicture]
268
	mov ebx,[ReserveArray]
269
	mov ecx,[Picture_SizeX]
270
	mov edx,[OldX]
271
	shl edx,16
272
	add edx,[OldY]
273
	mov esi,[ScreenX]
274
	mov edi,[ScreenY]
275
	add esi,[PosX]
276
	add edi,[PosY]
277
	call calculate_line
278
 
279
	mov ecx,eax
280
	mov edx,[Color]
281
	mov esi,[Color]
282
	shr edx,16
283
	xor ebx,ebx
284
	mov eax,[ReserveArray]
285
 
286
	pensil_next_pixel_draw:
287
 
288
	  mov ebx,[eax]
289
	  mov [ebx],si
290
	  mov [ebx+2],dl
291
	  add eax,4
292
 
293
	dec ecx
294
	jnz pensil_next_pixel_draw
295
 
296
	mov eax,[ScreenX]
297
	mov ebx,[ScreenY]
298
	add eax,[PosX]
299
	add ebx,[PosY]
300
	mov [OldX],eax
301
	mov [OldY],ebx
302
 
303
	call MovePictureToWorkScreen
304
	mov [Activate_instrument],1
305
	jmp still
306
	no_pensil:
307
 
6354 IgorA 308
	;*************************pipetka***********************
255 heavyiron 309
	cmp eax,15
310
	jne no_pipetka
311
 
312
	mov eax,[ScreenY]
313
	mov ebx,[Picture_SizeX]
314
	add eax,[PosY]
315
	imul eax,ebx
316
	add eax,[ScreenX]
317
	add eax,[PosX]
318
	lea eax,[eax+eax*2]
319
	add eax,[PointerToPicture]
320
	mov ebx,[eax]
321
	and ebx,0xffffff
322
	mov [Color],ebx
323
 
6342 IgorA 324
	mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color]
255 heavyiron 325
 
326
	jmp still
327
	no_pipetka:
328
 
6354 IgorA 329
	;*************************draw brush********************
255 heavyiron 330
	cmp eax,11
331
	jne no_brush
332
 
333
	mov [Last_instrument],eax
334
 
335
	jmp no_lastik_
336
 
337
	lastik_in:
338
	mov eax,[Color]
339
	mov [SColor],eax
340
	mov [Color],0xffffff
341
	no_lastik_:
342
 
343
	mov eax,[ScreenX]
344
	mov ebx,[ScreenY]
345
	mov ecx,[Brush_SizeX]
346
	mov edx,[Brush_SizeY]
347
	add eax,[PosX]
348
	add ebx,[PosY]
349
	add eax,ecx
350
	add ebx,edx
351
 
352
	cmp eax,[Picture_SizeX]
353
	jl no_max_pos_x
354
	mov eax,[Picture_SizeX]
355
	no_max_pos_x:
356
 
357
	cmp ebx,[Picture_SizeY]
358
	jl no_max_pos_y
359
	mov ebx,[Picture_SizeY]
360
	no_max_pos_y:
361
 
362
	cmp eax,ecx
363
	ja no_min_pos_x
364
	mov eax,[Brush_SizeX]
365
	no_min_pos_x:
366
 
367
	cmp ebx,edx
368
	ja no_min_pos_y
369
	mov ebx,[Brush_SizeY]
370
	no_min_pos_y:
371
 
372
	sub eax,[Brush_SizeX]
373
	sub ebx,[Brush_SizeY]
374
 
375
	mov [x],eax
376
	mov [y],ebx
377
 
378
	mov al,[exit_from_work_arrea]
379
	test al,al
380
	jz no_exit_from_work_arrea_brush
381
	and [Activate_instrument],0
382
	and [exit_from_work_arrea],0
383
	no_exit_from_work_arrea_brush:
384
 
385
	mov al,[Activate_instrument]
386
	test al,al
387
	jnz no_new_brush_xy
388
	mov eax,[x]
389
	mov ebx,[y]
390
	mov [OldX],eax
391
	mov [OldY],ebx
392
	mov [Activate_instrument],1
393
	no_new_brush_xy:
394
 
395
	mov eax,[PointerToPicture]
396
	mov ebx,[ReserveArray]
397
	add ebx,4
398
	mov ecx,[Picture_SizeX]
399
	mov edx,[OldX]
400
	shl edx,16
401
	add edx,[OldY]
402
	mov esi,[x]
403
	mov edi,[y]
404
 
405
	call calculate_line
406
 
407
	mov ebx,[ReserveArray]
408
	mov [ebx],eax
409
 
410
	;procedure drawing of brush
411
	mov ebx,[ReserveArray]
412
	mov ecx,[ebx]
413
	mov edx,[Color]
414
	mov esi,[Color]
415
	shr edx,16
416
	add ebx,4
417
	mov edi,[Number_Brush]
418
	imul edi,20*20
419
 
420
	next_pixel_put_brush:
421
 
422
	mov eax,[ebx]
423
	push eax
424
	push ecx
425
	xor ebp,ebp
426
	and [counter2],0
427
 
428
	vertical_width_brush:
429
	   and [counter],0
430
 
431
	   horizontal_width_brush:
432
	   xor ecx,ecx
433
	   mov cl,byte[Brush_color+edi+ebp]
434
	   test cl,cl
435
	     jz no_draw_pixel_brush
436
	      mov [eax],si
437
	      mov [eax+2],dl
438
	     no_draw_pixel_brush:
439
	   add eax,3
440
	   inc ebp
441
	   inc [counter]
442
	   cmp [counter],20
443
	   jne horizontal_width_brush
444
 
445
	   mov ecx,[Picture_SizeX]
446
	   sub ecx,20
447
	   lea ecx,[ecx+ecx*2]
448
	   add eax,ecx
449
	inc [counter2]
450
	cmp [counter2],20
451
	jne vertical_width_brush
452
 
453
	pop ecx
454
	pop eax
455
	add ebx,4
456
	dec ecx
457
	jnz next_pixel_put_brush
458
 
459
	mov eax,[x]
460
	mov ebx,[y]
461
	mov [OldX],eax
462
	mov [OldY],ebx
463
 
464
	mov al,[lastik_is_active]
465
	test al,al
466
	jz no_lastik_active
467
 
468
	mov eax,[SColor]
469
	mov [Color],eax
470
	and [lastik_is_active],0
471
	no_lastik_active:
472
 
473
	call MovePictureToWorkScreen
474
	mov eax,[Current_instrument]
475
	mov [Last_instrument],eax
476
 
477
	jmp still
478
	no_brush:
479
 
6354 IgorA 480
	;************************Flood Fill*********************
255 heavyiron 481
	cmp eax,14
482
	jne no_FloodFill
483
 
484
	mov eax,[PointerToPicture]
485
	mov ebx,[PointerToEditBufer]
486
 
487
	mov ecx,[Picture_SizeX]
488
	imul ecx,[Picture_SizeY]
489
	lea ecx,[ecx+ecx*2]
490
	shl ecx,1
491
 
6342 IgorA 492
	cmp ecx,mem_flood_f
255 heavyiron 493
	ja normal_size_of_bufer
494
 
495
	mov ebx,[ReserveArray]
496
 
497
	normal_size_of_bufer:
498
 
499
	add ebx,4
500
	mov ecx,[Picture_SizeX]
501
	mov edx,[ScreenX]
502
	add edx,[PosX]
503
	shl edx,16
504
	add edx,[ScreenY]
505
	add edx,[PosY]
506
	mov esi,[Picture_SizeX]
507
	dec esi
508
	shl esi,16
509
	add esi,[Picture_SizeY]
510
	dec esi
511
	mov edi,[Color]
512
 
513
	call flood_fill
514
	call MovePictureToWorkScreen
515
 
516
	jmp still
517
	no_FloodFill:
518
 
519
	;************************lastik*************************
520
	cmp eax,13
521
	jne no_lastik
522
 
523
	 mov [Last_instrument],eax
524
	 mov [lastik_is_active],1
525
	jmp lastik_in
526
 
527
	no_lastik:
528
 
6354 IgorA 529
	;*******************************************************
255 heavyiron 530
	cmp eax,12
531
	jne  no_spray
532
 
533
	cmp [Activate_instrument],0
534
	jne no_null_spray
535
	mov [Activate_instrument],1
536
	jmp still
537
	no_null_spray:
538
 
539
	mov eax,[ScreenX]
540
	mov ebx,[ScreenY]
541
	mov ecx,[Brush_SizeX]
542
	mov edx,[Brush_SizeY]
543
	add eax,[PosX]
544
	add ebx,[PosY]
545
	add eax,ecx
546
	add ebx,edx
547
 
548
	cmp eax,[Picture_SizeX]
549
	jl no_max_pos_x_spray
550
	mov eax,[Picture_SizeX]
551
	no_max_pos_x_spray:
552
 
553
	cmp ebx,[Picture_SizeY]
554
	jl no_max_pos_y_spray
555
	mov ebx,[Picture_SizeY]
556
	no_max_pos_y_spray:
557
 
558
	cmp eax,ecx
559
	ja no_min_pos_x_spray
560
	mov eax,[Brush_SizeX]
561
	no_min_pos_x_spray:
562
 
563
	cmp ebx,edx
564
	ja no_min_pos_y_spray
565
	mov ebx,[Brush_SizeY]
566
	no_min_pos_y_spray:
567
 
568
	sub eax,[Brush_SizeX]
569
	sub ebx,[Brush_SizeY]
570
	mov edi,0;[Number_Brush]
571
	imul edi,20*20
572
 
573
	mov [x],eax
574
	mov [y],ebx
575
	mov ebp,[Picture_SizeX]
576
	xor edx,edx
577
	brush_y_spray:
578
	  xor ecx,ecx
579
	  brush_x_spray:
580
	   ;calculate position in array of spray
581
	   mov esi,edx
582
	   lea esi,[esi+esi*4] ;esi=esi*5
583
	   shl esi,2	       ;esi=(esi*3)*4
584
	   add esi,ecx
585
	   add esi,edi
586
	   ;read byte from array
587
	   xor eax,eax
588
	   mov al,[Spray_color+esi]
589
	   test eax,eax
590
	   jz no_color_spray
591
	   mov eax,[x]
592
	   mov ebx,[y]
593
	   add eax,ecx
594
	   add ebx,edx
595
	   imul ebx,ebp; ebp=[Picture_SizeX]
596
	   add eax,ebx
597
	   lea eax,[eax+eax*2]
598
	   add eax,[PointerToPicture]
599
	   mov ebx,[Color]
600
	   mov [eax],bx
601
	   shr ebx,16
602
	   mov [eax+2],bl
603
	   no_color_spray:
604
	   inc ecx
605
	   cmp ecx,20
606
	  jl brush_x_spray
607
	inc edx
608
	cmp edx,20
609
	jl brush_y_spray
610
 
611
	call MovePictureToWorkScreen
612
	jmp still
613
 
614
	no_spray:
615
 
6354 IgorA 616
	;************************palette************************
255 heavyiron 617
	cmp eax,51
618
	jne no_palette
619
 
620
	mov eax,20
621
	mov ebx,100
622
	mov ecx,32*10+32*5+7
623
	mov edx,8*10+7*10
624
	mov  esi,1
625
	call draw_volume_rectangle
626
	mov [x],20+5
627
	mov [y],100+10
628
	mov edi,256
629
	xor esi,esi
630
	next_rectangle:
631
	mov ebx,[x]
632
	mov ecx,[y]
633
	mov edx,[palitra+esi]
634
	and edx,0xffffff
635
	shl ebx,16
636
	shl ecx,16
637
	add ebx,13
638
	add ecx,13
6342 IgorA 639
	mcall SF_DRAW_RECT
255 heavyiron 640
	add [x],15
641
	cmp [x],20+15*32
642
	jl no_new_line
643
	mov [x],20+5
644
	add [y],15
645
	no_new_line:
646
	add esi,4
647
	dec edi
648
	jnz next_rectangle
649
 
650
	wait_events:
651
	call event
652
 
653
	cmp eax,1
654
	je still
655
 
656
	cmp eax,2
657
	jne no_keys
658
 
6342 IgorA 659
	mcall SF_GET_KEY
255 heavyiron 660
 
661
	no_keys:
662
 
663
	cmp eax,3
664
	jne no_buttons
6342 IgorA 665
	mcall SF_GET_BUTTON
255 heavyiron 666
 
667
	no_buttons:
668
 
669
	cmp eax,6
670
	jne wait_events
671
 
672
	call GetMouseClick
673
 
674
	test eax,eax
675
	jz wait_events
676
	call GetMouseCoordinats
677
	mov [x],20+5
678
	mov [y],100+10
679
	mov [counter],0
680
	next_rectangle_column:
681
	mov eax,[x]
682
	mov ebx,[y]
683
	mov ecx,[MouseX]
684
	mov edx,[MouseY]
685
	mov esi,13
686
	mov edi,13
687
	call columnus
688
	test eax,eax
689
	jz no_columnus_color
690
 
691
	mov eax,[counter]
692
	shl eax,2
693
	mov ebx,[palitra+eax]
694
	and ebx,0xffffff
695
	mov [Color],ebx
696
	no_columnus_color:
697
 
698
	add [x],15
699
 
700
	cmp [x],20+15*32
701
	jl no_new_line_column
702
 
703
	mov [x],20+5
704
	add [y],15
705
	no_new_line_column:
706
 
707
	inc [counter]
708
 
709
	cmp [counter],257
710
	jne next_rectangle_column
711
 
6342 IgorA 712
	mcall SF_SLEEP,10
255 heavyiron 713
 
714
	call drawwin
715
 
716
	mov eax,[Last_instrument]
717
	mov [Current_instrument],eax
718
 
719
	jmp still
720
	no_palette:
721
 
722
	;************************draw line**********************
723
	cmp eax,16
724
	jne no_line
725
 
726
	mov [Last_instrument],eax
727
 
728
	mov al,[Activate_instrument]
729
	test al,al
730
	jnz no_new_line_xy
731
	mov eax,[ScreenX]
732
	mov ebx,[ScreenY]
733
	add eax,[PosX]
734
	add ebx,[PosY]
735
	mov [OldX],eax
736
	mov [OldY],ebx
737
	mov [Activate_instrument],1
6342 IgorA 738
	xor eax,eax
739
	mov ecx,mem_flood_f/4
740
	mov edi,[ReserveArray]
741
	rep stosd
255 heavyiron 742
	jmp still
743
	no_new_line_xy:
744
 
745
	;put saved pixels
6354 IgorA 746
	square_width_put
255 heavyiron 747
 
748
	;calculate line
749
	mov ebx,[ReserveArray]
750
	add ebx,4
751
	mov eax,[PointerToPicture]
752
	mov ecx,[Picture_SizeX]
753
	mov edx,[OldX]
754
	shl edx,16
755
	add edx,[OldY]
756
	mov esi,[ScreenX]
757
	mov edi,[ScreenY]
758
	add esi,[PosX]
759
	add edi,[PosY]
760
 
761
	mov ebp,[Picture_SizeX]
762
	sub ebp,[line_width]
763
	cmp esi,ebp
764
	jl no_minimum_x_line
765
	mov esi,ebp
766
	no_minimum_x_line:
767
 
768
	mov ebp,[Picture_SizeY]
769
	sub ebp,[line_width]
770
	cmp edi,ebp
771
	jl no_minimum_y_line
772
	mov edi,ebp
773
	no_minimum_y_line:
774
 
775
	call calculate_line
776
 
777
	;save color pixels in ReserveArray
6354 IgorA 778
	square_width_save
255 heavyiron 779
 
780
	;draw calculated pixels on work arrea
6355 IgorA 781
	draw_calc_pixels width_pixels
255 heavyiron 782
 
783
	call MovePictureToWorkScreen
784
	jmp still
785
	no_line:
786
 
6354 IgorA 787
	;************************draw rectangle*****************
255 heavyiron 788
	cmp eax,17
789
	jne no_rectangle
790
 
791
	mov [Last_instrument],eax
792
 
793
	mov al,[Activate_instrument]
794
	test al,al
795
	jnz no_new_rectangle_xy
796
	mov eax,[ScreenX]
797
	mov ebx,[ScreenY]
798
	add eax,[PosX]
799
	add ebx,[PosY]
800
	mov [OldX],eax
801
	mov [OldY],ebx
802
	mov [Activate_instrument],1
6342 IgorA 803
	xor eax,eax
804
	mov ecx,mem_flood_f/4
805
	mov edi,[ReserveArray]
806
	rep stosd
255 heavyiron 807
	jmp still
808
	no_new_rectangle_xy:
809
 
810
	;put saved pixels
6354 IgorA 811
	square_width_put
255 heavyiron 812
 
813
	;calculate line
814
	mov ebx,[ReserveArray]
815
	add ebx,4
816
	mov eax,[PointerToPicture]
817
	mov ecx,[Picture_SizeX]
818
	mov edx,[OldX]
819
	shl edx,16
820
	add edx,[OldY]
821
	mov esi,[ScreenX]
822
	mov edi,[ScreenY]
823
	add esi,[PosX]
824
	add edi,[PosY]
825
 
826
	mov ebp,[Picture_SizeX]
827
	sub ebp,[line_width]
828
	cmp esi,ebp
829
	jl no_minimum_x_rectangle
830
	mov esi,ebp
831
	no_minimum_x_rectangle:
832
 
833
	mov ebp,[Picture_SizeY]
834
	sub ebp,[line_width]
835
	cmp edi,ebp
836
	jl no_minimum_y_rectangle
837
	mov edi,ebp
838
	no_minimum_y_rectangle:
839
 
840
	call calculate_rectangle
841
 
842
	;save color pixels in ReserveArray
6354 IgorA 843
	square_width_save
255 heavyiron 844
 
845
	;draw calculated pixels on work arrea
6355 IgorA 846
	draw_calc_pixels width_pixels_rectangle
255 heavyiron 847
 
848
	call MovePictureToWorkScreen
849
	jmp still
850
	no_rectangle:
851
 
6354 IgorA 852
	;************************draw circle********************
255 heavyiron 853
	cmp eax,18
854
	jne no_circle
855
 
856
	mov [Last_instrument],eax
857
 
858
	mov al,[Activate_instrument]
859
	test al,al
860
	jnz no_new_circle_xy
861
	mov eax,[ScreenX]
862
	mov ebx,[ScreenY]
863
	add eax,[PosX]
864
	add ebx,[PosY]
865
	mov [OldX],eax
866
	mov [OldY],ebx
867
	mov [Activate_instrument],1
6342 IgorA 868
	xor eax,eax
869
	mov ecx,mem_flood_f/4
870
	mov edi,[ReserveArray]
871
	rep stosd
255 heavyiron 872
	jmp still
873
	no_new_circle_xy:
874
 
875
	;put saved pixels
6354 IgorA 876
	square_width_put
255 heavyiron 877
 
878
	mov esi,[ScreenX]
879
	mov edi,[ScreenY]
880
	add esi,[PosX]
881
	add edi,[PosY]
882
 
883
	sub esi,[OldX]
884
	jns no_sign_x_circle
885
	neg esi
886
	shr esi,1
887
	neg esi
888
	add esi,[OldX]
889
	jmp no_plus_sign_x_circle
890
	no_sign_x_circle:
891
 
892
	shr esi,1
893
	add esi,[OldX]
894
	no_plus_sign_x_circle:
895
 
896
	sub edi,[OldY]
897
	jns no_sign_y_circle
898
	neg edi
899
	shr edi,1
900
	neg edi
901
	add edi,[OldY]
902
	jmp no_plus_sign_y_circle
903
	no_sign_y_circle:
904
 
905
	shr edi,1
906
	add edi,[OldY]
907
	no_plus_sign_y_circle:
908
 
909
	mov [x],esi
910
	mov [y],edi
911
 
912
	mov esi,[ScreenX]
913
	mov edi,[ScreenY]
914
	add esi,[PosX]
915
	add edi,[PosY]
916
 
917
	sub esi,[OldX]
918
	jns no_sign_x_circle_r
919
	neg esi
920
	no_sign_x_circle_r:
921
 
922
	sub edi,[OldY]
923
	jns no_sign_y_circle_r
924
	neg edi
925
	no_sign_y_circle_r:
926
 
927
	mov [Dx_],esi
928
	mov [Dy_],edi
929
 
930
	;finit
931
	fild [Dx_]
932
	fmul st0,st0
933
	fild [Dy_]
934
	fmul st0,st0
935
	fadd st0,st1
936
	fsqrt
937
	fistp [Radius]
938
	fistp [Icon_X]
939
	mov esi,[Radius]
940
	shr esi,1
941
	cmp esi,0
942
	jne no_null_radius
943
	mov [Radius],1
944
	no_null_radius:
945
 
946
	mov [Radius],esi
947
 
948
	mov edi,[x]
949
	mov ebp,[y]
950
	add edi,esi
951
	add ebp,esi
952
 
953
	mov edx,[Picture_SizeX]
954
	sub edx,[line_width]
955
	cmp edi,edx
956
	jl no_limit_x_circle
957
	sub edi,edx
958
	sub [Radius],edi
959
	no_limit_x_circle:
960
 
961
	mov edx,[Picture_SizeY]
962
	sub edx,[line_width]
963
	cmp ebp,edx
964
	jl no_limit_y_circle
965
	sub ebp,edx
966
	sub [Radius],ebp
967
	no_limit_y_circle:
968
 
969
 
970
	mov edi,[x]
971
	mov ebp,[y]
972
 
973
	sub edi,[Radius]
974
	jns no_minimum_x_circle
975
	add [Radius],edi
976
	no_minimum_x_circle:
977
 
978
	sub ebp,[Radius]
979
	jns no_minimum_y_circle
980
	add [Radius],ebp
981
	no_minimum_y_circle:
982
 
983
	;calculate circle
984
	mov ebx,[ReserveArray]
985
	add ebx,4
986
	mov eax,[PointerToPicture]
987
	mov ecx,[Picture_SizeX]
988
	mov edx,[x]
989
	shl edx,16
990
	add edx,[y]
991
	mov esi,[Radius]
992
	call calculate_circle
993
 
994
	;save color pixels in ReserveArray
6354 IgorA 995
	square_width_save
255 heavyiron 996
 
997
	;draw calculated pixels on work arrea
6355 IgorA 998
	draw_calc_pixels width_pixels
255 heavyiron 999
 
1000
	call MovePictureToWorkScreen
1001
	jmp still
1002
	no_circle:
1003
 
1004
	;************************zoom 1*************************
1005
	cmp eax,45
1006
	jne no_1_
1007
	mov [k],1
6357 IgorA 1008
	call scrollbar_move_00
255 heavyiron 1009
	and [Current_instrument],0
1010
	call drawwin
1011
	jmp still
1012
	no_1_:
1013
 
6354 IgorA 1014
	;************************zoom 2*************************
255 heavyiron 1015
	cmp eax,46
1016
	jne no_2_
1017
	mov [k],2
1018
	call drawwin
6357 IgorA 1019
	call scrollbar_move_00
255 heavyiron 1020
	and [Current_instrument],0
1021
	jmp still
1022
	no_2_:
1023
 
1024
 
6354 IgorA 1025
	;************************zoom 3*************************
255 heavyiron 1026
	cmp eax,47
1027
	jne no_3_
1028
	mov [k],3
1029
	call drawwin
6357 IgorA 1030
	call scrollbar_move_00
255 heavyiron 1031
	and [Current_instrument],0
1032
	jmp still
1033
	no_3_:
1034
 
6354 IgorA 1035
	;************************zoom 4*************************
255 heavyiron 1036
	cmp eax,48
1037
	jne no_4_
1038
	mov [k],4
1039
	call drawwin
6357 IgorA 1040
	call scrollbar_move_00
255 heavyiron 1041
	and [Current_instrument],0
1042
	jmp still
1043
	no_4_:
1044
 
1045
	;************************zoom 8*************************
1046
	cmp eax,49
1047
	jne no_8_
1048
	mov [k],8
1049
	call drawwin
6357 IgorA 1050
	call scrollbar_move_00
255 heavyiron 1051
	and [Current_instrument],0
1052
	jmp still
1053
	no_8_:
1054
 
1055
	;************************zoom 16************************
1056
	cmp eax,50
1057
	jne no_16_
1058
	mov [k],16
1059
	call drawwin
6357 IgorA 1060
	call scrollbar_move_00
255 heavyiron 1061
	and [Current_instrument],0
1062
	jmp still
1063
	no_16_:
1064
 
6354 IgorA 1065
	;***************allocation of a countour****************
255 heavyiron 1066
	cmp eax,21
1067
	jne no_allocation
1068
 
1069
	cmp [instrument_used],0
1070
	jnz instrument_not_finished_work
1071
 
1072
	mov al,[Activate_instrument]
1073
	test al,al
1074
	jnz no_new_allocation_xy
1075
	mov eax,[ScreenX]
1076
	mov ebx,[ScreenY]
1077
	add eax,[PosX]
1078
	add ebx,[PosY]
1079
	mov [OldX],eax
1080
	mov [OldY],ebx
1081
	inc eax
1082
	inc ebx
1083
	mov [rectangular_shade_x],eax
1084
	mov [rectangular_shade_y],ebx
1085
	mov [Activate_instrument],1
1086
	mov [instrument_used],1
1087
	and [crossing],0
1088
	and [finishing_crossing],0
6342 IgorA 1089
	xor eax,eax
1090
	mov ecx,mem_flood_f/4
1091
	mov edi,[ReserveArray]
1092
	rep stosd
255 heavyiron 1093
	jmp still
1094
	no_new_allocation_xy:
1095
	instrument_not_finished_work:
1096
 
1097
	mov al,[instrument_used]
1098
	test al,al
1099
	jz no_change_coordinats
1100
 
1101
	cmp [Activate_instrument],0
1102
	jnz no_change_coordinats
1103
 
1104
	;save coordinates as old if crossing=0
1105
	cmp [crossing],0
1106
	jnz no_save_coordinate_of_crossing
1107
 
1108
	mov eax,[OldX]
1109
	mov ebx,[OldY]
1110
 
1111
	cmp eax,[rectangular_shade_x]
1112
	jl no_remove_x
1113
	mov ecx,[rectangular_shade_x]
1114
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
1115
	mov [rectangular_shade_x],eax
1116
	no_remove_x:
1117
 
1118
	cmp ebx,[rectangular_shade_y]
1119
	jl no_remove_y
1120
	mov ecx,[rectangular_shade_y]
1121
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
1122
	mov [rectangular_shade_y],ebx
1123
	no_remove_y:
1124
 
1125
	mov eax,[ScreenX]
1126
	mov ebx,[ScreenY]
1127
	add eax,[PosX]
1128
	add ebx,[PosY]
1129
	mov [crossing_old_x],eax
1130
	mov [crossing_old_y],ebx
1131
	mov [crossing],1
1132
 
1133
 
1134
	mov eax,[OldX]
1135
	mov ebx,[OldY]
1136
	inc eax
1137
	inc ebx
1138
	mov [SpriteCoordinatX],eax
1139
	mov [SpriteCoordinatY],ebx
1140
	mov [SpriteOldCoordinatX],eax
1141
	mov [SpriteOldCoordinatY],ebx
1142
	mov esi,[rectangular_shade_x]
1143
	mov edi,[rectangular_shade_y]
1144
 
1145
	sub esi,eax
1146
	jns no_sign_sprite_size_x
1147
	neg esi
1148
	no_sign_sprite_size_x:
1149
 
1150
	sub edi,ebx
1151
	jns no_sign_sprite_size_y
1152
	neg edi
1153
	no_sign_sprite_size_y:
1154
 
1155
	test esi,esi
1156
	jnz no_null_sprite_x
1157
	mov esi,1
1158
	no_null_sprite_x:
1159
 
1160
	test edi,edi
1161
	jnz no_null_sprite_y
1162
	mov edi,1
1163
	no_null_sprite_y:
1164
 
1165
	mov [SpriteSizeX],esi
1166
	mov [SpriteSizeY],edi
1167
 
1168
	call SaveFonForSprite
1169
 
1170
	no_save_coordinate_of_crossing:
1171
 
1172
	cmp [crossing],0
1173
	je no_test_crossing_with_work_arrea
1174
	;if mouse situatad after allocation than exit
1175
	push [ScreenX]
1176
	push [ScreenY]
1177
 
1178
	call GetScreenCordinats
1179
 
1180
	mov eax,[OldX]
1181
	mov ebx,[OldY]
1182
	mov ecx,[ScreenX]
1183
	mov edx,[ScreenY]
1184
	mov esi,[SpriteSizeX]
1185
	mov edi,[SpriteSizeY]
1186
	add ecx,[PosX]
1187
	add edx,[PosY]
1188
	inc esi;eax
1189
	inc edi;ebx
1190
	call columnus
1191
 
1192
	test eax,eax
1193
	jnz crossing_with_work_area
1194
	mov [finishing_crossing],1
1195
	mov [register],1
1196
	crossing_with_work_area:
1197
 
1198
	pop [ScreenY]
1199
	pop [ScreenX]
1200
 
1201
	no_test_crossing_with_work_arrea:
1202
 
1203
	mov eax,[ScreenX]
1204
	mov ebx,[ScreenY]
1205
	add eax,[PosX]
1206
	add ebx,[PosY]
1207
	mov ecx,eax
1208
	mov edx,ebx
1209
	sub eax,[crossing_old_x]  ;dx=(x-oldx)
1210
	sub ebx,[crossing_old_y]  ;dy=(y-oldy)
1211
	mov [crossing_old_x],ecx
1212
	mov [crossing_old_y],edx
1213
 
1214
	add [OldX],eax		       ;x1=x1+dx
1215
	add [OldY],ebx		       ;y1=y1+dy
1216
	add [rectangular_shade_x],eax  ;x2=x2+dx
1217
	add [rectangular_shade_y],ebx  ;y2+y2+dy
1218
 
1219
	mov eax,[OldX]
1220
	mov ebx,[OldY]
1221
	inc eax
1222
	inc ebx
1223
	mov [SpriteCoordinatX],eax
1224
	mov [SpriteCoordinatY],ebx
1225
 
1226
	cmp [SpriteCoordinatX],0
1227
	jns no_null_sprite_coordinat_x
1228
	mov [SpriteCoordinatX],1
1229
	no_null_sprite_coordinat_x:
1230
 
1231
	cmp [SpriteCoordinatY],0
1232
	jns no_null_sprite_coordinat_y
1233
	mov [SpriteCoordinatY],1
1234
	no_null_sprite_coordinat_y:
1235
 
1236
	mov esi,[rectangular_shade_x]
1237
	mov edi,[rectangular_shade_y]
1238
 
1239
	sub esi,[OldX]
1240
	jns no_znak_size_of_rectangulare_crossing_x
1241
	neg esi
1242
	no_znak_size_of_rectangulare_crossing_x:
1243
 
1244
	sub edi,[OldY]
1245
	jns no_znak_size_of_rectangulare_crossing_y
1246
	neg edi
1247
	no_znak_size_of_rectangulare_crossing_y:
1248
 
1249
	mov ecx,[OldX]
1250
	mov edx,[OldY]
1251
 
1252
	sub ecx,[PosX]
1253
	jns no_minimum_x_crossing
1254
	mov ecx,0
1255
	add ecx,[PosX]
1256
	mov [OldX],ecx
1257
	add ecx,esi
1258
	mov [rectangular_shade_x],ecx
1259
	no_minimum_x_crossing:
1260
 
1261
	sub edx,[PosY]
1262
	jns no_minimum_y_crossing
1263
	mov edx,0
1264
	add edx,[PosY]
1265
	mov [OldY],edx
1266
	add edx,edi
1267
	mov [rectangular_shade_y],edx
1268
	no_minimum_y_crossing:
1269
 
1270
	mov ecx,[Picture_SizeX]
1271
	sub ecx,esi
1272
	cmp [OldX],ecx
1273
	jl no_maximum_x_crossing
1274
	dec ecx
1275
	mov [OldX],ecx
1276
	add ecx,esi
1277
	mov [rectangular_shade_x],ecx
1278
	no_maximum_x_crossing:
1279
 
1280
	mov edx,[Picture_SizeY]
1281
	sub edx,edi
1282
	cmp [OldY],edx
1283
	jl no_maximum_y_crossing
1284
	dec edx
1285
	mov [OldY],edx
1286
	add edx,edi
1287
	mov [rectangular_shade_y],edx
1288
	no_maximum_y_crossing:
1289
 
1290
	mov eax,[rectangular_shade_x]
1291
	mov ebx,[rectangular_shade_y]
1292
	sub eax,[PosX]
1293
	sub ebx,[PosY]
1294
	mov [ScreenX],eax
1295
	mov [ScreenY],ebx
1296
	no_change_coordinats:
1297
 
1298
	;put saved pixels
6354 IgorA 1299
	square_width_put
255 heavyiron 1300
 
1301
	cmp [DrawSprite_flag],1
1302
	jne no_activate_put_fon_
1303
 
1304
	cmp [Paste_flag],1
1305
	je no_put_fon___
1306
	call PutFonForSprite
1307
	no_put_fon___:
1308
	and [Paste_flag],0
1309
	no_activate_put_fon_:
1310
 
1311
	cmp [finishing_crossing],0
1312
	jz not_finish_from_instrument_crossing
1313
	and [Activate_instrument],0
1314
	and [crossing],0
1315
	and [instrument_used],0
1316
	and [DrawSprite_flag],0
1317
	call MovePictureToWorkScreen
1318
	jmp still
1319
	not_finish_from_instrument_crossing:
1320
 
1321
	;calculate line
1322
	mov ebx,[ReserveArray]
1323
	add ebx,4
1324
	mov eax,[PointerToPicture]
1325
	mov ecx,[Picture_SizeX]
1326
	mov edx,[OldX]
1327
	shl edx,16
1328
	add edx,[OldY]
1329
	mov esi,[ScreenX]
1330
	mov edi,[ScreenY]
1331
	add esi,[PosX]
1332
	add edi,[PosY]
1333
 
1334
	mov ebp,[Picture_SizeX]
1335
	dec ebp
1336
	cmp esi,ebp
1337
	jl no_minimum_x_allocation
1338
	mov esi,ebp
1339
	no_minimum_x_allocation:
1340
 
1341
	mov ebp,[Picture_SizeY]
1342
	dec ebp
1343
	cmp edi,ebp
1344
	jl no_minimum_y_allocation
1345
	mov edi,ebp
1346
	no_minimum_y_allocation:
1347
 
1348
	call calculate_rectangle
1349
 
1350
	;save color pixels in ReserveArray
6354 IgorA 1351
	square_width_save
255 heavyiron 1352
 
1353
	cmp [DrawSprite_flag],1
1354
	jne no_save_fon_for_sprite_
1355
	;save current coordinats as old
1356
	mov eax,[SpriteCoordinatX]
1357
	mov ebx,[SpriteCoordinatY]
1358
	mov [SpriteOldCoordinatX],eax
1359
	mov [SpriteOldCoordinatY],ebx
1360
 
1361
	call SaveFonForSprite
1362
 
1363
	no_save_fon_for_sprite_:
1364
 
1365
	;draw calculated pixels on work arrea
1366
	mov ebx,[ReserveArray]
1367
	mov ecx,[ebx]
1368
	add ebx,4
1369
	next_pixel_put_allocation:
1370
 
1371
	mov edx,0x1f3fff
1372
	mov esi,edx
1373
	shr edx,16
1374
 
1375
	mov ebp,ecx
1376
	and ebp,8
1377
	cmp ebp,8
1378
	jne black_color
1379
	mov si,0xffff
1380
	mov dl,0xff
1381
	black_color:
1382
 
1383
	mov eax,[ebx]
1384
	mov [eax],si
1385
	mov [eax+2],dl
1386
 
1387
	add ebx,4
1388
	dec ecx
1389
	jnz next_pixel_put_allocation
1390
 
1391
	cmp [DrawSprite_flag],1
1392
	jne no_activate_draw_sprite_
1393
 
1394
	call DrawSprite
1395
 
1396
	no_activate_draw_sprite_:
1397
 
1398
	mov al,[instrument_used]
1399
	test al,al
1400
	jz no_change_coordinats
1401
	cmp [Activate_instrument],0
1402
	jz no_save_shades
1403
	mov eax,[ScreenX]
1404
	mov ebx,[ScreenY]
1405
	add eax,[PosX]
1406
	add ebx,[PosY]
1407
	mov [rectangular_shade_x],eax
1408
	mov [rectangular_shade_y],ebx
1409
	no_save_shades:
1410
 
1411
	call MovePictureToWorkScreen
1412
	jmp still
1413
	no_allocation:
1414
 
6354 IgorA 1415
	;*************reflection from left to right*************
255 heavyiron 1416
	cmp eax,23
1417
	jne no_reflection_from_left_to_right
1418
 
1419
	mov ebp,[PointerToPicture]
1420
	mov edx,[ReserveArray]
1421
	mov esi,[Picture_SizeX]
1422
	mov ebx,[Picture_SizeX]
1423
	lea ebx,[ebx+ebx*2]
1424
	shr esi,1
1425
	next_line_reflection_x:
1426
	;copy vertical line to array
1427
	mov ecx,[Picture_SizeX]
1428
	shr ecx,1
1429
	sub ecx,esi
1430
	lea ecx,[ecx+ecx*2]
1431
	add ecx,[PointerToPicture]
1432
	mov edx,[ReserveArray]
1433
	and edi,0
1434
	copy_to_array_line_reflection_y:
1435
	mov eax,[ecx]
1436
	mov ebp,edi
1437
	lea ebp,[ebp+ebp*2]
1438
	mov [edx+ebp],ax
1439
	shr eax,16
1440
	mov [edx+ebp+2],al
1441
	add ecx,ebx
1442
	inc edi
1443
	cmp edi,[Picture_SizeY]
1444
	jne copy_to_array_line_reflection_y
1445
 
1446
	mov ecx,[Picture_SizeX]
1447
	shr ecx,1
1448
	mov ebp,ecx
1449
	add ecx,esi
1450
	dec ecx
1451
	lea ecx,[ecx+ecx*2]
1452
	add ecx,[PointerToPicture]
1453
	sub ebp,esi
1454
	lea ebp,[ebp+ebp*2]
1455
	add ebp,[PointerToPicture]
1456
	and edi,0
1457
	next_line_reflection_y:
1458
	mov eax,[ecx]
1459
	and eax,0xffffff
1460
	mov [ebp],ax
1461
	shr eax,16
1462
	mov [ebp+2],al
1463
	add ebp,ebx
1464
	add ecx,ebx
1465
	inc edi
1466
	cmp edi,[Picture_SizeY]
1467
	jnz next_line_reflection_y
1468
 
1469
	;copy vertical line  from array to screen
1470
	mov ecx,[Picture_SizeX]
1471
	shr ecx,1
1472
	add ecx,esi
1473
	dec ecx
1474
	lea ecx,[ecx+ecx*2]
1475
	add ecx,[PointerToPicture]
1476
	mov edx,[ReserveArray]
1477
	and edi,0
1478
	copy_from_array_to_screen_reflection_y:
1479
	mov ebp,edi
1480
	lea ebp,[ebp+ebp*2]
1481
	xor eax,eax
1482
	mov eax,[edx+ebp]
1483
	mov [ecx],ax
1484
	shr eax,16
1485
	mov [ecx+2],al
1486
	add ecx,ebx
1487
	inc edi
1488
	cmp edi,[Picture_SizeY]
1489
	jne copy_from_array_to_screen_reflection_y
1490
 
1491
	dec esi
1492
	jnz next_line_reflection_x
1493
 
1494
	call MovePictureToWorkScreen
1495
	jmp still
1496
	no_reflection_from_left_to_right:
1497
 
6354 IgorA 1498
	;*************reflection from up to down****************
255 heavyiron 1499
	cmp eax,24
1500
	jne no_reflection_from_up_to_down
1501
	mov esi,[Picture_SizeX]
1502
	mov edi,esi
1503
	lea esi,[esi+esi*2]
1504
	lea edi,[edi+edi*2]
1505
	imul edi,[Picture_SizeY]
1506
	mov edx,[ReserveArray]
1507
	mov ecx,[Picture_SizeY]
1508
	shr ecx,1
1509
	add edi,[PointerToPicture]
1510
	sub edi,esi
1511
	mov ebp,[PointerToPicture]
1512
	next_lines_reflection:
1513
	;copy line
1514
	xor ebx,ebx
1515
	copy_line_1:
1516
	xor eax,eax
1517
	mov al,[edi+ebx]
1518
	mov [edx+ebx],al
1519
	inc ebx
1520
	cmp ebx,esi
1521
	jne copy_line_1
1522
 
1523
	xor ebx,ebx
1524
	copy_line_2:
1525
	xor eax,eax
1526
	mov al,[ebp+ebx]
1527
	mov [edi+ebx],al
1528
	inc ebx
1529
	cmp ebx,esi
1530
	jne copy_line_2
1531
 
1532
	xor ebx,ebx
1533
	copy_line_3:
1534
	xor eax,eax
1535
	mov al,[edx+ebx]
1536
	mov [ebp+ebx],al
1537
	inc ebx
1538
	cmp ebx,esi
1539
	jne copy_line_3
1540
 
1541
	add ebp,esi
1542
	sub edi,esi
1543
	dec ecx
1544
	jnz next_lines_reflection
1545
 
1546
	call MovePictureToWorkScreen
1547
	jmp still
1548
	no_reflection_from_up_to_down:
1549
 
6354 IgorA 1550
	;*********************draw hard contour*****************
255 heavyiron 1551
	cmp eax,20
1552
	jne no_kontur_
1553
 
1554
	mov [Last_instrument],eax
1555
 
1556
	mov al,[Activate_instrument]
1557
	test al,al
1558
	jnz no_new_konture_xy
1559
 
1560
	mov al,[instrument_used]
1561
	test al,al
1562
	jz instrument_not_used
1563
	mov eax,[used_OldX]
1564
	mov ebx,[used_OldY]
1565
	mov [OldX],eax
1566
	mov [OldY],ebx
1567
	jmp exit_used_instrument
1568
	instrument_not_used:
1569
 
1570
	mov eax,[ScreenX]
1571
	mov ebx,[ScreenY]
1572
	add eax,[PosX]
1573
	add ebx,[PosY]
1574
	mov [OldX],eax
1575
	mov [OldY],ebx
1576
	exit_used_instrument:
1577
 
1578
	mov al,[instrument_used]
1579
	test al,al
1580
	jnz instrument_used_true
1581
	mov [instrument_used],byte 1
1582
	instrument_used_true:
1583
 
1584
	mov [Activate_instrument],1
6342 IgorA 1585
	xor eax,eax
1586
	mov ecx,mem_flood_f/4
1587
	mov edi,[ReserveArray]
1588
	rep stosd
255 heavyiron 1589
 
1590
	no_new_konture_xy:
1591
 
1592
	;put saved pixels
6354 IgorA 1593
	square_width_put
255 heavyiron 1594
 
1595
	;calculate line
1596
	mov ebx,[ReserveArray]
1597
	add ebx,4
1598
	mov eax,[PointerToPicture]
1599
	mov ecx,[Picture_SizeX]
1600
	mov edx,[OldX]
1601
	shl edx,16
1602
	add edx,[OldY]
1603
	mov esi,[ScreenX]
1604
	mov edi,[ScreenY]
1605
	add esi,[PosX]
1606
	add edi,[PosY]
1607
 
1608
	mov ebp,[Picture_SizeX]
1609
	sub ebp,[line_width]
1610
	cmp esi,ebp
1611
	jl no_minimum_x_konture
1612
	mov esi,ebp
1613
	no_minimum_x_konture:
1614
 
1615
	mov ebp,[Picture_SizeY]
1616
	sub ebp,[line_width]
1617
	cmp edi,ebp
1618
	jl no_minimum_y_konture
1619
	mov edi,ebp
1620
	no_minimum_y_konture:
1621
 
1622
	call calculate_line
1623
 
1624
	;save color pixels in ReserveArray
6354 IgorA 1625
	square_width_save
255 heavyiron 1626
 
1627
	;draw calculated pixels on work arrea
6355 IgorA 1628
	draw_calc_pixels width_pixels
255 heavyiron 1629
 
1630
	mov eax,[ScreenX]
1631
	mov ebx,[ScreenY]
1632
	add eax,[PosX]
1633
	add ebx,[PosY]
1634
	mov [used_OldX],eax
1635
	mov [used_OldY],ebx
1636
 
1637
	call MovePictureToWorkScreen
1638
 
1639
	jmp still
1640
 
1641
	no_kontur_:
6354 IgorA 1642
	;************************draw ellips********************
255 heavyiron 1643
	cmp eax,19
1644
	jne no_ellips
1645
 
1646
	mov [Last_instrument],eax
1647
 
1648
	mov al,[Activate_instrument]
1649
	test al,al
1650
	jnz no_new_ellips_xy
1651
	mov eax,[ScreenX]
1652
	mov ebx,[ScreenY]
1653
	add eax,[PosX]
1654
	add ebx,[PosY]
1655
	mov [OldX],eax
1656
	mov [OldY],ebx
1657
	mov [Activate_instrument],1
6342 IgorA 1658
	xor eax,eax
1659
	mov ecx,mem_flood_f/4
1660
	mov edi,[ReserveArray]
1661
	rep stosd
255 heavyiron 1662
	jmp still
1663
	no_new_ellips_xy:
1664
 
1665
	;put saved pixels
6354 IgorA 1666
	square_width_put
255 heavyiron 1667
 
1668
 
1669
	mov esi,[ScreenX]
1670
	mov edi,[ScreenY]
1671
	add esi,[PosX]
1672
	add edi,[PosY]
1673
 
1674
	sub esi,[OldX]
1675
	jns no_sign_x_ellips
1676
	neg esi
1677
	shr esi,1
1678
	neg esi
1679
	add esi,[OldX]
1680
	jmp no_plus_sign_x_ellips
1681
	no_sign_x_ellips:
1682
 
1683
	shr esi,1
1684
	add esi,[OldX]
1685
	no_plus_sign_x_ellips:
1686
 
1687
	sub edi,[OldY]
1688
	jns no_sign_y_ellips
1689
	neg edi
1690
	shr edi,1
1691
	neg edi
1692
	add edi,[OldY]
1693
	jmp no_plus_sign_y_ellips
1694
	no_sign_y_ellips:
1695
 
1696
	shr edi,1
1697
	add edi,[OldY]
1698
	no_plus_sign_y_ellips:
1699
 
1700
	mov [x],esi
1701
	mov [y],edi
1702
 
1703
	mov esi,[ScreenX]
1704
	mov edi,[ScreenY]
1705
	add esi,[PosX]
1706
	add edi,[PosY]
1707
 
1708
	sub esi,[OldX]
1709
	jns no_sign_x_ellips_r
1710
	neg esi
1711
	no_sign_x_ellips_r:
1712
 
1713
	sub edi,[OldY]
1714
	jns no_sign_y_ellips_r
1715
	neg edi
1716
	no_sign_y_ellips_r:
1717
 
1718
	cmp edi,0
1719
	jnz no_null_a_ellips
1720
	mov edi,1
1721
	no_null_a_ellips:
1722
 
1723
	shr esi,1
1724
	shr edi,1
1725
	mov [a_ellips],esi
1726
	mov [b_ellips],edi
1727
 
1728
	mov edi,[x]
1729
	mov ebp,[y]
1730
	add edi,esi
1731
	add ebp,esi
1732
 
1733
	mov edx,[Picture_SizeX]
1734
	sub edx,[line_width]
1735
	cmp edi,edx
1736
	jl no_limit_x_ellips
1737
	sub edi,edx
1738
	sub [a_ellips],edi
1739
	no_limit_x_ellips:
1740
 
1741
	mov edx,[Picture_SizeY]
1742
	sub edx,[line_width]
1743
	cmp ebp,edx
1744
	jl no_limit_y_ellips
1745
	sub ebp,edx
1746
	sub [b_ellips],ebp
1747
	no_limit_y_ellips:
1748
 
1749
 
1750
	mov edi,[x]
1751
	mov ebp,[y]
1752
 
1753
	sub edi,[a_ellips]
1754
	jns no_minimum_x_ellips
1755
	add [a_ellips],edi
1756
	no_minimum_x_ellips:
1757
 
1758
	sub ebp,[b_ellips]
1759
	jns no_minimum_y_ellips
1760
	add [b_ellips],ebp
1761
	no_minimum_y_ellips:
1762
 
1763
	;calculate circle
1764
	mov ebx,[ReserveArray]
1765
	add ebx,4
1766
	mov eax,[PointerToPicture]
1767
	mov ecx,[Picture_SizeX]
1768
	mov edx,[x]
1769
	shl edx,16
1770
	add edx,[y]
1771
	mov esi,[a_ellips]
1772
	shl esi,16
1773
	add esi,[b_ellips]
1774
	call calculate_ellips
1775
 
1776
	;save color pixels in ReserveArray
6354 IgorA 1777
	square_width_save
255 heavyiron 1778
 
1779
	;draw calculated pixels on work arrea
6355 IgorA 1780
	draw_calc_pixels width_pixels
255 heavyiron 1781
 
1782
	call MovePictureToWorkScreen
1783
	jmp still
1784
	no_ellips:
1785
 
1786
 
1787
	jmp still
1788
	ret