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