Rev 6359 | Rev 6371 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6354 | IgorA | 1 | macro square_width_put |
2 | { |
||
3 | local .no_put_to_screen |
||
4 | local .next_color_put |
||
5 | local .vertical_width_put |
||
6 | local .horizontal_width_put |
||
7 | |||
8 | mov ebx,[ReserveArray] |
||
9 | mov eax,[ebx] |
||
10 | test eax,eax |
||
11 | jz .no_put_to_screen |
||
12 | mov ecx,[ebx] |
||
13 | add ebx,4 |
||
14 | xor ebp,ebp |
||
15 | |||
16 | .next_color_put: |
||
17 | ;put saved pixels in ReserveArray |
||
18 | push ecx |
||
19 | mov [counter2],5 |
||
20 | mov edi,[ebx] |
||
21 | push edi |
||
22 | .vertical_width_put: |
||
23 | mov [counter],5 |
||
24 | |||
25 | .horizontal_width_put: |
||
26 | mov edx,[ebx+4807*4+ebp] |
||
27 | ;and edx,0xffffff |
||
28 | mov [edi],dx |
||
29 | shr edx,16 |
||
30 | mov [edi+2],dl |
||
31 | |||
32 | add edi,3 |
||
33 | add ebp,4 |
||
34 | dec [counter] |
||
35 | jnz .horizontal_width_put |
||
36 | |||
37 | mov ecx,[Picture_SizeX] |
||
38 | sub ecx,5 |
||
39 | lea ecx,[ecx+ecx*2] |
||
40 | add edi,ecx |
||
41 | dec [counter2] |
||
42 | jnz .vertical_width_put |
||
43 | pop edi |
||
44 | pop ecx |
||
45 | |||
46 | add ebx,4 |
||
47 | dec ecx |
||
48 | jnz .next_color_put |
||
49 | |||
50 | .no_put_to_screen: |
||
51 | } |
||
52 | |||
53 | macro square_width_save |
||
54 | { |
||
55 | local .next_color_save |
||
56 | local .vertical_width_save |
||
57 | local .horizontal_width_save |
||
58 | mov ebx,[ReserveArray] |
||
59 | mov [ebx],eax |
||
60 | mov ecx,eax |
||
61 | add ebx,4 |
||
62 | xor ebp,ebp |
||
63 | |||
64 | .next_color_save: |
||
65 | ;save color of pixel in ReserveArray |
||
66 | push ecx |
||
67 | mov [counter2],5 |
||
68 | mov edi,[ebx] |
||
69 | .vertical_width_save: |
||
70 | mov [counter],5 |
||
71 | |||
72 | .horizontal_width_save: |
||
73 | mov eax,edi |
||
74 | mov edx,[eax] |
||
75 | ;and edx,0xffffff |
||
76 | mov [ebx+4807*4+ebp],dx |
||
77 | shr edx,16 |
||
78 | mov [ebx+4807*4+2+ebp],dl |
||
79 | |||
80 | add edi,3 |
||
81 | add ebp,4 |
||
82 | dec [counter] |
||
83 | jnz .horizontal_width_save |
||
84 | |||
85 | mov ecx,[Picture_SizeX] |
||
86 | sub ecx,5 |
||
87 | lea ecx,[ecx+ecx*2] |
||
88 | add edi,ecx |
||
89 | dec [counter2] |
||
90 | jnz .vertical_width_save |
||
91 | pop ecx |
||
92 | |||
93 | add ebx,4 |
||
94 | dec ecx |
||
95 | jnz .next_color_save |
||
96 | } |
||
97 | |||
6355 | IgorA | 98 | macro draw_calc_pixels brush |
99 | { |
||
100 | local .next_pixel_put |
||
101 | local .vertical_width |
||
102 | local .horizontal_width |
||
103 | local .no_draw_pixel |
||
104 | |||
105 | mov ebx,[ReserveArray] |
||
106 | mov ecx,[ebx] |
||
107 | mov edx,[Color] |
||
108 | mov esi,[Color] |
||
109 | shr edx,16 |
||
110 | add ebx,4 |
||
111 | mov edi,[line_width] |
||
112 | dec edi |
||
113 | imul edi,25 |
||
114 | add edi,brush |
||
115 | .next_pixel_put: |
||
116 | |||
117 | mov eax,[ebx] |
||
118 | push eax |
||
119 | push ecx |
||
120 | xor ebp,ebp |
||
121 | mov [counter2],5 |
||
122 | |||
123 | .vertical_width: |
||
124 | mov [counter],5 |
||
125 | |||
126 | .horizontal_width: |
||
127 | xor ecx,ecx |
||
128 | mov cl,byte[edi+ebp] |
||
129 | test cl,cl |
||
130 | jz .no_draw_pixel |
||
131 | mov [eax],si |
||
132 | mov [eax+2],dl |
||
133 | .no_draw_pixel: |
||
134 | add eax,3 |
||
135 | inc ebp |
||
136 | dec [counter] |
||
137 | jnz .horizontal_width |
||
138 | |||
139 | mov ecx,[Picture_SizeX] |
||
140 | sub ecx,5 |
||
141 | lea ecx,[ecx+ecx*2] |
||
142 | add eax,ecx |
||
143 | dec [counter2] |
||
144 | jnz .vertical_width |
||
145 | |||
146 | pop ecx |
||
147 | pop eax |
||
148 | add ebx,4 |
||
149 | dec ecx |
||
150 | jnz .next_pixel_put |
||
151 | } |
||
152 | |||
255 | heavyiron | 153 | ;----------------------------------------------------------- |
154 | ;-----instruments of panel(icon's instruments)-------------- |
||
155 | ;----------------------------------------------------------- |
||
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 |
255 | heavyiron | 1030 | and [Current_instrument],0 |
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 | cmp [instrument_used],0 |
||
1090 | jnz instrument_not_finished_work |
||
1091 | |||
1092 | mov al,[Activate_instrument] |
||
1093 | test al,al |
||
1094 | jnz no_new_allocation_xy |
||
1095 | mov eax,[ScreenX] |
||
1096 | mov ebx,[ScreenY] |
||
1097 | add eax,[PosX] |
||
1098 | add ebx,[PosY] |
||
1099 | mov [OldX],eax |
||
1100 | mov [OldY],ebx |
||
1101 | inc eax |
||
1102 | inc ebx |
||
1103 | mov [rectangular_shade_x],eax |
||
1104 | mov [rectangular_shade_y],ebx |
||
1105 | mov [Activate_instrument],1 |
||
1106 | mov [instrument_used],1 |
||
1107 | and [crossing],0 |
||
1108 | and [finishing_crossing],0 |
||
6342 | IgorA | 1109 | xor eax,eax |
1110 | mov ecx,mem_flood_f/4 |
||
1111 | mov edi,[ReserveArray] |
||
6362 | IgorA | 1112 | cld |
6342 | IgorA | 1113 | rep stosd |
6362 | IgorA | 1114 | ret |
255 | heavyiron | 1115 | no_new_allocation_xy: |
1116 | instrument_not_finished_work: |
||
1117 | |||
1118 | mov al,[instrument_used] |
||
1119 | test al,al |
||
1120 | jz no_change_coordinats |
||
1121 | |||
1122 | cmp [Activate_instrument],0 |
||
1123 | jnz no_change_coordinats |
||
1124 | |||
1125 | ;save coordinates as old if crossing=0 |
||
1126 | cmp [crossing],0 |
||
1127 | jnz no_save_coordinate_of_crossing |
||
1128 | |||
1129 | mov eax,[OldX] |
||
1130 | mov ebx,[OldY] |
||
1131 | |||
1132 | cmp eax,[rectangular_shade_x] |
||
1133 | jl no_remove_x |
||
1134 | mov ecx,[rectangular_shade_x] |
||
1135 | mov [OldX],ecx ; OldX <-----> rectangulare_shade_x |
||
1136 | mov [rectangular_shade_x],eax |
||
1137 | no_remove_x: |
||
1138 | |||
1139 | cmp ebx,[rectangular_shade_y] |
||
1140 | jl no_remove_y |
||
1141 | mov ecx,[rectangular_shade_y] |
||
1142 | mov [OldY],ecx ; OldY <-----> rectangulare_shade_y |
||
1143 | mov [rectangular_shade_y],ebx |
||
1144 | no_remove_y: |
||
1145 | |||
1146 | mov eax,[ScreenX] |
||
1147 | mov ebx,[ScreenY] |
||
1148 | add eax,[PosX] |
||
1149 | add ebx,[PosY] |
||
1150 | mov [crossing_old_x],eax |
||
1151 | mov [crossing_old_y],ebx |
||
1152 | mov [crossing],1 |
||
1153 | |||
1154 | |||
1155 | mov eax,[OldX] |
||
1156 | mov ebx,[OldY] |
||
1157 | inc eax |
||
1158 | inc ebx |
||
1159 | mov [SpriteCoordinatX],eax |
||
1160 | mov [SpriteCoordinatY],ebx |
||
1161 | mov [SpriteOldCoordinatX],eax |
||
1162 | mov [SpriteOldCoordinatY],ebx |
||
1163 | mov esi,[rectangular_shade_x] |
||
1164 | mov edi,[rectangular_shade_y] |
||
1165 | |||
1166 | sub esi,eax |
||
1167 | jns no_sign_sprite_size_x |
||
1168 | neg esi |
||
1169 | no_sign_sprite_size_x: |
||
1170 | |||
1171 | sub edi,ebx |
||
1172 | jns no_sign_sprite_size_y |
||
1173 | neg edi |
||
1174 | no_sign_sprite_size_y: |
||
1175 | |||
1176 | test esi,esi |
||
1177 | jnz no_null_sprite_x |
||
1178 | mov esi,1 |
||
1179 | no_null_sprite_x: |
||
1180 | |||
1181 | test edi,edi |
||
1182 | jnz no_null_sprite_y |
||
1183 | mov edi,1 |
||
1184 | no_null_sprite_y: |
||
1185 | |||
1186 | mov [SpriteSizeX],esi |
||
1187 | mov [SpriteSizeY],edi |
||
1188 | |||
1189 | call SaveFonForSprite |
||
1190 | |||
1191 | no_save_coordinate_of_crossing: |
||
1192 | |||
1193 | cmp [crossing],0 |
||
1194 | je no_test_crossing_with_work_arrea |
||
1195 | ;if mouse situatad after allocation than exit |
||
1196 | push [ScreenX] |
||
1197 | push [ScreenY] |
||
1198 | |||
1199 | call GetScreenCordinats |
||
1200 | |||
1201 | mov eax,[OldX] |
||
1202 | mov ebx,[OldY] |
||
1203 | mov ecx,[ScreenX] |
||
1204 | mov edx,[ScreenY] |
||
1205 | mov esi,[SpriteSizeX] |
||
1206 | mov edi,[SpriteSizeY] |
||
1207 | add ecx,[PosX] |
||
1208 | add edx,[PosY] |
||
6362 | IgorA | 1209 | inc esi |
1210 | inc edi |
||
255 | heavyiron | 1211 | call columnus |
1212 | |||
1213 | test eax,eax |
||
1214 | jnz crossing_with_work_area |
||
1215 | mov [finishing_crossing],1 |
||
1216 | mov [register],1 |
||
1217 | crossing_with_work_area: |
||
1218 | |||
1219 | pop [ScreenY] |
||
1220 | pop [ScreenX] |
||
1221 | |||
1222 | no_test_crossing_with_work_arrea: |
||
1223 | |||
1224 | mov eax,[ScreenX] |
||
1225 | mov ebx,[ScreenY] |
||
1226 | add eax,[PosX] |
||
1227 | add ebx,[PosY] |
||
1228 | mov ecx,eax |
||
1229 | mov edx,ebx |
||
1230 | sub eax,[crossing_old_x] ;dx=(x-oldx) |
||
1231 | sub ebx,[crossing_old_y] ;dy=(y-oldy) |
||
1232 | mov [crossing_old_x],ecx |
||
1233 | mov [crossing_old_y],edx |
||
1234 | |||
1235 | add [OldX],eax ;x1=x1+dx |
||
1236 | add [OldY],ebx ;y1=y1+dy |
||
1237 | add [rectangular_shade_x],eax ;x2=x2+dx |
||
1238 | add [rectangular_shade_y],ebx ;y2+y2+dy |
||
1239 | |||
1240 | mov eax,[OldX] |
||
1241 | mov ebx,[OldY] |
||
1242 | inc eax |
||
1243 | inc ebx |
||
1244 | mov [SpriteCoordinatX],eax |
||
1245 | mov [SpriteCoordinatY],ebx |
||
1246 | |||
1247 | cmp [SpriteCoordinatX],0 |
||
1248 | jns no_null_sprite_coordinat_x |
||
1249 | mov [SpriteCoordinatX],1 |
||
1250 | no_null_sprite_coordinat_x: |
||
1251 | |||
1252 | cmp [SpriteCoordinatY],0 |
||
1253 | jns no_null_sprite_coordinat_y |
||
1254 | mov [SpriteCoordinatY],1 |
||
1255 | no_null_sprite_coordinat_y: |
||
1256 | |||
1257 | mov esi,[rectangular_shade_x] |
||
1258 | mov edi,[rectangular_shade_y] |
||
1259 | |||
1260 | sub esi,[OldX] |
||
1261 | jns no_znak_size_of_rectangulare_crossing_x |
||
1262 | neg esi |
||
1263 | no_znak_size_of_rectangulare_crossing_x: |
||
1264 | |||
1265 | sub edi,[OldY] |
||
1266 | jns no_znak_size_of_rectangulare_crossing_y |
||
1267 | neg edi |
||
1268 | no_znak_size_of_rectangulare_crossing_y: |
||
1269 | |||
1270 | mov ecx,[OldX] |
||
1271 | mov edx,[OldY] |
||
1272 | |||
1273 | sub ecx,[PosX] |
||
1274 | jns no_minimum_x_crossing |
||
1275 | mov ecx,0 |
||
1276 | add ecx,[PosX] |
||
1277 | mov [OldX],ecx |
||
1278 | add ecx,esi |
||
1279 | mov [rectangular_shade_x],ecx |
||
1280 | no_minimum_x_crossing: |
||
1281 | |||
1282 | sub edx,[PosY] |
||
1283 | jns no_minimum_y_crossing |
||
1284 | mov edx,0 |
||
1285 | add edx,[PosY] |
||
1286 | mov [OldY],edx |
||
1287 | add edx,edi |
||
1288 | mov [rectangular_shade_y],edx |
||
1289 | no_minimum_y_crossing: |
||
1290 | |||
1291 | mov ecx,[Picture_SizeX] |
||
1292 | sub ecx,esi |
||
1293 | cmp [OldX],ecx |
||
1294 | jl no_maximum_x_crossing |
||
1295 | dec ecx |
||
1296 | mov [OldX],ecx |
||
1297 | add ecx,esi |
||
1298 | mov [rectangular_shade_x],ecx |
||
1299 | no_maximum_x_crossing: |
||
1300 | |||
1301 | mov edx,[Picture_SizeY] |
||
1302 | sub edx,edi |
||
1303 | cmp [OldY],edx |
||
1304 | jl no_maximum_y_crossing |
||
1305 | dec edx |
||
1306 | mov [OldY],edx |
||
1307 | add edx,edi |
||
1308 | mov [rectangular_shade_y],edx |
||
1309 | no_maximum_y_crossing: |
||
1310 | |||
1311 | mov eax,[rectangular_shade_x] |
||
1312 | mov ebx,[rectangular_shade_y] |
||
1313 | sub eax,[PosX] |
||
1314 | sub ebx,[PosY] |
||
1315 | mov [ScreenX],eax |
||
1316 | mov [ScreenY],ebx |
||
1317 | no_change_coordinats: |
||
1318 | |||
1319 | ;put saved pixels |
||
6354 | IgorA | 1320 | square_width_put |
255 | heavyiron | 1321 | |
1322 | cmp [DrawSprite_flag],1 |
||
1323 | jne no_activate_put_fon_ |
||
1324 | |||
1325 | cmp [Paste_flag],1 |
||
1326 | je no_put_fon___ |
||
1327 | call PutFonForSprite |
||
1328 | no_put_fon___: |
||
1329 | and [Paste_flag],0 |
||
1330 | no_activate_put_fon_: |
||
1331 | |||
1332 | cmp [finishing_crossing],0 |
||
1333 | jz not_finish_from_instrument_crossing |
||
1334 | and [Activate_instrument],0 |
||
1335 | and [crossing],0 |
||
1336 | and [instrument_used],0 |
||
1337 | and [DrawSprite_flag],0 |
||
1338 | call MovePictureToWorkScreen |
||
6362 | IgorA | 1339 | ret |
255 | heavyiron | 1340 | not_finish_from_instrument_crossing: |
1341 | |||
1342 | ;calculate line |
||
1343 | mov ebx,[ReserveArray] |
||
1344 | add ebx,4 |
||
1345 | mov eax,[PointerToPicture] |
||
1346 | mov ecx,[Picture_SizeX] |
||
1347 | mov edx,[OldX] |
||
1348 | shl edx,16 |
||
1349 | add edx,[OldY] |
||
1350 | mov esi,[ScreenX] |
||
1351 | mov edi,[ScreenY] |
||
1352 | add esi,[PosX] |
||
1353 | add edi,[PosY] |
||
1354 | |||
1355 | mov ebp,[Picture_SizeX] |
||
1356 | dec ebp |
||
1357 | cmp esi,ebp |
||
1358 | jl no_minimum_x_allocation |
||
1359 | mov esi,ebp |
||
1360 | no_minimum_x_allocation: |
||
1361 | |||
1362 | mov ebp,[Picture_SizeY] |
||
1363 | dec ebp |
||
1364 | cmp edi,ebp |
||
1365 | jl no_minimum_y_allocation |
||
1366 | mov edi,ebp |
||
1367 | no_minimum_y_allocation: |
||
1368 | |||
1369 | call calculate_rectangle |
||
1370 | |||
1371 | ;save color pixels in ReserveArray |
||
6354 | IgorA | 1372 | square_width_save |
255 | heavyiron | 1373 | |
1374 | cmp [DrawSprite_flag],1 |
||
1375 | jne no_save_fon_for_sprite_ |
||
1376 | ;save current coordinats as old |
||
1377 | mov eax,[SpriteCoordinatX] |
||
1378 | mov ebx,[SpriteCoordinatY] |
||
1379 | mov [SpriteOldCoordinatX],eax |
||
1380 | mov [SpriteOldCoordinatY],ebx |
||
1381 | |||
1382 | call SaveFonForSprite |
||
1383 | |||
1384 | no_save_fon_for_sprite_: |
||
1385 | |||
1386 | ;draw calculated pixels on work arrea |
||
1387 | mov ebx,[ReserveArray] |
||
1388 | mov ecx,[ebx] |
||
1389 | add ebx,4 |
||
1390 | next_pixel_put_allocation: |
||
1391 | |||
1392 | mov edx,0x1f3fff |
||
1393 | mov esi,edx |
||
1394 | shr edx,16 |
||
1395 | |||
1396 | mov ebp,ecx |
||
1397 | and ebp,8 |
||
1398 | cmp ebp,8 |
||
1399 | jne black_color |
||
1400 | mov si,0xffff |
||
1401 | mov dl,0xff |
||
1402 | black_color: |
||
1403 | |||
1404 | mov eax,[ebx] |
||
1405 | mov [eax],si |
||
1406 | mov [eax+2],dl |
||
1407 | |||
1408 | add ebx,4 |
||
1409 | dec ecx |
||
1410 | jnz next_pixel_put_allocation |
||
1411 | |||
1412 | cmp [DrawSprite_flag],1 |
||
1413 | jne no_activate_draw_sprite_ |
||
1414 | |||
1415 | call DrawSprite |
||
1416 | |||
1417 | no_activate_draw_sprite_: |
||
1418 | |||
1419 | mov al,[instrument_used] |
||
1420 | test al,al |
||
1421 | jz no_change_coordinats |
||
1422 | cmp [Activate_instrument],0 |
||
1423 | jz no_save_shades |
||
1424 | mov eax,[ScreenX] |
||
1425 | mov ebx,[ScreenY] |
||
1426 | add eax,[PosX] |
||
1427 | add ebx,[PosY] |
||
1428 | mov [rectangular_shade_x],eax |
||
1429 | mov [rectangular_shade_y],ebx |
||
1430 | no_save_shades: |
||
1431 | |||
1432 | call MovePictureToWorkScreen |
||
6362 | IgorA | 1433 | ret |
255 | heavyiron | 1434 | no_allocation: |
1435 | |||
6354 | IgorA | 1436 | ;*************reflection from left to right************* |
255 | heavyiron | 1437 | cmp eax,23 |
1438 | jne no_reflection_from_left_to_right |
||
1439 | |||
1440 | mov ebp,[PointerToPicture] |
||
1441 | mov edx,[ReserveArray] |
||
1442 | mov esi,[Picture_SizeX] |
||
1443 | mov ebx,[Picture_SizeX] |
||
1444 | lea ebx,[ebx+ebx*2] |
||
1445 | shr esi,1 |
||
1446 | next_line_reflection_x: |
||
1447 | ;copy vertical line to array |
||
1448 | mov ecx,[Picture_SizeX] |
||
1449 | shr ecx,1 |
||
1450 | sub ecx,esi |
||
1451 | lea ecx,[ecx+ecx*2] |
||
1452 | add ecx,[PointerToPicture] |
||
1453 | mov edx,[ReserveArray] |
||
1454 | and edi,0 |
||
1455 | copy_to_array_line_reflection_y: |
||
1456 | mov eax,[ecx] |
||
1457 | mov ebp,edi |
||
1458 | lea ebp,[ebp+ebp*2] |
||
1459 | mov [edx+ebp],ax |
||
1460 | shr eax,16 |
||
1461 | mov [edx+ebp+2],al |
||
1462 | add ecx,ebx |
||
1463 | inc edi |
||
1464 | cmp edi,[Picture_SizeY] |
||
1465 | jne copy_to_array_line_reflection_y |
||
1466 | |||
1467 | mov ecx,[Picture_SizeX] |
||
1468 | shr ecx,1 |
||
1469 | mov ebp,ecx |
||
1470 | add ecx,esi |
||
1471 | dec ecx |
||
1472 | lea ecx,[ecx+ecx*2] |
||
1473 | add ecx,[PointerToPicture] |
||
1474 | sub ebp,esi |
||
1475 | lea ebp,[ebp+ebp*2] |
||
1476 | add ebp,[PointerToPicture] |
||
1477 | and edi,0 |
||
1478 | next_line_reflection_y: |
||
1479 | mov eax,[ecx] |
||
1480 | and eax,0xffffff |
||
1481 | mov [ebp],ax |
||
1482 | shr eax,16 |
||
1483 | mov [ebp+2],al |
||
1484 | add ebp,ebx |
||
1485 | add ecx,ebx |
||
1486 | inc edi |
||
1487 | cmp edi,[Picture_SizeY] |
||
1488 | jnz next_line_reflection_y |
||
1489 | |||
1490 | ;copy vertical line from array to screen |
||
1491 | mov ecx,[Picture_SizeX] |
||
1492 | shr ecx,1 |
||
1493 | add ecx,esi |
||
1494 | dec ecx |
||
1495 | lea ecx,[ecx+ecx*2] |
||
1496 | add ecx,[PointerToPicture] |
||
1497 | mov edx,[ReserveArray] |
||
1498 | and edi,0 |
||
1499 | copy_from_array_to_screen_reflection_y: |
||
1500 | mov ebp,edi |
||
1501 | lea ebp,[ebp+ebp*2] |
||
1502 | xor eax,eax |
||
1503 | mov eax,[edx+ebp] |
||
1504 | mov [ecx],ax |
||
1505 | shr eax,16 |
||
1506 | mov [ecx+2],al |
||
1507 | add ecx,ebx |
||
1508 | inc edi |
||
1509 | cmp edi,[Picture_SizeY] |
||
1510 | jne copy_from_array_to_screen_reflection_y |
||
1511 | |||
1512 | dec esi |
||
1513 | jnz next_line_reflection_x |
||
1514 | |||
1515 | call MovePictureToWorkScreen |
||
6362 | IgorA | 1516 | ret |
255 | heavyiron | 1517 | no_reflection_from_left_to_right: |
1518 | |||
6354 | IgorA | 1519 | ;*************reflection from up to down**************** |
255 | heavyiron | 1520 | cmp eax,24 |
1521 | jne no_reflection_from_up_to_down |
||
1522 | mov esi,[Picture_SizeX] |
||
1523 | mov edi,esi |
||
1524 | lea esi,[esi+esi*2] |
||
1525 | lea edi,[edi+edi*2] |
||
1526 | imul edi,[Picture_SizeY] |
||
1527 | mov edx,[ReserveArray] |
||
1528 | mov ecx,[Picture_SizeY] |
||
1529 | shr ecx,1 |
||
1530 | add edi,[PointerToPicture] |
||
1531 | sub edi,esi |
||
1532 | mov ebp,[PointerToPicture] |
||
1533 | next_lines_reflection: |
||
1534 | ;copy line |
||
1535 | xor ebx,ebx |
||
1536 | copy_line_1: |
||
1537 | xor eax,eax |
||
1538 | mov al,[edi+ebx] |
||
1539 | mov [edx+ebx],al |
||
1540 | inc ebx |
||
1541 | cmp ebx,esi |
||
1542 | jne copy_line_1 |
||
1543 | |||
1544 | xor ebx,ebx |
||
1545 | copy_line_2: |
||
1546 | xor eax,eax |
||
1547 | mov al,[ebp+ebx] |
||
1548 | mov [edi+ebx],al |
||
1549 | inc ebx |
||
1550 | cmp ebx,esi |
||
1551 | jne copy_line_2 |
||
1552 | |||
1553 | xor ebx,ebx |
||
1554 | copy_line_3: |
||
1555 | xor eax,eax |
||
1556 | mov al,[edx+ebx] |
||
1557 | mov [ebp+ebx],al |
||
1558 | inc ebx |
||
1559 | cmp ebx,esi |
||
1560 | jne copy_line_3 |
||
1561 | |||
1562 | add ebp,esi |
||
1563 | sub edi,esi |
||
1564 | dec ecx |
||
1565 | jnz next_lines_reflection |
||
1566 | |||
1567 | call MovePictureToWorkScreen |
||
6362 | IgorA | 1568 | ret |
255 | heavyiron | 1569 | no_reflection_from_up_to_down: |
1570 | |||
6354 | IgorA | 1571 | ;*********************draw hard contour***************** |
255 | heavyiron | 1572 | cmp eax,20 |
1573 | jne no_kontur_ |
||
1574 | |||
1575 | mov [Last_instrument],eax |
||
1576 | |||
1577 | mov al,[Activate_instrument] |
||
1578 | test al,al |
||
1579 | jnz no_new_konture_xy |
||
1580 | |||
1581 | mov al,[instrument_used] |
||
1582 | test al,al |
||
1583 | jz instrument_not_used |
||
1584 | mov eax,[used_OldX] |
||
1585 | mov ebx,[used_OldY] |
||
1586 | mov [OldX],eax |
||
1587 | mov [OldY],ebx |
||
1588 | jmp exit_used_instrument |
||
1589 | instrument_not_used: |
||
1590 | |||
1591 | mov eax,[ScreenX] |
||
1592 | mov ebx,[ScreenY] |
||
1593 | add eax,[PosX] |
||
1594 | add ebx,[PosY] |
||
1595 | mov [OldX],eax |
||
1596 | mov [OldY],ebx |
||
1597 | exit_used_instrument: |
||
1598 | |||
1599 | mov al,[instrument_used] |
||
1600 | test al,al |
||
1601 | jnz instrument_used_true |
||
1602 | mov [instrument_used],byte 1 |
||
1603 | instrument_used_true: |
||
1604 | |||
1605 | mov [Activate_instrument],1 |
||
6342 | IgorA | 1606 | xor eax,eax |
1607 | mov ecx,mem_flood_f/4 |
||
1608 | mov edi,[ReserveArray] |
||
1609 | rep stosd |
||
255 | heavyiron | 1610 | |
1611 | no_new_konture_xy: |
||
1612 | |||
1613 | ;put saved pixels |
||
6354 | IgorA | 1614 | square_width_put |
255 | heavyiron | 1615 | |
1616 | ;calculate line |
||
1617 | mov ebx,[ReserveArray] |
||
1618 | add ebx,4 |
||
1619 | mov eax,[PointerToPicture] |
||
1620 | mov ecx,[Picture_SizeX] |
||
1621 | mov edx,[OldX] |
||
1622 | shl edx,16 |
||
1623 | add edx,[OldY] |
||
1624 | mov esi,[ScreenX] |
||
1625 | mov edi,[ScreenY] |
||
1626 | add esi,[PosX] |
||
1627 | add edi,[PosY] |
||
1628 | |||
1629 | mov ebp,[Picture_SizeX] |
||
1630 | sub ebp,[line_width] |
||
1631 | cmp esi,ebp |
||
1632 | jl no_minimum_x_konture |
||
1633 | mov esi,ebp |
||
1634 | no_minimum_x_konture: |
||
1635 | |||
1636 | mov ebp,[Picture_SizeY] |
||
1637 | sub ebp,[line_width] |
||
1638 | cmp edi,ebp |
||
1639 | jl no_minimum_y_konture |
||
1640 | mov edi,ebp |
||
1641 | no_minimum_y_konture: |
||
1642 | |||
1643 | call calculate_line |
||
1644 | |||
1645 | ;save color pixels in ReserveArray |
||
6354 | IgorA | 1646 | square_width_save |
255 | heavyiron | 1647 | |
1648 | ;draw calculated pixels on work arrea |
||
6355 | IgorA | 1649 | draw_calc_pixels width_pixels |
255 | heavyiron | 1650 | |
1651 | mov eax,[ScreenX] |
||
1652 | mov ebx,[ScreenY] |
||
1653 | add eax,[PosX] |
||
1654 | add ebx,[PosY] |
||
1655 | mov [used_OldX],eax |
||
1656 | mov [used_OldY],ebx |
||
1657 | |||
1658 | call MovePictureToWorkScreen |
||
6362 | IgorA | 1659 | ret |
1660 | no_kontur_: |
||
255 | heavyiron | 1661 | |
6354 | IgorA | 1662 | ;************************draw ellips******************** |
255 | heavyiron | 1663 | cmp eax,19 |
1664 | jne no_ellips |
||
1665 | |||
1666 | mov [Last_instrument],eax |
||
1667 | |||
1668 | mov al,[Activate_instrument] |
||
1669 | test al,al |
||
1670 | jnz no_new_ellips_xy |
||
1671 | mov eax,[ScreenX] |
||
1672 | mov ebx,[ScreenY] |
||
1673 | add eax,[PosX] |
||
1674 | add ebx,[PosY] |
||
1675 | mov [OldX],eax |
||
1676 | mov [OldY],ebx |
||
1677 | mov [Activate_instrument],1 |
||
6342 | IgorA | 1678 | xor eax,eax |
1679 | mov ecx,mem_flood_f/4 |
||
1680 | mov edi,[ReserveArray] |
||
6362 | IgorA | 1681 | cld |
6342 | IgorA | 1682 | rep stosd |
6362 | IgorA | 1683 | ret |
255 | heavyiron | 1684 | no_new_ellips_xy: |
1685 | |||
1686 | ;put saved pixels |
||
6354 | IgorA | 1687 | square_width_put |
255 | heavyiron | 1688 | |
1689 | |||
1690 | mov esi,[ScreenX] |
||
1691 | mov edi,[ScreenY] |
||
1692 | add esi,[PosX] |
||
1693 | add edi,[PosY] |
||
1694 | |||
1695 | sub esi,[OldX] |
||
1696 | jns no_sign_x_ellips |
||
1697 | neg esi |
||
1698 | shr esi,1 |
||
1699 | neg esi |
||
1700 | add esi,[OldX] |
||
1701 | jmp no_plus_sign_x_ellips |
||
1702 | no_sign_x_ellips: |
||
1703 | |||
1704 | shr esi,1 |
||
1705 | add esi,[OldX] |
||
1706 | no_plus_sign_x_ellips: |
||
1707 | |||
1708 | sub edi,[OldY] |
||
1709 | jns no_sign_y_ellips |
||
1710 | neg edi |
||
1711 | shr edi,1 |
||
1712 | neg edi |
||
1713 | add edi,[OldY] |
||
1714 | jmp no_plus_sign_y_ellips |
||
1715 | no_sign_y_ellips: |
||
1716 | |||
1717 | shr edi,1 |
||
1718 | add edi,[OldY] |
||
1719 | no_plus_sign_y_ellips: |
||
1720 | |||
1721 | mov [x],esi |
||
1722 | mov [y],edi |
||
1723 | |||
1724 | mov esi,[ScreenX] |
||
1725 | mov edi,[ScreenY] |
||
1726 | add esi,[PosX] |
||
1727 | add edi,[PosY] |
||
1728 | |||
1729 | sub esi,[OldX] |
||
1730 | jns no_sign_x_ellips_r |
||
1731 | neg esi |
||
1732 | no_sign_x_ellips_r: |
||
1733 | |||
1734 | sub edi,[OldY] |
||
1735 | jns no_sign_y_ellips_r |
||
1736 | neg edi |
||
1737 | no_sign_y_ellips_r: |
||
1738 | |||
1739 | cmp edi,0 |
||
1740 | jnz no_null_a_ellips |
||
1741 | mov edi,1 |
||
1742 | no_null_a_ellips: |
||
1743 | |||
1744 | shr esi,1 |
||
1745 | shr edi,1 |
||
1746 | mov [a_ellips],esi |
||
1747 | mov [b_ellips],edi |
||
1748 | |||
1749 | mov edi,[x] |
||
1750 | mov ebp,[y] |
||
1751 | add edi,esi |
||
1752 | add ebp,esi |
||
1753 | |||
1754 | mov edx,[Picture_SizeX] |
||
1755 | sub edx,[line_width] |
||
1756 | cmp edi,edx |
||
1757 | jl no_limit_x_ellips |
||
1758 | sub edi,edx |
||
1759 | sub [a_ellips],edi |
||
1760 | no_limit_x_ellips: |
||
1761 | |||
1762 | mov edx,[Picture_SizeY] |
||
1763 | sub edx,[line_width] |
||
1764 | cmp ebp,edx |
||
1765 | jl no_limit_y_ellips |
||
1766 | sub ebp,edx |
||
1767 | sub [b_ellips],ebp |
||
1768 | no_limit_y_ellips: |
||
1769 | |||
1770 | |||
1771 | mov edi,[x] |
||
1772 | mov ebp,[y] |
||
1773 | |||
1774 | sub edi,[a_ellips] |
||
1775 | jns no_minimum_x_ellips |
||
1776 | add [a_ellips],edi |
||
1777 | no_minimum_x_ellips: |
||
1778 | |||
1779 | sub ebp,[b_ellips] |
||
1780 | jns no_minimum_y_ellips |
||
1781 | add [b_ellips],ebp |
||
1782 | no_minimum_y_ellips: |
||
1783 | |||
1784 | ;calculate circle |
||
1785 | mov ebx,[ReserveArray] |
||
1786 | add ebx,4 |
||
1787 | mov eax,[PointerToPicture] |
||
1788 | mov ecx,[Picture_SizeX] |
||
1789 | mov edx,[x] |
||
1790 | shl edx,16 |
||
1791 | add edx,[y] |
||
1792 | mov esi,[a_ellips] |
||
1793 | shl esi,16 |
||
1794 | add esi,[b_ellips] |
||
1795 | call calculate_ellips |
||
1796 | |||
1797 | ;save color pixels in ReserveArray |
||
6354 | IgorA | 1798 | square_width_save |
255 | heavyiron | 1799 | |
1800 | ;draw calculated pixels on work arrea |
||
6355 | IgorA | 1801 | draw_calc_pixels width_pixels |
255 | heavyiron | 1802 | |
1803 | call MovePictureToWorkScreen |
||
6362 | IgorA | 1804 | ;ret |
255 | heavyiron | 1805 | no_ellips: |
1806 | |||
1807 | ret----->-----> |