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