Subversion Repositories Kolibri OS

Rev

Rev 6379 | 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:
6371 IgorA 26
			mov edx,[ebx+mem_offs_shape+ebp]
6354 IgorA 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
6371 IgorA 76
			mov [ebx+mem_offs_shape+ebp],dx
6354 IgorA 77
			shr edx,16
6371 IgorA 78
			mov [ebx+mem_offs_shape+2+ebp],dl
6354 IgorA 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
;-----------------------------------------------------------
6362 IgorA 156
;input:
157
; [Current_instrument] - instrument code
158
;
159
; *** instrument codes ***
160
;10 - pensil
161
;11 - draw brush
162
;12 - spray
163
;13 - lastik
164
;14 - flood fill
165
;15 - pipetka
166
;16 - draw line
167
;17 - draw rectangle
168
;18 - draw circle
169
;19 - draw ellips
170
;20 - draw hard contour
171
;21 - allocation of a countour
172
;23 - reflection from left to right
173
;24 - reflection from up to down
174
;40 - brush 1
175
;41 - brush 2
176
;42 - brush 3
177
;43 - brush 4
178
;44 - brush 5
179
;45 - zoom 1
180
;46 - zoom 2
181
;47 - zoom 3
182
;48 - zoom 4
183
;49 - zoom 8
184
;50 - zoom 16
185
;51 - palette
186
 
187
align 4
255 heavyiron 188
TakeButtonInstruments:
189
	mov eax,[Current_instrument]
190
 
191
	;*************************brush 1***********************
192
	cmp eax,40
193
	jne no_brush1
194
 
195
	mov [Brush_SizeX],4
196
	mov [Brush_SizeY],4
197
	mov [Number_Brush],0
198
	mov ebx,[Last_instrument]
199
	mov [Current_instrument],ebx
200
 
201
	mov [line_width],1
6362 IgorA 202
	ret
255 heavyiron 203
	no_brush1:
204
 
205
	;*************************brush 2***********************
206
	cmp eax,41
207
	jne no_brush2
208
 
209
	mov [Brush_SizeX],6
210
	mov [Brush_SizeY],4
211
	mov [Number_Brush],1
212
	mov ebx,[Last_instrument]
213
	mov [Current_instrument],ebx
214
 
215
	mov [line_width],2
6362 IgorA 216
	ret
255 heavyiron 217
	no_brush2:
218
 
219
	;*************************brush 3***********************
220
	cmp eax,42
221
	jne no_brush3
222
 
223
	mov [Brush_SizeX],8
224
	mov [Brush_SizeY],7
225
	mov [Number_Brush],2
226
	mov ebx,[Last_instrument]
227
	mov [Current_instrument],ebx
228
 
229
	mov [line_width],3
6362 IgorA 230
	ret
255 heavyiron 231
	no_brush3:
232
 
6354 IgorA 233
	;*************************brush 4***********************
255 heavyiron 234
	cmp eax,43
235
	jne no_brush4
236
 
237
	mov [Brush_SizeX],14
238
	mov [Brush_SizeY],14
239
	mov [Number_Brush],3
240
	mov ebx,[Last_instrument]
241
	mov [Current_instrument],ebx
242
 
243
	mov [line_width],4
6362 IgorA 244
	ret
255 heavyiron 245
	no_brush4:
246
 
6354 IgorA 247
	;*************************brush 5***********************
255 heavyiron 248
	cmp eax,44
249
	jne no_brush5
250
 
251
	mov [Brush_SizeX],6
252
	mov [Brush_SizeY],6
253
	mov [Number_Brush],4
254
	mov ebx,[Last_instrument]
255
	mov [Current_instrument],ebx
256
 
257
	mov [line_width],5
6362 IgorA 258
	ret
255 heavyiron 259
	no_brush5:
260
 
261
	;*************************pensil************************
262
	cmp eax,10
263
	jne no_pensil
264
 
265
	mov al,[exit_from_work_arrea]
266
 
267
	test al,al
268
	jz no_exit_from_work_arrea
269
 
270
	and [Activate_instrument],0
271
	and [exit_from_work_arrea],0
272
 
273
	no_exit_from_work_arrea:
274
 
275
	mov al,[Activate_instrument]
276
 
277
	test al,al
278
	jnz no_activated_later
279
 
280
	call GetScreenCordinats
281
	mov eax,[ScreenX]
282
	mov ebx,[ScreenY]
283
	add eax,[PosX]
284
	add ebx,[PosY]
285
	mov [OldX],eax
286
	mov [OldY],ebx
287
 
288
	no_activated_later:
289
 
290
	mov eax,[PointerToPicture]
291
	mov ebx,[ReserveArray]
292
	mov ecx,[Picture_SizeX]
293
	mov edx,[OldX]
294
	shl edx,16
295
	add edx,[OldY]
296
	mov esi,[ScreenX]
297
	mov edi,[ScreenY]
298
	add esi,[PosX]
299
	add edi,[PosY]
300
	call calculate_line
301
 
302
	mov ecx,eax
303
	mov edx,[Color]
304
	mov esi,[Color]
305
	shr edx,16
306
	xor ebx,ebx
307
	mov eax,[ReserveArray]
308
 
309
	pensil_next_pixel_draw:
310
 
311
	  mov ebx,[eax]
312
	  mov [ebx],si
313
	  mov [ebx+2],dl
314
	  add eax,4
315
 
316
	dec ecx
317
	jnz pensil_next_pixel_draw
318
 
319
	mov eax,[ScreenX]
320
	mov ebx,[ScreenY]
321
	add eax,[PosX]
322
	add ebx,[PosY]
323
	mov [OldX],eax
324
	mov [OldY],ebx
325
 
326
	call MovePictureToWorkScreen
327
	mov [Activate_instrument],1
6362 IgorA 328
	ret
255 heavyiron 329
	no_pensil:
330
 
6354 IgorA 331
	;*************************draw brush********************
255 heavyiron 332
	cmp eax,11
333
	jne no_brush
334
 
335
	mov [Last_instrument],eax
336
 
337
	jmp no_lastik_
338
 
339
	lastik_in:
340
	mov eax,[Color]
341
	mov [SColor],eax
342
	mov [Color],0xffffff
343
	no_lastik_:
344
 
345
	mov eax,[ScreenX]
346
	mov ebx,[ScreenY]
347
	mov ecx,[Brush_SizeX]
348
	mov edx,[Brush_SizeY]
349
	add eax,[PosX]
350
	add ebx,[PosY]
351
	add eax,ecx
352
	add ebx,edx
353
 
354
	cmp eax,[Picture_SizeX]
355
	jl no_max_pos_x
356
	mov eax,[Picture_SizeX]
357
	no_max_pos_x:
358
 
359
	cmp ebx,[Picture_SizeY]
360
	jl no_max_pos_y
361
	mov ebx,[Picture_SizeY]
362
	no_max_pos_y:
363
 
364
	cmp eax,ecx
365
	ja no_min_pos_x
366
	mov eax,[Brush_SizeX]
367
	no_min_pos_x:
368
 
369
	cmp ebx,edx
370
	ja no_min_pos_y
371
	mov ebx,[Brush_SizeY]
372
	no_min_pos_y:
373
 
374
	sub eax,[Brush_SizeX]
375
	sub ebx,[Brush_SizeY]
376
 
377
	mov [x],eax
378
	mov [y],ebx
379
 
380
	mov al,[exit_from_work_arrea]
381
	test al,al
382
	jz no_exit_from_work_arrea_brush
383
	and [Activate_instrument],0
384
	and [exit_from_work_arrea],0
385
	no_exit_from_work_arrea_brush:
386
 
387
	mov al,[Activate_instrument]
388
	test al,al
389
	jnz no_new_brush_xy
390
	mov eax,[x]
391
	mov ebx,[y]
392
	mov [OldX],eax
393
	mov [OldY],ebx
394
	mov [Activate_instrument],1
395
	no_new_brush_xy:
396
 
397
	mov eax,[PointerToPicture]
398
	mov ebx,[ReserveArray]
399
	add ebx,4
400
	mov ecx,[Picture_SizeX]
401
	mov edx,[OldX]
402
	shl edx,16
403
	add edx,[OldY]
404
	mov esi,[x]
405
	mov edi,[y]
406
 
407
	call calculate_line
408
 
409
	mov ebx,[ReserveArray]
410
	mov [ebx],eax
411
 
412
	;procedure drawing of brush
413
	mov ebx,[ReserveArray]
414
	mov ecx,[ebx]
415
	mov edx,[Color]
416
	mov esi,[Color]
417
	shr edx,16
418
	add ebx,4
419
	mov edi,[Number_Brush]
420
	imul edi,20*20
421
 
422
	next_pixel_put_brush:
423
 
424
	mov eax,[ebx]
425
	push eax
426
	push ecx
427
	xor ebp,ebp
428
	and [counter2],0
429
 
430
	vertical_width_brush:
431
	   and [counter],0
432
 
433
	   horizontal_width_brush:
434
	   xor ecx,ecx
435
	   mov cl,byte[Brush_color+edi+ebp]
436
	   test cl,cl
437
	     jz no_draw_pixel_brush
438
	      mov [eax],si
439
	      mov [eax+2],dl
440
	     no_draw_pixel_brush:
441
	   add eax,3
442
	   inc ebp
443
	   inc [counter]
444
	   cmp [counter],20
445
	   jne horizontal_width_brush
446
 
447
	   mov ecx,[Picture_SizeX]
448
	   sub ecx,20
449
	   lea ecx,[ecx+ecx*2]
450
	   add eax,ecx
451
	inc [counter2]
452
	cmp [counter2],20
453
	jne vertical_width_brush
454
 
455
	pop ecx
456
	pop eax
457
	add ebx,4
458
	dec ecx
459
	jnz next_pixel_put_brush
460
 
461
	mov eax,[x]
462
	mov ebx,[y]
463
	mov [OldX],eax
464
	mov [OldY],ebx
465
 
466
	mov al,[lastik_is_active]
467
	test al,al
468
	jz no_lastik_active
469
 
470
	mov eax,[SColor]
471
	mov [Color],eax
472
	and [lastik_is_active],0
473
	no_lastik_active:
474
 
475
	call MovePictureToWorkScreen
476
	mov eax,[Current_instrument]
477
	mov [Last_instrument],eax
478
 
6362 IgorA 479
	ret
255 heavyiron 480
	no_brush:
481
 
6362 IgorA 482
	;*************************pipetka***********************
483
	cmp eax,15
484
	jne no_pipetka
485
 
486
	mov eax,[ScreenY]
487
	mov ebx,[Picture_SizeX]
488
	add eax,[PosY]
489
	imul eax,ebx
490
	add eax,[ScreenX]
491
	add eax,[PosX]
492
	lea eax,[eax+eax*2]
493
	add eax,[PointerToPicture]
494
	mov ebx,[eax]
495
	and ebx,0xffffff
496
	mov [Color],ebx
497
 
498
	mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\
499
		((ci_panel_y_pos+28) shl 16)+21, [Color]
500
 
501
	ret
502
	no_pipetka:
503
 
504
	;************************lastik*************************
505
	cmp eax,13
506
	jne no_lastik
507
 
508
	mov [Last_instrument],eax
509
	mov [lastik_is_active],1
510
	jmp lastik_in
511
	no_lastik:
512
 
6354 IgorA 513
	;************************Flood Fill*********************
255 heavyiron 514
	cmp eax,14
515
	jne no_FloodFill
516
 
517
	mov eax,[PointerToPicture]
518
	mov ebx,[PointerToEditBufer]
519
 
520
	mov ecx,[Picture_SizeX]
521
	imul ecx,[Picture_SizeY]
522
	lea ecx,[ecx+ecx*2]
523
	shl ecx,1
524
 
6342 IgorA 525
	cmp ecx,mem_flood_f
255 heavyiron 526
	ja normal_size_of_bufer
527
 
528
	mov ebx,[ReserveArray]
529
 
530
	normal_size_of_bufer:
531
 
532
	add ebx,4
533
	mov ecx,[Picture_SizeX]
534
	mov edx,[ScreenX]
535
	add edx,[PosX]
536
	shl edx,16
537
	add edx,[ScreenY]
538
	add edx,[PosY]
539
	mov esi,[Picture_SizeX]
540
	dec esi
541
	shl esi,16
542
	add esi,[Picture_SizeY]
543
	dec esi
544
	mov edi,[Color]
545
 
546
	call flood_fill
547
	call MovePictureToWorkScreen
6362 IgorA 548
	ret
255 heavyiron 549
	no_FloodFill:
550
 
6362 IgorA 551
	;************************spray**************************
255 heavyiron 552
	cmp eax,12
6362 IgorA 553
	jne no_spray
255 heavyiron 554
 
555
	cmp [Activate_instrument],0
556
	jne no_null_spray
557
	mov [Activate_instrument],1
6362 IgorA 558
	ret
255 heavyiron 559
	no_null_spray:
560
 
561
	mov eax,[ScreenX]
562
	mov ebx,[ScreenY]
563
	mov ecx,[Brush_SizeX]
564
	mov edx,[Brush_SizeY]
565
	add eax,[PosX]
566
	add ebx,[PosY]
567
	add eax,ecx
568
	add ebx,edx
569
 
570
	cmp eax,[Picture_SizeX]
571
	jl no_max_pos_x_spray
572
	mov eax,[Picture_SizeX]
573
	no_max_pos_x_spray:
574
 
575
	cmp ebx,[Picture_SizeY]
576
	jl no_max_pos_y_spray
577
	mov ebx,[Picture_SizeY]
578
	no_max_pos_y_spray:
579
 
580
	cmp eax,ecx
581
	ja no_min_pos_x_spray
582
	mov eax,[Brush_SizeX]
583
	no_min_pos_x_spray:
584
 
585
	cmp ebx,edx
586
	ja no_min_pos_y_spray
587
	mov ebx,[Brush_SizeY]
588
	no_min_pos_y_spray:
589
 
590
	sub eax,[Brush_SizeX]
591
	sub ebx,[Brush_SizeY]
592
	mov edi,0;[Number_Brush]
593
	imul edi,20*20
594
 
595
	mov [x],eax
596
	mov [y],ebx
597
	mov ebp,[Picture_SizeX]
598
	xor edx,edx
599
	brush_y_spray:
600
	  xor ecx,ecx
601
	  brush_x_spray:
602
	   ;calculate position in array of spray
603
	   mov esi,edx
604
	   lea esi,[esi+esi*4] ;esi=esi*5
605
	   shl esi,2	       ;esi=(esi*3)*4
606
	   add esi,ecx
607
	   add esi,edi
608
	   ;read byte from array
609
	   xor eax,eax
610
	   mov al,[Spray_color+esi]
611
	   test eax,eax
612
	   jz no_color_spray
613
	   mov eax,[x]
614
	   mov ebx,[y]
615
	   add eax,ecx
616
	   add ebx,edx
617
	   imul ebx,ebp; ebp=[Picture_SizeX]
618
	   add eax,ebx
619
	   lea eax,[eax+eax*2]
620
	   add eax,[PointerToPicture]
621
	   mov ebx,[Color]
622
	   mov [eax],bx
623
	   shr ebx,16
624
	   mov [eax+2],bl
625
	   no_color_spray:
626
	   inc ecx
627
	   cmp ecx,20
628
	  jl brush_x_spray
629
	inc edx
630
	cmp edx,20
631
	jl brush_y_spray
632
 
633
	call MovePictureToWorkScreen
6362 IgorA 634
	ret
255 heavyiron 635
	no_spray:
636
 
6354 IgorA 637
	;************************palette************************
255 heavyiron 638
	cmp eax,51
639
	jne no_palette
640
 
641
	mov eax,20
6359 IgorA 642
	mov ebx,ci_palete_y_pos
255 heavyiron 643
	mov ecx,32*10+32*5+7
6359 IgorA 644
	mov edx,140
255 heavyiron 645
	mov  esi,1
646
	call draw_volume_rectangle
647
	mov [x],20+5
6359 IgorA 648
	mov [y],ci_palete_y_pos+10
255 heavyiron 649
	mov edi,256
650
	xor esi,esi
651
	next_rectangle:
652
	mov ebx,[x]
653
	mov ecx,[y]
654
	mov edx,[palitra+esi]
655
	and edx,0xffffff
656
	shl ebx,16
657
	shl ecx,16
658
	add ebx,13
659
	add ecx,13
6342 IgorA 660
	mcall SF_DRAW_RECT
255 heavyiron 661
	add [x],15
662
	cmp [x],20+15*32
663
	jl no_new_line
664
	mov [x],20+5
665
	add [y],15
666
	no_new_line:
667
	add esi,4
668
	dec edi
669
	jnz next_rectangle
670
 
671
	wait_events:
6362 IgorA 672
	mcall SF_WAIT_EVENT
255 heavyiron 673
 
674
	cmp eax,1
6362 IgorA 675
	jne @f
676
		ret
677
	@@:
255 heavyiron 678
	cmp eax,2
679
	jne no_keys
6362 IgorA 680
		mcall SF_GET_KEY
681
		jmp wait_events
255 heavyiron 682
	no_keys:
683
	cmp eax,3
684
	jne no_buttons
6362 IgorA 685
		mcall SF_GET_BUTTON
686
		jmp wait_events
255 heavyiron 687
	no_buttons:
688
	cmp eax,6
689
	jne wait_events
690
 
691
	call GetMouseClick
692
 
693
	test eax,eax
694
	jz wait_events
695
	call GetMouseCoordinats
696
	mov [x],20+5
6359 IgorA 697
	mov [y],ci_palete_y_pos+10
255 heavyiron 698
	mov [counter],0
699
	next_rectangle_column:
700
	mov eax,[x]
701
	mov ebx,[y]
702
	mov ecx,[MouseX]
703
	mov edx,[MouseY]
704
	mov esi,13
705
	mov edi,13
706
	call columnus
707
	test eax,eax
708
	jz no_columnus_color
709
 
710
	mov eax,[counter]
711
	shl eax,2
712
	mov ebx,[palitra+eax]
713
	and ebx,0xffffff
714
	mov [Color],ebx
715
	no_columnus_color:
716
 
717
	add [x],15
718
 
719
	cmp [x],20+15*32
720
	jl no_new_line_column
721
 
722
	mov [x],20+5
723
	add [y],15
724
	no_new_line_column:
725
 
726
	inc [counter]
727
 
728
	cmp [counter],257
729
	jne next_rectangle_column
730
 
6342 IgorA 731
	mcall SF_SLEEP,10
255 heavyiron 732
 
733
	call drawwin
734
 
735
	mov eax,[Last_instrument]
736
	mov [Current_instrument],eax
6362 IgorA 737
	ret
255 heavyiron 738
	no_palette:
739
 
740
	;************************draw line**********************
741
	cmp eax,16
742
	jne no_line
743
 
744
	mov [Last_instrument],eax
745
 
746
	mov al,[Activate_instrument]
747
	test al,al
748
	jnz no_new_line_xy
749
	mov eax,[ScreenX]
750
	mov ebx,[ScreenY]
751
	add eax,[PosX]
752
	add ebx,[PosY]
753
	mov [OldX],eax
754
	mov [OldY],ebx
755
	mov [Activate_instrument],1
6342 IgorA 756
	xor eax,eax
757
	mov ecx,mem_flood_f/4
758
	mov edi,[ReserveArray]
6362 IgorA 759
	cld
6342 IgorA 760
	rep stosd
6362 IgorA 761
	ret
255 heavyiron 762
	no_new_line_xy:
763
 
764
	;put saved pixels
6354 IgorA 765
	square_width_put
255 heavyiron 766
 
767
	;calculate line
768
	mov ebx,[ReserveArray]
769
	add ebx,4
770
	mov eax,[PointerToPicture]
771
	mov ecx,[Picture_SizeX]
772
	mov edx,[OldX]
773
	shl edx,16
774
	add edx,[OldY]
775
	mov esi,[ScreenX]
776
	mov edi,[ScreenY]
777
	add esi,[PosX]
778
	add edi,[PosY]
779
 
780
	mov ebp,[Picture_SizeX]
781
	sub ebp,[line_width]
782
	cmp esi,ebp
783
	jl no_minimum_x_line
784
	mov esi,ebp
785
	no_minimum_x_line:
786
 
787
	mov ebp,[Picture_SizeY]
788
	sub ebp,[line_width]
789
	cmp edi,ebp
790
	jl no_minimum_y_line
791
	mov edi,ebp
792
	no_minimum_y_line:
793
 
794
	call calculate_line
795
 
796
	;save color pixels in ReserveArray
6354 IgorA 797
	square_width_save
255 heavyiron 798
 
799
	;draw calculated pixels on work arrea
6355 IgorA 800
	draw_calc_pixels width_pixels
255 heavyiron 801
 
802
	call MovePictureToWorkScreen
6362 IgorA 803
	ret
255 heavyiron 804
	no_line:
805
 
6354 IgorA 806
	;************************draw rectangle*****************
255 heavyiron 807
	cmp eax,17
808
	jne no_rectangle
809
 
810
	mov [Last_instrument],eax
811
 
812
	mov al,[Activate_instrument]
813
	test al,al
814
	jnz no_new_rectangle_xy
815
	mov eax,[ScreenX]
816
	mov ebx,[ScreenY]
817
	add eax,[PosX]
818
	add ebx,[PosY]
819
	mov [OldX],eax
820
	mov [OldY],ebx
821
	mov [Activate_instrument],1
6342 IgorA 822
	xor eax,eax
823
	mov ecx,mem_flood_f/4
824
	mov edi,[ReserveArray]
6362 IgorA 825
	cld
6342 IgorA 826
	rep stosd
6362 IgorA 827
	ret
255 heavyiron 828
	no_new_rectangle_xy:
829
 
830
	;put saved pixels
6354 IgorA 831
	square_width_put
255 heavyiron 832
 
833
	;calculate line
834
	mov ebx,[ReserveArray]
835
	add ebx,4
836
	mov eax,[PointerToPicture]
837
	mov ecx,[Picture_SizeX]
838
	mov edx,[OldX]
839
	shl edx,16
840
	add edx,[OldY]
841
	mov esi,[ScreenX]
842
	mov edi,[ScreenY]
843
	add esi,[PosX]
844
	add edi,[PosY]
845
 
846
	mov ebp,[Picture_SizeX]
847
	sub ebp,[line_width]
848
	cmp esi,ebp
849
	jl no_minimum_x_rectangle
850
	mov esi,ebp
851
	no_minimum_x_rectangle:
852
 
853
	mov ebp,[Picture_SizeY]
854
	sub ebp,[line_width]
855
	cmp edi,ebp
856
	jl no_minimum_y_rectangle
857
	mov edi,ebp
858
	no_minimum_y_rectangle:
859
 
860
	call calculate_rectangle
861
 
862
	;save color pixels in ReserveArray
6354 IgorA 863
	square_width_save
255 heavyiron 864
 
865
	;draw calculated pixels on work arrea
6355 IgorA 866
	draw_calc_pixels width_pixels_rectangle
255 heavyiron 867
 
868
	call MovePictureToWorkScreen
6362 IgorA 869
	ret
255 heavyiron 870
	no_rectangle:
871
 
6354 IgorA 872
	;************************draw circle********************
255 heavyiron 873
	cmp eax,18
874
	jne no_circle
875
 
876
	mov [Last_instrument],eax
877
 
878
	mov al,[Activate_instrument]
879
	test al,al
880
	jnz no_new_circle_xy
881
	mov eax,[ScreenX]
882
	mov ebx,[ScreenY]
883
	add eax,[PosX]
884
	add ebx,[PosY]
885
	mov [OldX],eax
886
	mov [OldY],ebx
887
	mov [Activate_instrument],1
6342 IgorA 888
	xor eax,eax
889
	mov ecx,mem_flood_f/4
890
	mov edi,[ReserveArray]
6362 IgorA 891
	cld
6342 IgorA 892
	rep stosd
6362 IgorA 893
	ret
255 heavyiron 894
	no_new_circle_xy:
895
 
896
	;put saved pixels
6354 IgorA 897
	square_width_put
255 heavyiron 898
 
899
	mov esi,[ScreenX]
900
	mov edi,[ScreenY]
901
	add esi,[PosX]
902
	add edi,[PosY]
903
 
904
	sub esi,[OldX]
905
	jns no_sign_x_circle
906
	neg esi
907
	shr esi,1
908
	neg esi
909
	add esi,[OldX]
910
	jmp no_plus_sign_x_circle
911
	no_sign_x_circle:
912
 
913
	shr esi,1
914
	add esi,[OldX]
915
	no_plus_sign_x_circle:
916
 
917
	sub edi,[OldY]
918
	jns no_sign_y_circle
919
	neg edi
920
	shr edi,1
921
	neg edi
922
	add edi,[OldY]
923
	jmp no_plus_sign_y_circle
924
	no_sign_y_circle:
925
 
926
	shr edi,1
927
	add edi,[OldY]
928
	no_plus_sign_y_circle:
929
 
930
	mov [x],esi
931
	mov [y],edi
932
 
933
	mov esi,[ScreenX]
934
	mov edi,[ScreenY]
935
	add esi,[PosX]
936
	add edi,[PosY]
937
 
938
	sub esi,[OldX]
939
	jns no_sign_x_circle_r
940
	neg esi
941
	no_sign_x_circle_r:
942
 
943
	sub edi,[OldY]
944
	jns no_sign_y_circle_r
945
	neg edi
946
	no_sign_y_circle_r:
947
 
948
	mov [Dx_],esi
949
	mov [Dy_],edi
950
 
951
	;finit
952
	fild [Dx_]
953
	fmul st0,st0
954
	fild [Dy_]
955
	fmul st0,st0
956
	fadd st0,st1
957
	fsqrt
958
	fistp [Radius]
959
	fistp [Icon_X]
960
	mov esi,[Radius]
961
	shr esi,1
962
	cmp esi,0
963
	jne no_null_radius
964
	mov [Radius],1
965
	no_null_radius:
966
 
967
	mov [Radius],esi
968
 
969
	mov edi,[x]
970
	mov ebp,[y]
971
	add edi,esi
972
	add ebp,esi
973
 
974
	mov edx,[Picture_SizeX]
975
	sub edx,[line_width]
976
	cmp edi,edx
977
	jl no_limit_x_circle
978
	sub edi,edx
979
	sub [Radius],edi
980
	no_limit_x_circle:
981
 
982
	mov edx,[Picture_SizeY]
983
	sub edx,[line_width]
984
	cmp ebp,edx
985
	jl no_limit_y_circle
986
	sub ebp,edx
987
	sub [Radius],ebp
988
	no_limit_y_circle:
989
 
990
 
991
	mov edi,[x]
992
	mov ebp,[y]
993
 
994
	sub edi,[Radius]
995
	jns no_minimum_x_circle
996
	add [Radius],edi
997
	no_minimum_x_circle:
998
 
999
	sub ebp,[Radius]
1000
	jns no_minimum_y_circle
1001
	add [Radius],ebp
1002
	no_minimum_y_circle:
1003
 
1004
	;calculate circle
1005
	mov ebx,[ReserveArray]
1006
	add ebx,4
1007
	mov eax,[PointerToPicture]
1008
	mov ecx,[Picture_SizeX]
1009
	mov edx,[x]
1010
	shl edx,16
1011
	add edx,[y]
1012
	mov esi,[Radius]
1013
	call calculate_circle
1014
 
1015
	;save color pixels in ReserveArray
6354 IgorA 1016
	square_width_save
255 heavyiron 1017
 
1018
	;draw calculated pixels on work arrea
6355 IgorA 1019
	draw_calc_pixels width_pixels
255 heavyiron 1020
 
1021
	call MovePictureToWorkScreen
6362 IgorA 1022
	ret
255 heavyiron 1023
	no_circle:
1024
 
1025
	;************************zoom 1*************************
1026
	cmp eax,45
1027
	jne no_1_
1028
	mov [k],1
6357 IgorA 1029
	call scrollbar_move_00
6385 IgorA 1030
	and [Current_instrument],0 ;???
255 heavyiron 1031
	call drawwin
6362 IgorA 1032
	ret
255 heavyiron 1033
	no_1_:
1034
 
6354 IgorA 1035
	;************************zoom 2*************************
255 heavyiron 1036
	cmp eax,46
1037
	jne no_2_
1038
	mov [k],2
1039
	call drawwin
6357 IgorA 1040
	call scrollbar_move_00
255 heavyiron 1041
	and [Current_instrument],0
6362 IgorA 1042
	ret
255 heavyiron 1043
	no_2_:
1044
 
6354 IgorA 1045
	;************************zoom 3*************************
255 heavyiron 1046
	cmp eax,47
1047
	jne no_3_
1048
	mov [k],3
1049
	call drawwin
6357 IgorA 1050
	call scrollbar_move_00
255 heavyiron 1051
	and [Current_instrument],0
6362 IgorA 1052
	ret
255 heavyiron 1053
	no_3_:
1054
 
6354 IgorA 1055
	;************************zoom 4*************************
255 heavyiron 1056
	cmp eax,48
1057
	jne no_4_
1058
	mov [k],4
1059
	call drawwin
6357 IgorA 1060
	call scrollbar_move_00
255 heavyiron 1061
	and [Current_instrument],0
6362 IgorA 1062
	ret
255 heavyiron 1063
	no_4_:
1064
 
1065
	;************************zoom 8*************************
1066
	cmp eax,49
1067
	jne no_8_
1068
	mov [k],8
1069
	call drawwin
6357 IgorA 1070
	call scrollbar_move_00
255 heavyiron 1071
	and [Current_instrument],0
6362 IgorA 1072
	ret
255 heavyiron 1073
	no_8_:
1074
 
1075
	;************************zoom 16************************
1076
	cmp eax,50
1077
	jne no_16_
1078
	mov [k],16
1079
	call drawwin
6357 IgorA 1080
	call scrollbar_move_00
255 heavyiron 1081
	and [Current_instrument],0
6362 IgorA 1082
	ret
255 heavyiron 1083
	no_16_:
1084
 
6354 IgorA 1085
	;***************allocation of a countour****************
255 heavyiron 1086
	cmp eax,21
1087
	jne no_allocation
1088
 
1089
	mov [Activate_instrument],1
1090
 
1091
	call GetScreenCordinats
1092
 
6385 IgorA 1093
	bt [MouseBut],8 ;left button down
1094
	jnc .left_but_down
1095
		cmp [crossing],2
1096
		jne @f
1097
			;move old selection
1098
			mov eax,[crossing_old_x]
1099
			mov ebx,[crossing_old_y]
1100
			mov ecx,[ScreenX]
1101
			mov edx,[ScreenY]
1102
			add ecx,[PosX]
1103
			add edx,[PosY]
1104
			mov esi,[rectangular_shade_x]
1105
			mov edi,[rectangular_shade_y]
1106
			sub esi,eax
1107
			sub edi,ebx
1108
			call columnus
255 heavyiron 1109
 
6385 IgorA 1110
			test eax,eax
1111
			jz @f
1112
				mov [crossing],3
1113
				mov [OldX],ecx
1114
				mov [OldY],edx
1115
				jmp selection_update
1116
		@@:
1117
		;start new selection
1118
		mov eax,[ScreenX]
1119
		add eax,[PosX]
1120
		mov [crossing_old_x],eax
1121
		mov [rectangular_shade_x],eax
1122
		mov eax,[ScreenY]
1123
		add eax,[PosY]
1124
		mov [crossing_old_y],eax
1125
		mov [rectangular_shade_y],eax
1126
		mov [crossing],1
1127
		jmp selection_update
1128
	.left_but_down:
255 heavyiron 1129
 
6385 IgorA 1130
	bt [MouseBut],0 ;left button press
1131
	jnc .no_mouse_move
1132
		cmp [crossing],3
1133
		jne .no_sel_move
1134
			;move selection
1135
			mov eax,[ScreenX]
1136
			add eax,[PosX]
1137
			sub eax,[OldX]
1138
			add [OldX],eax
1139
			mov ebx,[crossing_old_x]
1140
			add ebx,eax
1141
			cmp ebx,0
1142
			jge @f
1143
				;exit from left border
1144
				sub eax,ebx
1145
			@@:
1146
			add [crossing_old_x],eax
1147
			add [rectangular_shade_x],eax
1148
			mov eax,[ScreenY]
1149
			add eax,[PosY]
1150
			sub eax,[OldY]
1151
			add [OldY],eax
1152
			mov ebx,[crossing_old_y]
1153
			add ebx,eax
1154
			cmp ebx,0
1155
			jge @f
1156
				;exit from top border
1157
				sub eax,ebx
1158
			@@:
1159
			add [crossing_old_y],eax
1160
			add [rectangular_shade_y],eax
1161
			jmp selection_update
1162
		.no_sel_move:
1163
		;resize selection
1164
		mov eax,[ScreenX]
1165
		add eax,[PosX]
1166
		mov [rectangular_shade_x],eax
1167
		mov eax,[ScreenY]
1168
		add eax,[PosY]
1169
		mov [rectangular_shade_y],eax
1170
		jmp selection_update
1171
	.no_mouse_move:
255 heavyiron 1172
 
6385 IgorA 1173
	bt [MouseBut],16 ;left button up
1174
	jnc .left_but_up
1175
		;finish selection
1176
		mov eax,[crossing_old_x]
1177
		mov ebx,[rectangular_shade_x]
1178
		cmp eax,ebx
1179
		jle @f
1180
			mov [crossing_old_x],ebx
1181
			mov [rectangular_shade_x],eax
1182
		@@:
1183
		mov eax,[crossing_old_y]
1184
		mov ebx,[rectangular_shade_y]
1185
		cmp eax,ebx
1186
		jle @f
1187
			mov [crossing_old_y],ebx
1188
			mov [rectangular_shade_y],eax
1189
		@@:
1190
		mov [crossing],2
1191
		ret
1192
	.left_but_up:
255 heavyiron 1193
 
6385 IgorA 1194
	bt [MouseBut],9 ;right button down
1195
	jnc .right_but_down
1196
		;delete select
1197
		mov [crossing],0
1198
		jmp selection_update
1199
	.right_but_down:
255 heavyiron 1200
 
6385 IgorA 1201
if 0
255 heavyiron 1202
	cmp [Paste_flag],1
6379 IgorA 1203
	je @f
1204
		call PutFonForSprite
1205
	@@:
255 heavyiron 1206
	cmp [DrawSprite_flag],1
6379 IgorA 1207
	jne @f
6385 IgorA 1208
		call SaveFonForSprite
6379 IgorA 1209
		call DrawSprite
1210
	@@:
6385 IgorA 1211
end if
255 heavyiron 1212
 
6385 IgorA 1213
	selection_update:
255 heavyiron 1214
	call MovePictureToWorkScreen
6362 IgorA 1215
	ret
255 heavyiron 1216
	no_allocation:
1217
 
6354 IgorA 1218
	;*************reflection from left to right*************
255 heavyiron 1219
	cmp eax,23
1220
	jne no_reflection_from_left_to_right
1221
 
1222
	mov ebp,[PointerToPicture]
1223
	mov edx,[ReserveArray]
1224
	mov esi,[Picture_SizeX]
1225
	mov ebx,[Picture_SizeX]
1226
	lea ebx,[ebx+ebx*2]
1227
	shr esi,1
1228
	next_line_reflection_x:
1229
	;copy vertical line to array
1230
	mov ecx,[Picture_SizeX]
1231
	shr ecx,1
1232
	sub ecx,esi
1233
	lea ecx,[ecx+ecx*2]
1234
	add ecx,[PointerToPicture]
1235
	mov edx,[ReserveArray]
1236
	and edi,0
1237
	copy_to_array_line_reflection_y:
1238
	mov eax,[ecx]
1239
	mov ebp,edi
1240
	lea ebp,[ebp+ebp*2]
1241
	mov [edx+ebp],ax
1242
	shr eax,16
1243
	mov [edx+ebp+2],al
1244
	add ecx,ebx
1245
	inc edi
1246
	cmp edi,[Picture_SizeY]
1247
	jne copy_to_array_line_reflection_y
1248
 
1249
	mov ecx,[Picture_SizeX]
1250
	shr ecx,1
1251
	mov ebp,ecx
1252
	add ecx,esi
1253
	dec ecx
1254
	lea ecx,[ecx+ecx*2]
1255
	add ecx,[PointerToPicture]
1256
	sub ebp,esi
1257
	lea ebp,[ebp+ebp*2]
1258
	add ebp,[PointerToPicture]
1259
	and edi,0
1260
	next_line_reflection_y:
1261
	mov eax,[ecx]
1262
	and eax,0xffffff
1263
	mov [ebp],ax
1264
	shr eax,16
1265
	mov [ebp+2],al
1266
	add ebp,ebx
1267
	add ecx,ebx
1268
	inc edi
1269
	cmp edi,[Picture_SizeY]
1270
	jnz next_line_reflection_y
1271
 
1272
	;copy vertical line  from array to screen
1273
	mov ecx,[Picture_SizeX]
1274
	shr ecx,1
1275
	add ecx,esi
1276
	dec ecx
1277
	lea ecx,[ecx+ecx*2]
1278
	add ecx,[PointerToPicture]
1279
	mov edx,[ReserveArray]
1280
	and edi,0
1281
	copy_from_array_to_screen_reflection_y:
1282
	mov ebp,edi
1283
	lea ebp,[ebp+ebp*2]
1284
	xor eax,eax
1285
	mov eax,[edx+ebp]
1286
	mov [ecx],ax
1287
	shr eax,16
1288
	mov [ecx+2],al
1289
	add ecx,ebx
1290
	inc edi
1291
	cmp edi,[Picture_SizeY]
1292
	jne copy_from_array_to_screen_reflection_y
1293
 
1294
	dec esi
1295
	jnz next_line_reflection_x
1296
 
1297
	call MovePictureToWorkScreen
6362 IgorA 1298
	ret
255 heavyiron 1299
	no_reflection_from_left_to_right:
1300
 
6354 IgorA 1301
	;*************reflection from up to down****************
255 heavyiron 1302
	cmp eax,24
1303
	jne no_reflection_from_up_to_down
1304
	mov esi,[Picture_SizeX]
1305
	mov edi,esi
1306
	lea esi,[esi+esi*2]
1307
	lea edi,[edi+edi*2]
1308
	imul edi,[Picture_SizeY]
1309
	mov edx,[ReserveArray]
1310
	mov ecx,[Picture_SizeY]
1311
	shr ecx,1
1312
	add edi,[PointerToPicture]
1313
	sub edi,esi
1314
	mov ebp,[PointerToPicture]
1315
	next_lines_reflection:
1316
	;copy line
1317
	xor ebx,ebx
1318
	copy_line_1:
1319
	xor eax,eax
1320
	mov al,[edi+ebx]
1321
	mov [edx+ebx],al
1322
	inc ebx
1323
	cmp ebx,esi
1324
	jne copy_line_1
1325
 
1326
	xor ebx,ebx
1327
	copy_line_2:
1328
	xor eax,eax
1329
	mov al,[ebp+ebx]
1330
	mov [edi+ebx],al
1331
	inc ebx
1332
	cmp ebx,esi
1333
	jne copy_line_2
1334
 
1335
	xor ebx,ebx
1336
	copy_line_3:
1337
	xor eax,eax
1338
	mov al,[edx+ebx]
1339
	mov [ebp+ebx],al
1340
	inc ebx
1341
	cmp ebx,esi
1342
	jne copy_line_3
1343
 
1344
	add ebp,esi
1345
	sub edi,esi
1346
	dec ecx
1347
	jnz next_lines_reflection
1348
 
1349
	call MovePictureToWorkScreen
6362 IgorA 1350
	ret
255 heavyiron 1351
	no_reflection_from_up_to_down:
1352
 
6354 IgorA 1353
	;*********************draw hard contour*****************
255 heavyiron 1354
	cmp eax,20
1355
	jne no_kontur_
1356
 
1357
	mov [Last_instrument],eax
1358
 
1359
	mov al,[Activate_instrument]
1360
	test al,al
1361
	jnz no_new_konture_xy
1362
 
1363
	mov al,[instrument_used]
1364
	test al,al
1365
	jz instrument_not_used
1366
	mov eax,[used_OldX]
1367
	mov ebx,[used_OldY]
1368
	mov [OldX],eax
1369
	mov [OldY],ebx
1370
	jmp exit_used_instrument
1371
	instrument_not_used:
1372
 
1373
	mov eax,[ScreenX]
1374
	mov ebx,[ScreenY]
1375
	add eax,[PosX]
1376
	add ebx,[PosY]
1377
	mov [OldX],eax
1378
	mov [OldY],ebx
1379
	exit_used_instrument:
1380
 
1381
	mov al,[instrument_used]
1382
	test al,al
1383
	jnz instrument_used_true
1384
	mov [instrument_used],byte 1
1385
	instrument_used_true:
1386
 
1387
	mov [Activate_instrument],1
6342 IgorA 1388
	xor eax,eax
1389
	mov ecx,mem_flood_f/4
1390
	mov edi,[ReserveArray]
1391
	rep stosd
255 heavyiron 1392
 
1393
	no_new_konture_xy:
1394
 
1395
	;put saved pixels
6354 IgorA 1396
	square_width_put
255 heavyiron 1397
 
1398
	;calculate line
1399
	mov ebx,[ReserveArray]
1400
	add ebx,4
1401
	mov eax,[PointerToPicture]
1402
	mov ecx,[Picture_SizeX]
1403
	mov edx,[OldX]
1404
	shl edx,16
1405
	add edx,[OldY]
1406
	mov esi,[ScreenX]
1407
	mov edi,[ScreenY]
1408
	add esi,[PosX]
1409
	add edi,[PosY]
1410
 
1411
	mov ebp,[Picture_SizeX]
1412
	sub ebp,[line_width]
1413
	cmp esi,ebp
1414
	jl no_minimum_x_konture
1415
	mov esi,ebp
1416
	no_minimum_x_konture:
1417
 
1418
	mov ebp,[Picture_SizeY]
1419
	sub ebp,[line_width]
1420
	cmp edi,ebp
1421
	jl no_minimum_y_konture
1422
	mov edi,ebp
1423
	no_minimum_y_konture:
1424
 
1425
	call calculate_line
1426
 
1427
	;save color pixels in ReserveArray
6354 IgorA 1428
	square_width_save
255 heavyiron 1429
 
1430
	;draw calculated pixels on work arrea
6355 IgorA 1431
	draw_calc_pixels width_pixels
255 heavyiron 1432
 
1433
	mov eax,[ScreenX]
1434
	mov ebx,[ScreenY]
1435
	add eax,[PosX]
1436
	add ebx,[PosY]
1437
	mov [used_OldX],eax
1438
	mov [used_OldY],ebx
1439
 
1440
	call MovePictureToWorkScreen
6362 IgorA 1441
	ret
1442
	no_kontur_:
255 heavyiron 1443
 
6354 IgorA 1444
	;************************draw ellips********************
255 heavyiron 1445
	cmp eax,19
1446
	jne no_ellips
1447
 
1448
	mov [Last_instrument],eax
1449
 
1450
	mov al,[Activate_instrument]
1451
	test al,al
1452
	jnz no_new_ellips_xy
1453
	mov eax,[ScreenX]
1454
	mov ebx,[ScreenY]
1455
	add eax,[PosX]
1456
	add ebx,[PosY]
1457
	mov [OldX],eax
1458
	mov [OldY],ebx
1459
	mov [Activate_instrument],1
6342 IgorA 1460
	xor eax,eax
1461
	mov ecx,mem_flood_f/4
1462
	mov edi,[ReserveArray]
6362 IgorA 1463
	cld
6342 IgorA 1464
	rep stosd
6362 IgorA 1465
	ret
255 heavyiron 1466
	no_new_ellips_xy:
1467
 
1468
	;put saved pixels
6354 IgorA 1469
	square_width_put
255 heavyiron 1470
 
1471
 
1472
	mov esi,[ScreenX]
1473
	mov edi,[ScreenY]
1474
	add esi,[PosX]
1475
	add edi,[PosY]
1476
 
1477
	sub esi,[OldX]
1478
	jns no_sign_x_ellips
1479
	neg esi
1480
	shr esi,1
1481
	neg esi
1482
	add esi,[OldX]
1483
	jmp no_plus_sign_x_ellips
1484
	no_sign_x_ellips:
1485
 
1486
	shr esi,1
1487
	add esi,[OldX]
1488
	no_plus_sign_x_ellips:
1489
 
1490
	sub edi,[OldY]
1491
	jns no_sign_y_ellips
1492
	neg edi
1493
	shr edi,1
1494
	neg edi
1495
	add edi,[OldY]
1496
	jmp no_plus_sign_y_ellips
1497
	no_sign_y_ellips:
1498
 
1499
	shr edi,1
1500
	add edi,[OldY]
1501
	no_plus_sign_y_ellips:
1502
 
1503
	mov [x],esi
1504
	mov [y],edi
1505
 
1506
	mov esi,[ScreenX]
1507
	mov edi,[ScreenY]
1508
	add esi,[PosX]
1509
	add edi,[PosY]
1510
 
1511
	sub esi,[OldX]
1512
	jns no_sign_x_ellips_r
1513
	neg esi
1514
	no_sign_x_ellips_r:
1515
 
1516
	sub edi,[OldY]
1517
	jns no_sign_y_ellips_r
1518
	neg edi
1519
	no_sign_y_ellips_r:
1520
 
1521
	cmp edi,0
1522
	jnz no_null_a_ellips
1523
	mov edi,1
1524
	no_null_a_ellips:
1525
 
1526
	shr esi,1
1527
	shr edi,1
1528
	mov [a_ellips],esi
1529
	mov [b_ellips],edi
1530
 
1531
	mov edi,[x]
1532
	mov ebp,[y]
1533
	add edi,esi
1534
	add ebp,esi
1535
 
1536
	mov edx,[Picture_SizeX]
1537
	sub edx,[line_width]
1538
	cmp edi,edx
1539
	jl no_limit_x_ellips
1540
	sub edi,edx
1541
	sub [a_ellips],edi
1542
	no_limit_x_ellips:
1543
 
1544
	mov edx,[Picture_SizeY]
1545
	sub edx,[line_width]
1546
	cmp ebp,edx
1547
	jl no_limit_y_ellips
1548
	sub ebp,edx
1549
	sub [b_ellips],ebp
1550
	no_limit_y_ellips:
1551
 
1552
 
1553
	mov edi,[x]
1554
	mov ebp,[y]
1555
 
1556
	sub edi,[a_ellips]
1557
	jns no_minimum_x_ellips
1558
	add [a_ellips],edi
1559
	no_minimum_x_ellips:
1560
 
1561
	sub ebp,[b_ellips]
1562
	jns no_minimum_y_ellips
1563
	add [b_ellips],ebp
1564
	no_minimum_y_ellips:
1565
 
1566
	;calculate circle
1567
	mov ebx,[ReserveArray]
1568
	add ebx,4
1569
	mov eax,[PointerToPicture]
1570
	mov ecx,[Picture_SizeX]
1571
	mov edx,[x]
1572
	shl edx,16
1573
	add edx,[y]
1574
	mov esi,[a_ellips]
1575
	shl esi,16
1576
	add esi,[b_ellips]
1577
	call calculate_ellips
1578
 
1579
	;save color pixels in ReserveArray
6354 IgorA 1580
	square_width_save
255 heavyiron 1581
 
1582
	;draw calculated pixels on work arrea
6355 IgorA 1583
	draw_calc_pixels width_pixels
255 heavyiron 1584
 
1585
	call MovePictureToWorkScreen
6362 IgorA 1586
	;ret
255 heavyiron 1587
	no_ellips:
1588
 
1589
	ret