From bab525b2cff325d57f691fde0b5a2fe81d744429 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Mon, 4 Oct 2010 20:40:19 +0000 Subject: [PATCH] Animage v1.3 1) Fixed window flicker when redrawing 2) Fixed memory leak for stack git-svn-id: svn://kolibrios.org@1643 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/media/animage/trunk/animage.asm | 29 +- programs/media/animage/trunk/design.inc | 598 ++++--- .../media/animage/trunk/events_of_mouse.inc | 469 +++--- .../media/animage/trunk/events_of_window.inc | 229 ++- programs/media/animage/trunk/init_data.inc | 70 +- .../animage/trunk/load_from_parameters.inc | 183 +-- programs/media/animage/trunk/memory.inc | 37 +- .../media/animage/trunk/menu_instruments.inc | 1385 ++++++++--------- programs/media/animage/trunk/palette.inc | 86 +- programs/media/animage/trunk/panel_data.inc | 2 +- programs/media/animage/trunk/panel_engen.inc | 804 ++++------ programs/media/animage/trunk/screen.inc | 587 ++++--- 12 files changed, 2070 insertions(+), 2409 deletions(-) diff --git a/programs/media/animage/trunk/animage.asm b/programs/media/animage/trunk/animage.asm index 2e755863b..890ec80b3 100644 --- a/programs/media/animage/trunk/animage.asm +++ b/programs/media/animage/trunk/animage.asm @@ -1,6 +1,12 @@ ;******************************************************* ;**************GRAPHICS EDITOR ANIMAGE ***************** ;******************************************************* +; version: 1.3 +; last update: 05/10/2010 +; written by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Fixed window flicker when redrawing, +; Fixed memory leak for stack +;-------------------------------------------------------- ; version: 1.2 ; last update: 30/09/2010 ; written by: Marat Zakiyanov aka Mario79, aka Mario @@ -69,7 +75,7 @@ include 'init_data.inc' call drawwin ;--------------------------------------------------------- -;---------Check loading of file from psrsmeters----------- +;---------Check loading of file from parameters----------- ;--------------------------------------------------------- ; mov eax,parameters ; mov ebx,file_path @@ -98,15 +104,14 @@ include 'init_data.inc' ;---------------------------------------------------------- ;---------------------MAIN LOOP---------------------------- ;---------------------------------------------------------- +red: + call drawwin still: call event + cmp eax,1 - jne no_redraw_window + je red - call drawwin - jmp still - -no_redraw_window: cmp eax,2 je keys @@ -139,7 +144,7 @@ include 'events_of_buttons.inc' include 'events_of_mouse.inc' include 'panel_engen.inc' include 'screen.inc' -include 'menu_instruments.inc' +include 'menu_instruments.inc' include 'icons_instruments.inc' include 'icons.inc' include 'sprites.inc' @@ -152,6 +157,7 @@ include 'memory.inc' ;------------variables and data of program------------------ ;----------------------------------------------------------- sound_havent_memory db 150,64,0 + include 'lib_data.inc' include 'panel_data.inc' include 'palitra256.inc' @@ -306,13 +312,9 @@ IncludeUGlobals align 4 CursorsID rd 10 ;--------------------------------------------------------------------- -;align 4 -;parameters -; rb 257 -;--------------------------------------------------------------------- align 4 file_path: - rb 4096 ;rb 1024+16 + rb 4096 ;--------------------------------------------------------------------- align 4 filename_area: @@ -334,9 +336,6 @@ align 4 procinfo: rb 1024 ;--------------------------------------------------------------------- -align 4 -IPC_table rd 256 -;--------------------------------------------------------------------- align 4 rb 4096 stacktop: diff --git a/programs/media/animage/trunk/design.inc b/programs/media/animage/trunk/design.inc index 22449c1ea..26bafcea8 100644 --- a/programs/media/animage/trunk/design.inc +++ b/programs/media/animage/trunk/design.inc @@ -1,334 +1,314 @@ -;----------------------------------------------------- +;---------------------------------------------------------- draw_volume_rectangle: + mov [line_x],eax + mov [line_y],ebx + mov [line_size_x],ecx + mov [line_size_y],edx + cmp esi,1 + jne no_volume_light_rectangle - mov [line_x],eax - mov [line_y],ebx - mov [line_size_x],ecx - mov [line_size_y],edx + mov [color_rectangle],0xc7cbcf + mov [color_line1],0xaeabae + mov [color_line2],0xffffff + mov [color_line3],0xc7cbcf + jmp exit_colors +;---------------------------------------------------------- +no_volume_light_rectangle: + cmp esi,2 + jne no_pressed_rectangle - cmp esi,1 - jne no_volume_light_rectangle + mov [color_rectangle],0x666666 + mov [color_line1],0xaeabae + mov [color_line2],0x666666 + mov [color_line3],0x666666 + jmp exit_colors +;---------------------------------------------------------- +no_pressed_rectangle: + cmp esi,3 + jne no_pressed_panel - mov [color_rectangle],0xc7cbcf - mov [color_line1],0xaeabae - mov [color_line2],0xffffff - mov [color_line3],0xc7cbcf - jmp exit_colors + mov [color_rectangle],0xc7cbcf + mov [color_line1],0xaeabae + mov [color_line2],7000 + mov [color_line3],0xffffff + jmp exit_colors +;---------------------------------------------------------- +no_pressed_panel: + cmp esi,4 + jne no_pressed_light_panel - no_volume_light_rectangle: + mov [color_rectangle],0xffffff + mov [color_line1],0xaeabae + mov [color_line2],7000 + mov [color_line3],0xffffff + jmp exit_colors +;---------------------------------------------------------- +no_pressed_light_panel: + cmp esi,5 + jne no_light_pressed_rectangle - cmp esi,2 - jne no_pressed_rectangle + mov [color_rectangle],0x666666 + mov [color_line1],0xaeabae + mov [color_line2],0x666666 + mov [color_line3],0x666666 + jmp exit_colors +;---------------------------------------------------------- +no_light_pressed_rectangle: + cmp esi,6 + jne no_work_rectangle - mov [color_rectangle],0x666666 - mov [color_line1],0xaeabae - mov [color_line2],0x666666 - mov [color_line3],0x666666 + mov [color_rectangle],0xc7cbcf + mov [color_line1],0xaeabae + mov [color_line2],0xc7cbcf + mov [color_line3],0xc7cbcf + jmp exit_colors +;---------------------------------------------------------- +no_work_rectangle: + cmp esi,7 + jne no_work_rectangle_2 - jmp exit_colors - - no_pressed_rectangle: - - cmp esi,3 - jne no_pressed_panel - - mov [color_rectangle],0xc7cbcf - mov [color_line1],0xaeabae - mov [color_line2],7000 - mov [color_line3],0xffffff - jmp exit_colors - - no_pressed_panel: - - cmp esi,4 - jne no_pressed_light_panel - - mov [color_rectangle],0xffffff - mov [color_line1],0xaeabae - mov [color_line2],7000 - mov [color_line3],0xffffff - jmp exit_colors - - no_pressed_light_panel: - - cmp esi,5 - jne no_light_pressed_rectangle - - mov [color_rectangle],0x666666 - mov [color_line1],0xaeabae - mov [color_line2],0x666666 - mov [color_line3],0x666666 - - jmp exit_colors - - no_light_pressed_rectangle: - - cmp esi,6 - jne no_work_rectangle - - mov [color_rectangle],0xc7cbcf - mov [color_line1],0xaeabae - mov [color_line2],0xc7cbcf - mov [color_line3],0xc7cbcf - jmp exit_colors - - no_work_rectangle: - - cmp esi,7 - jne no_work_rectangle_2 - - mov [color_rectangle],0xc7cbcf - mov [color_line1],0xc7cbcf - mov [color_line2],0xc7cbcf - mov [color_line3],0xc7cbcf - jmp exit_colors - - no_work_rectangle_2: - - exit_colors: - ;draw rectangle - mov ebx,[line_x] - mov ecx,[line_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_size_x] - add ecx,[line_size_y] - mov edx,[color_rectangle] - call draw_rectangle - ;line 1 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - call draw_line - ;line 2 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ecx,[line_size_y] - call draw_line - ;line 3 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - add ecx,[line_size_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - add ecx,[line_size_y] - call draw_line - ;line 4 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - add ebx,[line_size_x] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - add ecx,[line_size_y] - call draw_line - ;light line 1 - mov edx,[color_line2] - mov ebx,[line_x] - mov ecx,[line_y] - inc ebx - inc ecx - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - dec ebx - inc ecx - call draw_line - ;light line 2 - mov edx,[color_line2] - mov ebx,[line_x] - mov ecx,[line_y] - inc ebx - inc ecx - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ecx,[line_size_y] - dec ecx - inc ebx - call draw_line - ;light line 3 - mov edx,[color_line3] - mov ebx,[line_x] - mov ecx,[line_y] - add ebx,[line_size_x] - dec ebx - inc ecx - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - add ecx,[line_size_y] - dec ebx - dec ecx - call draw_line - ;light line 4 - mov edx,[color_line3] - mov ebx,[line_x] - mov ecx,[line_y] - add ecx,[line_size_y] - inc ebx - dec ecx - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ecx,[line_size_y] - add ebx,[line_size_x] - dec ecx - dec ebx - call draw_line - - ret + mov [color_rectangle],0xc7cbcf + mov [color_line1],0xc7cbcf + mov [color_line2],0xc7cbcf + mov [color_line3],0xc7cbcf + jmp exit_colors +;---------------------------------------------------------- +no_work_rectangle_2: +exit_colors: +;draw rectangle + mov ebx,[line_x] + mov ecx,[line_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_size_x] + add ecx,[line_size_y] + mov edx,[color_rectangle] + call draw_rectangle +;line 1 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + call draw_line +;line 2 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ecx,[line_size_y] + call draw_line +;line 3 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + add ecx,[line_size_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + add ecx,[line_size_y] + call draw_line +;line 4 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + add ebx,[line_size_x] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + add ecx,[line_size_y] + call draw_line +;light line 1 + mov edx,[color_line2] + mov ebx,[line_x] + mov ecx,[line_y] + inc ebx + inc ecx + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + dec ebx + inc ecx + call draw_line +;light line 2 + mov edx,[color_line2] + mov ebx,[line_x] + mov ecx,[line_y] + inc ebx + inc ecx + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ecx,[line_size_y] + dec ecx + inc ebx + call draw_line +;light line 3 + mov edx,[color_line3] + mov ebx,[line_x] + mov ecx,[line_y] + add ebx,[line_size_x] + dec ebx + inc ecx + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + add ecx,[line_size_y] + dec ebx + dec ecx + call draw_line +;light line 4 + mov edx,[color_line3] + mov ebx,[line_x] + mov ecx,[line_y] + add ecx,[line_size_y] + inc ebx + dec ecx + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ecx,[line_size_y] + add ebx,[line_size_x] + dec ecx + dec ebx + call draw_line + ret ;---------------------------------------------------------- rectangle: - - no_light_rectangle: - mov [line_x],eax - mov [line_y],ebx - mov [line_size_x],ecx - mov [line_size_y],edx - mov edx,esi - mov eax,13 - mov ebx,[line_x] - mov ecx,[line_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_size_x] - add ecx,[line_size_y] - mcall - ret +no_light_rectangle: + mov [line_x],eax + mov [line_y],ebx + mov [line_size_x],ecx + mov [line_size_y],edx + mov edx,esi + mov eax,13 + mov ebx,[line_x] + mov ecx,[line_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_size_x] + add ecx,[line_size_y] + mcall + ret ;---------------------------------------------------------- draw_conture: - - mov [line_x],eax - mov [line_y],ebx - mov [line_size_x],ecx - mov [line_size_y],edx - - mov [color_line1],0xaeabae - - - ;line 1 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - call draw_line - ;line 2 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ecx,[line_size_y] - call draw_line - ;line 3 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - add ecx,[line_size_y] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - add ecx,[line_size_y] - call draw_line - ;line 4 - mov edx,[color_line1] - mov ebx,[line_x] - mov ecx,[line_y] - add ebx,[line_size_x] - shl ebx,16 - shl ecx,16 - add ebx,[line_x] - add ecx,[line_y] - add ebx,[line_size_x] - add ecx,[line_size_y] - call draw_line - - ret + mov [line_x],eax + mov [line_y],ebx + mov [line_size_x],ecx + mov [line_size_y],edx + mov [color_line1],0xaeabae +;line 1 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + call draw_line +;line 2 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ecx,[line_size_y] + call draw_line +;line 3 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + add ecx,[line_size_y] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + add ecx,[line_size_y] + call draw_line +;line 4 + mov edx,[color_line1] + mov ebx,[line_x] + mov ecx,[line_y] + add ebx,[line_size_x] + shl ebx,16 + shl ecx,16 + add ebx,[line_x] + add ecx,[line_y] + add ebx,[line_size_x] + add ecx,[line_size_y] + call draw_line + ret ;---------------------------------------------------------- columnus: - - sub eax,ecx - jns no_columnus - neg eax - cmp eax,esi - ja no_columnus - sub ebx,edx - jns no_columnus - neg ebx - cmp ebx,edi - ja no_columnus - mov eax,1 - jmp columnus_true - no_columnus: - xor eax,eax - columnus_true: - ret + sub eax,ecx + jns no_columnus + neg eax + cmp eax,esi + ja no_columnus + sub ebx,edx + jns no_columnus + neg ebx + cmp ebx,edi + ja no_columnus + mov eax,1 + jmp columnus_true +no_columnus: + xor eax,eax +columnus_true: + ret ;---------------------------------------------------------- print_text: - mov [text_x],eax - mov [text_y],ebx - mov eax,4 - mov ebx,[text_x] - shl ebx,16 - add ebx,[text_y] - mcall - ret + mov [text_x],eax + mov [text_y],ebx + mov eax,4 + mov ebx,[text_x] + shl ebx,16 + add ebx,[text_y] + mcall + ret ;---------------------------------------------------------- draw_rectangle: - mov eax,13 - mcall - ret + mcall 13 + ret ;------------------------ draw_line: - mov eax,38 - mcall - ret + mov eax,38 + mcall + ret ;---------------------------------------------------------- ;lightlin 12508927 -;lines 5669590 -;workpan 9350879 +;lines 5669590 +;workpan 9350879 ;btnpress 9089258 -line_x dd 0 -line_y dd 0 -line_size_x dd 0 -line_size_y dd 0 -color_line1 dd 0 -color_line2 dd 0 -color_line3 dd 0 -color_rectangle dd 0 +line_x dd 0 +line_y dd 0 +line_size_x dd 0 +line_size_y dd 0 +color_line1 dd 0 +color_line2 dd 0 +color_line3 dd 0 +color_rectangle dd 0 ;-------------------- -text_x dd 0 -text_y dd 0 +text_x dd 0 +text_y dd 0 ;-------------------- \ No newline at end of file diff --git a/programs/media/animage/trunk/events_of_mouse.inc b/programs/media/animage/trunk/events_of_mouse.inc index f2febf0ea..90db7d386 100644 --- a/programs/media/animage/trunk/events_of_mouse.inc +++ b/programs/media/animage/trunk/events_of_mouse.inc @@ -2,317 +2,270 @@ ;-------------interraction MOUSE-------------- ;--------------------------------------------- mouse: + call GetMouseCoordinats +;panel + mov edx,[Window_SizeX] + sub edx,5 - call GetMouseCoordinats + cmp ebx,20 + jle no_panel - ;panel - mov edx,[Window_SizeX] - sub edx,5 + cmp ebx,20+15 + jae no_panel - cmp ebx,20 - jle no_panel + cmp eax,5 + jle no_panel - cmp ebx,20+15 - jae no_panel + cmp eax,edx ;585 + jae no_panel - cmp eax,5 - jle no_panel + call GetMouseCoordinats + mov [counter],7 + mov edi,panel_text + jmp panel_interraction - cmp eax,edx ;585 - jae no_panel +no_panel: + cmp [Panel_flag],0 + jz no_redraw_panel - call GetMouseCoordinats + mov [counter],7 + mov edi,panel_text + jmp panel_interraction - mov [counter],7 - mov edi,panel_text - call panel_interraction +no_redraw_panel: + call GetMouseCoordinats + mov eax,[MouseX] + mov ebx,[MouseY] + mov ecx,[WorkScreen_SizeX] + mov edx,[WorkScreen_SizeY] + add ecx,9 + add edx,89 - jmp still - no_panel: + cmp eax,ecx + jae mouse_scroll - cmp [Panel_flag],0 - jz no_redraw_panel + cmp ebx,edx + jae mouse_scroll + jmp no_scrollers - mov [counter],7 - mov edi,panel_text - call panel_interraction +mouse_scroll: + mov [exit_from_work_arrea],1 ;mouse situated after work arrea +;scrollers + call GetMouseClick + cmp eax,1 + jne no_click - no_redraw_panel: + call GetMouseCoordinats +;interraction with horizontal scroller + mov eax,[Scroll1CoordinatX] + mov ebx,[Scroll1CoordinatY] + mov ecx,[MouseX] + mov edx,[MouseY] + mov esi,[Scroll1MaxSizeX] + mov edi,[Scroll1MaxSizeY] + call columnus + test eax,eax + jz no_horizontal - call GetMouseCoordinats - mov eax,[MouseX] - mov ebx,[MouseY] - mov ecx,[WorkScreen_SizeX] - mov edx,[WorkScreen_SizeY] - add ecx,9 - add edx,89 + mov eax,9 + mov ebx,[Scroll1CoordinatY] + mov ecx,[Scroll1MaxSizeX] + mov edx,14+10 + mov esi,7 + inc ecx + call draw_volume_rectangle - cmp eax,ecx - jae mouse_scroll + mov eax,[MouseX] + mov ebx,[Scroll1SizeX] + shr ebx,1 + sub eax,ebx + mov ecx,[MouseX] + add ecx,ebx + mov edx,8+1 + add edx,[Scroll1MaxSizeX] + mov [Scroll1CoordinatX],eax + sub eax,9 + jns no_min_scroll - cmp ebx,edx - jae mouse_scroll + mov [Scroll1CoordinatX],9 - jmp no_scrollers +no_min_scroll: + cmp ecx,edx + jl no_max_scroll - mouse_scroll: + sub edx,ebx + sub edx,ebx + mov [Scroll1CoordinatX],edx - mov [exit_from_work_arrea],1 ;mouse situated after work arrea - - ;scrollers - call GetMouseClick - - cmp eax,1 - jne no_click - - call GetMouseCoordinats - ;interraction with horizontal scroller - mov eax,[Scroll1CoordinatX] - mov ebx,[Scroll1CoordinatY] - mov ecx,[MouseX] - mov edx,[MouseY] - mov esi,[Scroll1MaxSizeX] - mov edi,[Scroll1MaxSizeY] - call columnus - - test eax,eax - jz no_horizontal - - - mov eax,9 - mov ebx,[Scroll1CoordinatY] - mov ecx,[Scroll1MaxSizeX] - mov edx,14+10 - mov esi,7 - inc ecx - call draw_volume_rectangle - - mov eax,[MouseX] - mov ebx,[Scroll1SizeX] - shr ebx,1 - sub eax,ebx - mov ecx,[MouseX] - add ecx,ebx - mov edx,8+1 - add edx,[Scroll1MaxSizeX] - mov [Scroll1CoordinatX],eax - - sub eax,9 - jns no_min_scroll - - mov [Scroll1CoordinatX],9 - - no_min_scroll: - - cmp ecx,edx - jl no_max_scroll - - sub edx,ebx - sub edx,ebx - mov [Scroll1CoordinatX],edx - - no_max_scroll: - ; - mov eax,[Scroll1CoordinatX] - sub eax,9 - mov ebx,[Picture_SizeX] - imul eax,ebx - mov ebx,[Scroll1MaxSizeX] +no_max_scroll: + mov eax,[Scroll1CoordinatX] + sub eax,9 + mov ebx,[Picture_SizeX] + imul eax,ebx + mov ebx,[Scroll1MaxSizeX] cdq - idiv ebx - mov [PosX],eax + idiv ebx + mov [PosX],eax + jmp no_vertical - jmp no_vertical +no_horizontal: + mov eax,[Scroll2CoordinatX] + mov ebx,[Scroll2CoordinatY] + mov ecx,[MouseX] + mov edx,[MouseY] + mov esi,[Scroll2MaxSizeX] + mov edi,[Scroll2MaxSizeY] + call columnus + test eax,eax + jz no_vertical - no_horizontal: + mov eax,[Scroll2CoordinatX] + mov ebx,89 + mov ecx,14+10 + mov edx,[Scroll2MaxSizeY] + mov esi,7 + inc edx + call draw_volume_rectangle - mov eax,[Scroll2CoordinatX] - mov ebx,[Scroll2CoordinatY] - mov ecx,[MouseX] - mov edx,[MouseY] - mov esi,[Scroll2MaxSizeX] - mov edi,[Scroll2MaxSizeY] - call columnus + mov eax,[MouseY] + mov ebx,[Scroll2SizeY] + shr ebx,1 + sub eax,ebx + mov ecx,[MouseY] + add ecx,ebx + mov edx,89 + add edx,[Scroll2MaxSizeY] + mov [Scroll2CoordinatY],eax - test eax,eax - jz no_vertical + sub eax,89 + jns no_min_scroll2 - mov eax,[Scroll2CoordinatX] - mov ebx,89 - mov ecx,14+10 - mov edx,[Scroll2MaxSizeY] - mov esi,7 - inc edx - call draw_volume_rectangle + mov [Scroll2CoordinatY],89 - mov eax,[MouseY] - mov ebx,[Scroll2SizeY] - shr ebx,1 - sub eax,ebx - mov ecx,[MouseY] - add ecx,ebx - mov edx,89 - add edx,[Scroll2MaxSizeY] - mov [Scroll2CoordinatY],eax +no_min_scroll2: + cmp ecx,edx + jl no_max_scroll2 - sub eax,89 - jns no_min_scroll2 + sub edx,ebx + sub edx,ebx + mov [Scroll2CoordinatY],edx - mov [Scroll2CoordinatY],89 - - no_min_scroll2: - - cmp ecx,edx - jl no_max_scroll2 - - sub edx,ebx - sub edx,ebx - mov [Scroll2CoordinatY],edx - - no_max_scroll2: - ; - mov eax,[Scroll2CoordinatY] - sub eax,89 - mov ebx,[Picture_SizeY] - imul eax,ebx - mov ebx,[Scroll2MaxSizeY] +no_max_scroll2: + mov eax,[Scroll2CoordinatY] + sub eax,89 + mov ebx,[Picture_SizeY] + imul eax,ebx + mov ebx,[Scroll2MaxSizeY] cdq - idiv ebx - mov [PosY],eax + idiv ebx + mov [PosY],eax - no_vertical: +no_vertical: + call CalculatePositionScreen + call draw_scrollers + call MovePictureToWorkScreen - call CalculatePositionScreen +no_click: + jmp still - call draw_scrollers - call MovePictureToWorkScreen +no_scrollers: + mov eax,[MouseX] + mov ebx,[MouseY] + mov ecx,[Window_SizeX] + mov edx,[Window_SizeY] + sub ecx,36 + sub edx,35 - no_click: + cmp eax,9 + jle not_work_arrea - jmp still - no_scrollers: + cmp eax,ecx + jae not_work_arrea + cmp ebx,20+15+1+50 + jle not_work_arrea - mov eax,[MouseX] - mov ebx,[MouseY] - mov ecx,[Window_SizeX] - mov edx,[Window_SizeY] - sub ecx,36 - sub edx,35 + cmp ebx,edx + jae not_work_arrea + jmp mouse_in_work_arrea - cmp eax,9 - jle not_work_arrea +not_work_arrea: + mov [exit_from_work_arrea],1 + jmp still - cmp eax,ecx - jae not_work_arrea +mouse_in_work_arrea: + call GetScreenCordinats + call PrintMousePos + call GetMouseClick + test eax,eax + jz no_use_instruments - cmp ebx,20+15+1+50 - jle not_work_arrea + cmp [Activate_instrument],0 + jnz no_undo___ +;------------begin copy for undo------------- + inc [number_undo] + cmp [number_undo],1 + jne no_one__ - cmp ebx,edx - jae not_work_arrea + mov edi,[PointerToCopyPicture] - jmp mouse_in_work_arrea +no_one__: + cmp [number_undo],2 + jne no_two__ - not_work_arrea: + mov edi,[PointerToCopyPicture2] - mov [exit_from_work_arrea],1 +no_two__: + cmp [number_undo],3 + jne no_three__ - jmp still - - mouse_in_work_arrea: - - call GetScreenCordinats - call PrintMousePos - call GetMouseClick - - - - test eax,eax - jz no_use_instruments - - cmp [Activate_instrument],0 - - jnz no_undo___ - ;------------begin copy for undo------------- - inc [number_undo] - - cmp [number_undo],1 - jne no_one__ - - mov edi,[PointerToCopyPicture] - - no_one__: - - cmp [number_undo],2 - jne no_two__ - - mov edi,[PointerToCopyPicture2] - - no_two__: - - cmp [number_undo],3 - jne no_three__ - - ;copy bufer number two to bufer number one - mov esi,[PointerToCopyPicture2] - mov edi,[PointerToCopyPicture] - mov ecx,[Picture_SizeX] - imul ecx,[Picture_SizeY] - lea ecx,[ecx+ecx*2] - add ecx,4 - shr ecx,2 - inc ecx +;copy bufer number two to bufer number one + mov esi,[PointerToCopyPicture2] + mov edi,[PointerToCopyPicture] + mov ecx,[Picture_SizeX] + imul ecx,[Picture_SizeY] + lea ecx,[ecx+ecx*2] + add ecx,4 + shr ecx,2 + inc ecx cld - rep movsd - ;end copy - dec [number_undo] - mov edi,[PointerToCopyPicture2] + rep movsd +;end copy + dec [number_undo] + mov edi,[PointerToCopyPicture2] - no_three__: - - mov esi,[PointerToPicture] - mov ecx,[Picture_SizeX] - imul ecx,[Picture_SizeY] - lea ecx,[ecx+ecx*2] - add ecx,4 - shr ecx,2 - inc ecx +no_three__: + mov esi,[PointerToPicture] + mov ecx,[Picture_SizeX] + imul ecx,[Picture_SizeY] + lea ecx,[ecx+ecx*2] + add ecx,4 + shr ecx,2 + inc ecx cld - rep movsd - ;--------------end copy for undo------------- - no_undo___: + rep movsd +;--------------end copy for undo------------- +no_undo___: + call TakeButtonInstruments - call TakeButtonInstruments - no_use_instruments: - - mov eax,[Current_instrument] - and [Activate_instrument],0 - - jmp still +no_use_instruments: + mov eax,[Current_instrument] + and [Activate_instrument],0 + jmp still ;----------------------------------------------- ;---------get mouse cordinats------------------- ;----------------------------------------------- GetMouseCoordinats: - - mov eax,37 - mov ebx,1 - mcall - - mov ebx,eax - shr eax,16 - and ebx,0xffff - - mov [MouseX],eax - mov [MouseY],ebx - + mcall 37,1 + mov ebx,eax + shr eax,16 + and ebx,0xffff + mov [MouseX],eax + mov [MouseY],ebx ret ;------------------------------------------------ ;-------get mouse attributs---------------------- ;------------------------------------------------ GetMouseClick: - mov eax,37 - mov ebx,2 - mcall - - ret \ No newline at end of file + mcall 37,2 + ret \ No newline at end of file diff --git a/programs/media/animage/trunk/events_of_window.inc b/programs/media/animage/trunk/events_of_window.inc index 974b65bb4..076165698 100644 --- a/programs/media/animage/trunk/events_of_window.inc +++ b/programs/media/animage/trunk/events_of_window.inc @@ -2,103 +2,166 @@ ;-------------draw window of program----------------------- ;---------------------------------------------------------- drawwin: + or ecx,-1 + mcall 9,procinfo + mov esi,procinfo - mov eax,9 - mov ebx,IPC_table - or ecx,-1 - mcall + mov eax,[esi+34] + mov ebx,[esi+38] + mov ecx,[esi+42] + mov edx,[esi+46] + mov [Window_CordinatX],eax + mov [Window_CordinatY],ebx + mov [Window_SizeX],ecx + mov [Window_SizeY],edx - mov eax,[IPC_table+34] - mov ebx,[IPC_table+38] - mov ecx,[IPC_table+42] - mov edx,[IPC_table+46] - mov [Window_CordinatX],eax - mov [Window_CordinatY],ebx - mov [Window_SizeX],ecx - mov [Window_SizeY],edx + cmp [Window_SizeX],585 + jae no_minimum_size_x - cmp [Window_SizeX],585 - jae no_minimum_size_x + mov [Window_SizeX],585 + mov ecx,[Window_SizeX] - mov [Window_SizeX],585 - mov ecx,[Window_SizeX] +no_minimum_size_x: + cmp [Window_SizeY],400 + jae no_minimum_size_y - no_minimum_size_x: + mov [Window_SizeY],400 + mov edx,[Window_SizeY] - cmp [Window_SizeY],400 - jae no_minimum_size_y +no_minimum_size_y: + mov [MaxWorkScreen_SizeX],ecx + mov [MaxWorkScreen_SizeY],edx + sub [MaxWorkScreen_SizeX],20+10+5+10 + sub [MaxWorkScreen_SizeY],20+10+15+1+49+20+10 - mov [Window_SizeY],400 - mov edx,[Window_SizeY] + cmp [MaxWorkScreen_SizeX],0 + jns no_znak1 - no_minimum_size_y: + mov [MaxWorkScreen_SizeX],ecx - mov [MaxWorkScreen_SizeX],ecx - mov [MaxWorkScreen_SizeY],edx - sub [MaxWorkScreen_SizeX],20+10+5+10 - sub [MaxWorkScreen_SizeY],20+10+15+1+49+20+10 +no_znak1: + cmp [MaxWorkScreen_SizeY],0 + jns no_znak2 - cmp [MaxWorkScreen_SizeX],0 - jns no_znak1 + mov [MaxWorkScreen_SizeY],edx - mov [MaxWorkScreen_SizeX],ecx +no_znak2: - no_znak1: + mcall 12,1 +;------------------------------------------------ + mov ebx,[Window_CordinatX] + mov ecx,[Window_CordinatY] + shl ebx,16 + shl ecx,16 + add ebx,[Window_SizeX] + add ecx,[Window_SizeY] + xor esi,esi ;0x805080d0 +; xor edi,edi ;0x005080d0 + mcall 0,,,0x53aabbcc,,name_of_program +;------------------------------------------------ + mov eax,5 + mov ebx,20 + mov ecx,[Window_SizeX] + mov edx,15 + mov esi,6 + sub ecx,10 + call draw_volume_rectangle ; top menu - file and etc. - cmp [MaxWorkScreen_SizeY],0 - jns no_znak2 + mov [counter],7 + mov edi,panel_text + call print_panel_text +;------------------------------------------------ + mov eax,5 + mov ebx,20+15+1 + mov ecx,[Window_SizeX] + mov edx,50 + mov esi,1 + sub ecx,10 + call draw_volume_rectangle ; tools panel + call draw_icons + call PrintMousePos +;------------------------------------------------ + mov ecx,[k] + and [PosX],0 + and [PosY],0 + call MovePictureToWorkScreen +;------------------------------------------------ + mov ebx,[WorkScreen_SizeX] + add ebx,5+3 + mov edx,[Window_SizeX] + sub edx,ebx + sub edx,25+10-3 + shl ebx,16 + mov bx,dx + + mov ecx,20+15+1+49+2 + mov edx,[Window_SizeY] + mov eax,[WorkScreen_SizeY] + shr eax,16 + sub edx,eax + sub edx,20+15+1+49+2+25+10 + shl ecx,16 + mov cx,dx - mov [MaxWorkScreen_SizeY],edx + mcall 13,,,0xc7cbcf +;------------------------------------------------ + mcall ,<5,3> +;------------------------------------------------ + mov ebx,5 + mov edx,[Window_SizeX] + mov eax,[WorkScreen_SizeX] + shr eax,16 + sub edx,eax + sub edx,25+10 + shl ebx,16 + mov bx,dx - no_znak2: + mov ecx,[WorkScreen_SizeY] + add ecx,20+15+1+49+2+3 + mov edx,[Window_SizeY] + sub edx,ecx + sub edx,25+10-3 + shl ecx,16 + mov cx,dx - mov eax,12 - mov ebx,1 - mcall + mcall 13,,,0xc7cbcf +;------------------------------------------------ + mcall ,,<20+15+1+49+2,3> +;------------------------------------------------ +; draw_volume_rectangle +; eax - start X +; ebx - start Y +; ecx - size X +; edx - size Y - and eax,0 - mov ebx,[Window_CordinatX] - mov ecx,[Window_CordinatY] - shl ebx,16 - shl ecx,16 - add ebx,[Window_SizeX] - add ecx,[Window_SizeY] - mov edx,0x43aabbcc - xor esi,esi ;0x805080d0 - xor edi,edi ;0x005080d0 - mcall - - call draw_panel - call PrintMousePos - - mov [counter],7 - mov edi,panel_text - call print_panel_text - - ;>>>>>>Leency - ;mov eax,10 - ;mov ebx,5 - ;mov ecx,0xffffff - ;mov edx,name_of_program - ;mov esi,34 - ;call print_text - - mov eax,71 - mov ebx,1 - mov ecx,name_of_program - int 40h - ;Leency<<<<<<< - - mov eax,12 - mov ebx,2 - mcall - - mov ecx,[k] - - and [PosX],0 - and [PosY],0 - call MovePictureToWorkScreen - call draw_scrollers - call draw_icons - - ret \ No newline at end of file + mov eax,5 + mov ebx,[Window_SizeY] + mov ecx,[Window_SizeX] + mov edx,20+10 + mov esi,3 + sub ecx,30 + sub ebx,25+10 + call draw_volume_rectangle ; horizontal scrollbar +;------------------------------------------------ + mov eax,[Window_SizeX] + mov ebx,20+15+1+49+2 + mov ecx,20+10 + mov edx,[Window_SizeY] + mov esi,3 + sub eax,25+10 + sub edx,20+15+1+49+5+20 + call draw_volume_rectangle ; vertical scrollbar + call draw_scrollers +;------------------------------------------------ + mov eax,[Window_SizeX] + mov ebx,[Window_SizeY] + mov ecx,20+10 + mov edx,20+10 + mov esi,6 + sub eax,25+10 + sub ebx,25+10 + call draw_volume_rectangle ; down and right small area +;------------------------------------------------ + mcall 12,2 + ret +;----------------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/media/animage/trunk/init_data.inc b/programs/media/animage/trunk/init_data.inc index 147202fdb..ac71ad0ce 100644 --- a/programs/media/animage/trunk/init_data.inc +++ b/programs/media/animage/trunk/init_data.inc @@ -1,30 +1,21 @@ ;--------------------------------------------------------- ;--------initializate data and params of program---------- ;--------------------------------------------------------- - mov [Scroll1CoordinatX],8+1 - mov [Scroll2CoordinatY],20+15+1+50+3 - mov [Window_SizeX],640 - mov [Window_SizeY],220 - mov [Window_CordinatX],50 - mov [Window_CordinatY],50 - mov [WorkScreen_SizeX],100 - mov [WorkScreen_SizeY],100 - mov [MaxWorkScreen_SizeX],100 - mov [MaxWorkScreen_SizeY],100 - and [PosX],0 - and [PosY],0 - mov [Picture_SizeX],640;400 - mov [Picture_SizeY],400;280 - mov [k],1 - -; mov [ScreenPointer],0x19000 -; mov [PointerToPicture],0x19000+(1200*1000*3)+50*(20*20*3)+500000 -; mov [PointerToCopyPicture],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3) -; mov [PointerToCopyPicture2],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*2 -; mov [PointerToEditBufer],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*3 -; mov [PointerToSpriteBufer],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*4 -; mov [PointerToPalette],0x19000+(1200*100*3)+50*(20*20*3)+1 -; mov [ReserveArray],0x19000+(1200*1000)*3+50*(20*20*3)+8 + mov [Scroll1CoordinatX],8+1 + mov [Scroll2CoordinatY],20+15+1+50+3 + mov [Window_SizeX],640 + mov [Window_SizeY],220 + mov [Window_CordinatX],50 + mov [Window_CordinatY],50 + mov [WorkScreen_SizeX],100 + mov [WorkScreen_SizeY],100 + mov [MaxWorkScreen_SizeX],100 + mov [MaxWorkScreen_SizeY],100 + and [PosX],0 + and [PosY],0 + mov [Picture_SizeX],640;400 + mov [Picture_SizeY],400;280 + mov [k],1 ; mov [ScreenPointer],I_END ; S = 0, L = 3600000 + 60000 + 500000 = 4160000 = 3,97 Mb ; mov [PointerToPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000 ; S = 4160000, L = 768000 = 750 Kb @@ -38,25 +29,12 @@ mcall 68,12,4096 mov [ScreenPointer],eax - and [save_flag],0 - mov [line_width],1 - mov [lastik_is_active],0 - and [crossing],0 - and [finishing_crossing],0 - and [number_undo],0 - and [instrument_used],0 - and [DrawSprite_flag],0 -; and [extended_memory],0 - - ;mov eax,68 - ;mov ebx,11 - ;mcall - - ;mov eax,68 - ;mov ebx,12 - ;mov ecx,60000 - ;mcall - - ;mov [PointerToIcons],eax - - finit + and [save_flag],0 + mov [line_width],1 + mov [lastik_is_active],0 + and [crossing],0 + and [finishing_crossing],0 + and [number_undo],0 + and [instrument_used],0 + and [DrawSprite_flag],0 +finit diff --git a/programs/media/animage/trunk/load_from_parameters.inc b/programs/media/animage/trunk/load_from_parameters.inc index 4337fd89f..c468851b5 100644 --- a/programs/media/animage/trunk/load_from_parameters.inc +++ b/programs/media/animage/trunk/load_from_parameters.inc @@ -1,125 +1,88 @@ -;loading file from parameters if parametrs <> 0 -;IN -; eax- pointer to parameters -; ebx- pointer to path of file -;OUT -;value not returned - -;check_loading_from_parameters: - -; cmp [eax],byte 0 -; jz no_parameters - - ;copy file name -; mov esi,eax -; mov edi,ebx -; mov ecx,256 -; rep movsb - - ;load file in memory - -; call load_picture - -; no_parameters: - -; ret - ; load picture from file to memory load_picture: + mov eax,file_path + mov ebx,[ScreenPointer] + add ebx,0x10000 - mov eax,file_path - mov ebx,[ScreenPointer] - add ebx,0x10000 + call load_heading_of_file - call load_heading_of_file + mov esi,[ScreenPointer] + add esi,0x10000 +;-------------is this BMP file ?---------------- + xor eax,eax + mov ax,[esi] + mov [type],ax - mov esi,[ScreenPointer] - add esi,0x10000 - ;-------------is this BMP file ?---------------- - xor eax,eax - mov ax,[esi] - mov [type],ax + cmp [type],word 'BM' + jne no_bmp_file_1 - cmp [type],word 'BM' - jne no_bmp_file_1 + xor eax,eax + xor ebx,ebx + mov eax,[esi+18] + mov ebx,[esi+22] + mov [Picture_SizeX],eax + mov [Picture_SizeY],ebx + jmp exit_type_1 - xor eax,eax - xor ebx,ebx - mov eax,[esi+18] - mov ebx,[esi+22] - mov [Picture_SizeX],eax - mov [Picture_SizeY],ebx +no_bmp_file_1: +;-------------is this GIF file ?---------------- + xor eax,eax + mov ax,[esi] + mov [type],ax + cmp [type],'GI' + jne no_gif_file_1 - jmp exit_type_1 + add esi,6 + xor eax,eax + xor ebx,ebx + mov ax,word[esi] + mov bx,word[esi+2] + mov [Picture_SizeX],eax + mov [Picture_SizeY],ebx + jmp exit_type_1 - no_bmp_file_1: +no_gif_file_1: + jmp no_unpakcing_file_1 - ;-------------is this GIF file ?---------------- - xor eax,eax - mov ax,[esi] - mov [type],ax +exit_type_1: +;---------------------------------------------------------- +;Get momory for unpacking picture and for picture's bufers +;---------------------------------------------------------- + call GetMemory +;---------------------------------------------------------- +;--------------------Load file in memory------------------- +;---------------------------------------------------------- - cmp [type],'GI' - jne no_gif_file_1 + mov eax,file_path + mov ebx,[PointerToCopyPicture] + add ebx,1000 + call load_file - add esi,6 - xor eax,eax - xor ebx,ebx - mov ax,word[esi] - mov bx,word[esi+2] - mov [Picture_SizeX],eax - mov [Picture_SizeY],ebx +;---------------------------------------------------------- +;-------------------Unpacking picture---------------------- +;---------------------------------------------------------- + mov esi,[PointerToCopyPicture] + add esi,1000 + mov edi,[PointerToPicture] + mov eax,[ScreenPointer] + cmp [type],'BM' + jne no_unpakcing_bmp_file_1 +;BMP DECODER + call bmptoimg + mov [save_flag],1 + jmp no_unpakcing_file_1 - jmp exit_type_1 +no_unpakcing_bmp_file_1: + cmp [type],'GI' + jne no_unpakcing_file_1 +;GIF DECODER + sub edi,8 + call ReadGIF + mov [save_flag],1 - no_gif_file_1: - - jmp no_unpakcing_file_1 - - exit_type_1: - - ;---------------------------------------------------------- - ;Get momory for unpacking picture and for picture's bufers - ;---------------------------------------------------------- - call GetMemory - - ;---------------------------------------------------------- - ;--------------------Load file in memory------------------- - ;---------------------------------------------------------- - - mov eax,file_path - mov ebx,[PointerToCopyPicture] - add ebx,1000 - - call load_file - - ;---------------------------------------------------------- - ;-------------------Unpacking picture---------------------- - ;---------------------------------------------------------- - mov esi,[PointerToCopyPicture] - add esi,1000 - mov edi,[PointerToPicture] - mov eax,[ScreenPointer] - - cmp [type],'BM' - jne no_unpakcing_bmp_file_1 - ;BMP DECODER - call bmptoimg - mov [save_flag],1 - no_unpakcing_bmp_file_1: - - - cmp [type],'GI' - jne no_unpakcing_file_1 - ;GIF DECODER - sub edi,8 - call ReadGIF - mov [save_flag],1 - no_unpakcing_file_1: - - call MovePictureToWorkScreen - - mov [Scroll1CoordinatX],9 - mov [Scroll2CoordinatY],89 - ret +no_unpakcing_file_1: + call MovePictureToWorkScreen + mov [Scroll1CoordinatX],9 + mov [Scroll2CoordinatY],89 + ret diff --git a/programs/media/animage/trunk/memory.inc b/programs/media/animage/trunk/memory.inc index 7f281105d..33c53c174 100644 --- a/programs/media/animage/trunk/memory.inc +++ b/programs/media/animage/trunk/memory.inc @@ -1,30 +1,8 @@ ;---------------------------------------------------------- ;--------change size of memory which use program----------- ;---------------------------------------------------------- -;GetMemory: -; pushad -; mov eax,64 -; mov ebx,1 -; mov ecx,[Picture_SizeX] -; mov edx,[Picture_SizeY] -; imul ecx,edx -; lea ecx,[ecx+ecx*2] -; lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5 -; add ecx,[ScreenPointer] -; add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 ; 4192384 -; add ecx,[extended_memory] -; mcall -; test eax,eax -; jz have_new_memory -; mov esi,sound_havent_memory -; call sound -; jmp still -;have_new_memory: -; popad -; ret - GetMemory: - pushad + pusha mov ecx,[Picture_SizeX] mov edx,[Picture_SizeY] imul ecx,edx @@ -36,13 +14,14 @@ GetMemory: jnz have_new_memory mov esi,sound_havent_memory call sound - pushad + popa + add esp,4 jmp still have_new_memory: mov [ScreenPointer],eax call prepare_data_pointers - popad + popa ret ;--------------------------------------------------------- prepare_data_pointers: @@ -72,5 +51,13 @@ prepare_data_pointers: add [PointerToSpriteBufer],eax add [PointerToSpriteBufer],eax add [PointerToSpriteBufer],eax + + mov eax,[ScreenPointer] + add eax,(1200*100*3)+50*(20*20*3)+1 + mov [PointerToPalette],eax + + mov eax,[ScreenPointer] + add eax,(1200*1000)*3+50*(20*20*3)+8 + mov [ReserveArray],eax ret ;--------------------------------------------------------- \ No newline at end of file diff --git a/programs/media/animage/trunk/menu_instruments.inc b/programs/media/animage/trunk/menu_instruments.inc index e2fe425ed..d3830ec99 100644 --- a/programs/media/animage/trunk/menu_instruments.inc +++ b/programs/media/animage/trunk/menu_instruments.inc @@ -2,194 +2,159 @@ ;-----------instruments of menu----------------------------- ;----------------------------------------------------------- TakeInstruments: +;|||||||||||||||||||FILE|||||||||||||||||||||| + cmp [number_panel],7 + jne no_file - ;|||||||||||||||||||FILE|||||||||||||||||||||| - cmp [number_panel],7 - jne no_file +;<<<<>>>>>> + cmp [number_menu],1 + jne no_new - ;<<<<>>>>>> - cmp [number_menu],1 - jne no_new + mov eax,80 + mov ebx,100 + mov ecx,150 + mov edx,90 + mov esi,1 + call draw_volume_rectangle - mov eax,80 - mov ebx,100 - mov ecx,150 - mov edx,90 - mov esi,1 - call draw_volume_rectangle + mov eax,177 + mov ebx,115 + mov ecx,40 + mov edx,14 + mov esi,4 + call draw_volume_rectangle - mov eax,177 - mov ebx,115 - mov ecx,40 - mov edx,14 - mov esi,4 - call draw_volume_rectangle + mov eax,177 + mov ebx,115+24 + mov ecx,40 + mov edx,14 + mov esi,4 + call draw_volume_rectangle - mov eax,177 - mov ebx,115+24 - mov ecx,40 - mov edx,14 - mov esi,4 - call draw_volume_rectangle + mov eax,175 + mov ebx,170 + mov ecx,40 + mov edx,15 + mov esi,1 + call draw_volume_rectangle - mov eax,175 - mov ebx,170 - mov ecx,40 - mov edx,15 - mov esi,1 - call draw_volume_rectangle + mov eax,90 + mov ebx,118 + mov ecx,0xffffff + mov edx,new_text1 + mov esi,14 + call print_text - mov eax,90 - mov ebx,118 - mov ecx,0xffffff - mov edx,new_text1 - mov esi,14 - call print_text + mov eax,90 + mov ebx,118+24 + mov ecx,0xffffff + mov edx,new_text2 + mov esi,14 + call print_text - mov eax,90 - mov ebx,118+24 - mov ecx,0xffffff - mov edx,new_text2 - mov esi,14 - call print_text + mov eax,185 + mov ebx,175 + mov ecx,0xffffff + mov edx,ok_text + mov esi,2 + call print_text - mov eax,185 - mov ebx,175 - mov ecx,0xffffff - mov edx,ok_text - mov esi,2 - call print_text + mov edx,1000000000000000000000000000000b+1000 + mcall 8,<177,40>,<115,14>, - mov eax,8 - mov ebx,177*65536+40 - mov ecx,115*65536+14 - mov edx,1000000000000000000000000000000b - add edx,1000 - mcall + mov edx,1000000000000000000000000000000b+1001 + mcall ,,<139,14>, - mov eax,8 - mov ebx,177*65536+40 - mov ecx,139*65536+14 - mov edx,1000000000000000000000000000000b - add edx,1001 - mcall + mov edx,1000000000000000000000000000000b+1002 + mcall ,<175,40>,<170,15> - mov eax,8 - mov ebx,175*65536+40 - mov ecx,170*65536+15 - mov edx,1000000000000000000000000000000b - add edx,1002 - mcall +no_activate_space: + mcall 10 - no_activate_space: + cmp eax,1 + je exit_new - mov eax,10 - mcall + cmp eax,3 + jne no_activate_space - cmp eax,1 - je exit_new + mcall 17 + shr eax,8 - cmp eax,3 - jne no_activate_space + cmp eax,1000 + jl no_activate_space - mov eax,17 - mcall - shr eax,8 + cmp eax,1000 + jne no_picture_size_x - cmp eax,1000 - jl no_activate_space + mov eax,180 + mov ebx,119 + mov ecx,5 + call dialog_line - cmp eax,1000 - jne no_picture_size_x + mov eax,string_ + mov ebx,13 + call find_symvol - mov eax,180 - mov ebx,119 - mov ecx,5 - call dialog_line + dec eax + mov [length_number],eax + mov eax,string_ + call value - mov eax,string_ - mov ebx,13 - call find_symvol + mov [Picture_SizeX],eax + jmp no_activate_space +;--------------------------------------------------------------------- +no_picture_size_x: + cmp eax,1001 + jne no_picture_size_y - dec eax - mov [length_number],eax - mov eax,string_ - call value + mov eax,180 + mov ebx,119+24 + mov ecx,5 + call dialog_line - mov [Picture_SizeX],eax + mov eax,string_ + mov ebx,13 + call find_symvol - jmp no_activate_space + dec eax + mov [length_number],eax + mov eax,string_ + call value - no_picture_size_x: + mov [Picture_SizeY],eax + jmp no_activate_space +;--------------------------------------------------------------------- +no_picture_size_y: + cmp eax,1002 + jne no_activate_space - cmp eax,1001 - jne no_picture_size_y +exit_new: + mov edx,11100000000000000000000000000000b+1002 + mcall 8,<175,40>,<170,15> - mov eax,180 - mov ebx,119+24 - mov ecx,5 - call dialog_line + mov edx,11100000000000000000000000000000b+1001 + mcall ,<177,40>,<139,14> - mov eax,string_ - mov ebx,13 - call find_symvol + mov edx,11100000000000000000000000000000b+1000 + mcall ,,<115,14> - dec eax - mov [length_number],eax - mov eax,string_ - call value +;get memory for new picture + call GetMemory - mov [Picture_SizeY],eax + and [save_flag],0 + and [number_panel],0 + and [number_menu],0 - jmp no_activate_space + call cleare_work_arrea + call drawwin + jmp still +;--------------------------------------------------------------------- +no_new: +;<<<<>>>>>> + cmp [number_menu],2 + jne no_open - no_picture_size_y: - - cmp eax,1002 - jne no_activate_space - - exit_new: - - mov eax,8 - mov ebx,175*65536+40 - mov ecx,170*65536+15 - mov edx,11100000000000000000000000000000b - add edx,1002 - mcall - - mov eax,8 - mov ebx,177*65536+40 - mov ecx,139*65536+14 - mov edx,11100000000000000000000000000000b - add edx,1001 - mcall - - mov eax,8 - mov ebx,177*65536+40 - mov ecx,115*65536+14 - mov edx,11100000000000000000000000000000b - add edx,1000 - mcall - - ;get memory for new picture - - call GetMemory - - and [save_flag],0 - and [number_panel],0 - and [number_menu],0 - - call cleare_work_arrea - call drawwin - - jmp still - no_new: - - ;<<<<>>>>>> - cmp [number_menu],2 - jne no_open - -; opendialog drawwin,open_1,open_2,file_path +; opendialog drawwin,open_1,open_2,file_path ;--------------------------------------------------------------------- mov [OpenDialog_data.type],0 ; open @@ -199,144 +164,126 @@ TakeInstruments: cmp [OpenDialog_data.status],1 jne still ;--------------------------------------------------------------------- +open_1: + mcall 40,100111b - open_1: + mov eax,file_path + mov ebx,[ScreenPointer] + add ebx,0x10000 - mov eax,40 - mov ebx,100111b - mcall + call load_heading_of_file - mov eax,file_path - mov ebx,[ScreenPointer] - add ebx,0x10000 + mov esi,[ScreenPointer] + add esi,0x10000 +;-------------is this BMP file ?---------------- + xor eax,eax + mov ax,[esi] + mov [type],ax - call load_heading_of_file + cmp [type],word 'BM' + jne no_bmp_file - mov esi,[ScreenPointer] - add esi,0x10000 - ;-------------is this BMP file ?---------------- - xor eax,eax - mov ax,[esi] - mov [type],ax + xor eax,eax + xor ebx,ebx + mov eax,[esi+18] + mov ebx,[esi+22] + mov [Picture_SizeX],eax + mov [Picture_SizeY],ebx + jmp exit_type +;--------------------------------------------------------------------- +no_bmp_file: +;-------------is this GIF file ?---------------- + xor eax,eax + mov ax,[esi] + mov [type],ax - cmp [type],word 'BM' - jne no_bmp_file + cmp [type],'GI' + jne no_gif_file - xor eax,eax - xor ebx,ebx - mov eax,[esi+18] - mov ebx,[esi+22] - mov [Picture_SizeX],eax - mov [Picture_SizeY],ebx + add esi,6 + xor eax,eax + xor ebx,ebx + mov ax,word[esi] + mov bx,word[esi+2] + mov [Picture_SizeX],eax + mov [Picture_SizeY],ebx + jmp exit_type +;--------------------------------------------------------------------- +no_gif_file: + jmp no_unpakcing_file +;--------------------------------------------------------------------- +exit_type: +;---------------------------------------------------------- +;Get momory for unpacking picture and for picture's bufers +;---------------------------------------------------------- + call GetMemory +;---------------------------------------------------------- +;--------------------Load file in memory------------------- +;---------------------------------------------------------- + mov eax,file_path + mov ebx,[PointerToCopyPicture] + add ebx,1000 + call load_file +;---------------------------------------------------------- +;-------------------Unpacking picture---------------------- +;---------------------------------------------------------- + mov esi,[PointerToCopyPicture] + add esi,1000 + mov edi,[PointerToPicture] + mov eax,[ScreenPointer] - jmp exit_type + cmp [type],'BM' + jne no_unpakcing_bmp_file + ;BMP DECODER - no_bmp_file: + call bmptoimg - ;-------------is this GIF file ?---------------- - xor eax,eax - mov ax,[esi] - mov [type],ax + mov [save_flag],1 + jmp draw_1 +;--------------------------------------------------------------------- +no_unpakcing_bmp_file: + cmp [type],'GI' + jne no_unpakcing_file + ;GIF DECODER + sub edi,8 - cmp [type],'GI' - jne no_gif_file + call ReadGIF - add esi,6 - xor eax,eax - xor ebx,ebx - mov ax,word[esi] - mov bx,word[esi+2] - mov [Picture_SizeX],eax - mov [Picture_SizeY],ebx - - jmp exit_type - - no_gif_file: - - jmp no_unpakcing_file - - exit_type: - - ;---------------------------------------------------------- - ;Get momory for unpacking picture and for picture's bufers - ;---------------------------------------------------------- - call GetMemory - ;---------------------------------------------------------- - ;--------------------Load file in memory------------------- - ;---------------------------------------------------------- - - mov eax,file_path - mov ebx,[PointerToCopyPicture] - add ebx,1000 - - call load_file - - ;---------------------------------------------------------- - ;-------------------Unpacking picture---------------------- - ;---------------------------------------------------------- - mov esi,[PointerToCopyPicture] - add esi,1000 - mov edi,[PointerToPicture] - mov eax,[ScreenPointer] - - cmp [type],'BM' - jne no_unpakcing_bmp_file - ;BMP DECODER - call bmptoimg - mov [save_flag],1 - jmp draw_1 - - no_unpakcing_bmp_file: - - - cmp [type],'GI' - jne no_unpakcing_file - ;GIF DECODER - sub edi,8 - call ReadGIF - mov [save_flag],1 - no_unpakcing_file: - - call load_icons + mov [save_flag],1 + jmp draw_1 +;--------------------------------------------------------------------- +no_unpakcing_file: + call load_icons draw_1: - call drawwin + call drawwin +open_2: + mov [Scroll1CoordinatX],9 + mov [Scroll2CoordinatY],89 + and [number_panel],0 + and [number_menu],0 + jmp still +;--------------------------------------------------------------------- +no_open: + ;<<<<<<<<<<>>>>>>>>>>> + cmp [number_menu],3 + jne no_save_ - open_2: + mov al,[save_flag] + test al,al + jz no_save_file + jmp save_enter +;--------------------------------------------------------------------- +no_save_file: + and [number_panel],0 + and [number_menu],0 + jmp still +;--------------------------------------------------------------------- +no_save_: + ;<<<<<<<<>>>>>>>>>> + cmp [number_menu],4 + jne no_save - mov [Scroll1CoordinatX],9 - mov [Scroll2CoordinatY],89 - and [number_panel],0 - and [number_menu],0 - - jmp still - - no_open: - - ;<<<<<<<<<<>>>>>>>>>>> - cmp [number_menu],3 - jne no_save_ - - mov al,[save_flag] - - test al,al - jz no_save_file - - jmp save_enter - - no_save_file: - - and [number_panel],0 - and [number_menu],0 - - jmp still - - no_save_: - - ;<<<<<<<<>>>>>>>>>> - cmp [number_menu],4 - jne no_save - -; savedialog drawwin,save1,save2,file_path +; savedialog drawwin,save1,save2,file_path ;--------------------------------------------------------------------- ; replace extension to '.bmp' push eax esi @@ -347,10 +294,10 @@ draw_1: lodsb test eax,eax jnz @r - sub esi,5 + sub esi,5 cmp [esi],byte '.' jne @f - mov [esi],dword '.bmp' + mov [esi],dword '.bmp' @@: pop esi eax ;--------------------------------------------------------------------- @@ -358,472 +305,416 @@ draw_1: push dword OpenDialog_data call [OpenDialog_Start] - + cmp [OpenDialog_data.status],1 jne still ;--------------------------------------------------------------------- - - save1: - - save_enter: - mov eax,40 - mov ebx,100111b - mcall - - call analizing_picture_to_palette - ;eax => number of colors in picture - mov ebx,[PointerToPicture] - mov ecx,[PointerToEditBufer] - mov edx,[PointerToPalette] - mov esi,[Picture_SizeX] - mov edi,[Picture_SizeY] - - call coding_bmp - - mov eax,file_path - mov ecx,ebx - mov ebx,[PointerToEditBufer] - push eax - push ebx - push ecx - - call save_file - - mov [save_flag],1 - and [number_panel],0 - and [number_menu],0 - call drawwin - - jmp still - - save2: - - and [number_panel],0 - and [number_menu],0 - - jmp still - no_save: - - ;<<<<<>>>>>> - cmp [number_menu],5 - jne no_exit_program - - mov eax,-1 - mcall - - no_exit_program: - - no_file: - - ;|||||||||||||||||||||||||||||EDIT||||||||||||||||||||||||| - - ;<<<<<<<<<>>>>>>>>> - cmp [number_panel],6 - jne no_edit - - cmp [number_menu],1 - jne no_undo - - cmp [number_undo],1 - jne no_one____ - - mov esi,[PointerToCopyPicture] - - no_one____: - - cmp [number_undo],2 - jne no_two____ - - mov esi,[PointerToCopyPicture2] - - no_two____: - - mov edi,[PointerToPicture] - mov ecx,[Picture_SizeX] - imul ecx,[Picture_SizeY] - lea ecx,[ecx+ecx*2] - add ecx,4 - shr ecx,2 - cld - rep movsd - call MovePictureToWorkScreen - - dec [number_undo] - jnz no_null_undo - - mov [number_undo],1 - - no_null_undo: - - and [number_panel],0 - and [number_menu],0 - jmp still - no_undo: - - ;<<<<<<<<<>>>>>>>>> - - cmp [number_menu],2 - jne no_copy - - cmp [instrument_used],1 - jne no_copy - cmp [Activate_instrument],0 - jne no_copy - - mov eax,[OldX] - mov ebx,[OldY] - - cmp eax,[rectangular_shade_x] - jl no_remove_x_copy - - mov ecx,[rectangular_shade_x] - mov [OldX],ecx ; OldX <-----> rectangulare_shade_x - mov [rectangular_shade_x],eax - - no_remove_x_copy: - - cmp ebx,[rectangular_shade_y] - jl no_remove_y_copy - - mov ecx,[rectangular_shade_y] - mov [OldY],ecx ; OldY <-----> rectangulare_shade_y - mov [rectangular_shade_y],ebx - - no_remove_y_copy: - - mov eax,[OldX] - mov ebx,[OldY] - mov ecx,[rectangular_shade_x] - mov edx,[rectangular_shade_y] - inc eax - inc ebx - dec ecx - dec edx - - mov [x],eax - mov [y],ebx - mov esi,eax - mov edi,ebx - mov [Dx_],1 - mov [Dy_],1 - - sub ecx,eax - jnz no_signum_fill_r_x_copy - - mov [Dx_],-1 - - no_signum_fill_r_x_copy: - - sub edx,ebx - jnz no_signum_fill_r_y_copy - - mov [Dy_],-1 - - no_signum_fill_r_y_copy: - - mov ebx,[rectangular_shade_y] - sub ebx,edi - - mov edx,[PointerToEditBufer] - mov [y],edi - loop_fill_rectangle_y_copy: - - mov [x],esi - loop_fill_rectangle_x_copy: - - push esi - push edi - - mov eax,[PointerToPicture] - mov ebx,[Picture_SizeX] - mov esi,[x] - mov edi,[y] - call GetColorOfPixel - - mov [edx],ax - shr eax,16 - mov [edx+2],al - - pop edi - pop esi - - add edx,3 - - mov eax,[x] - add eax,[Dx_] - mov [x],eax - - cmp eax,[rectangular_shade_x] - jl loop_fill_rectangle_x_copy - - mov eax,[y] - add eax,[Dy_] - mov [y],eax - - cmp eax,[rectangular_shade_y] - jl loop_fill_rectangle_y_copy - - call MovePictureToWorkScreen - - and [number_panel],0 - and [number_menu],0 - mov [DrawSprite_flag],1 - - jmp still - - no_copy: - - ;<<<<<<<<<>>>>>>> - cmp [number_menu],3 - jne no_paste - - cmp [instrument_used],1 - jne no_paste - - cmp [Activate_instrument],0 - jne no_paste - - mov eax,[OldX] - mov ebx,[OldY] - - cmp eax,[rectangular_shade_x] - jl no_remove_x_paste - - mov ecx,[rectangular_shade_x] - mov [OldX],ecx ; OldX <-----> rectangulare_shade_x - mov [rectangular_shade_x],eax - - no_remove_x_paste: - - cmp ebx,[rectangular_shade_y] - jl no_remove_y_paste - - mov ecx,[rectangular_shade_y] - mov [OldY],ecx ; OldY <-----> rectangulare_shade_y - mov [rectangular_shade_y],ebx - - no_remove_y_paste: - - mov eax,[OldX] - mov ebx,[OldY] - mov ecx,[rectangular_shade_x] - mov edx,[rectangular_shade_y] - inc eax - inc ebx - dec ecx - dec edx - - mov [x],eax - mov [y],ebx - mov esi,eax - mov edi,ebx - mov [Dx_],1 - mov [Dy_],1 - - sub ecx,eax - jnz no_signum_fill_r_x_paste - - mov [Dx_],-1 - - no_signum_fill_r_x_paste: - - sub edx,ebx - jnz no_signum_fill_r_y_paste - - mov [Dy_],-1 - - no_signum_fill_r_y_paste: - - mov edx,[PointerToEditBufer] - mov [y],edi - - loop_fill_rectangle_y_paste: - - mov [x],esi - loop_fill_rectangle_x_paste: - - push esi - push edi - - mov ecx,[edx] - and ecx,0xffffff ;color - - mov eax,[PointerToPicture] - mov ebx,[Picture_SizeX] - mov esi,[x] - mov edi,[y] - call PutPixel - - pop edi - pop esi - - add edx,3 - - mov eax,[x] - add eax,[Dx_] - mov [x],eax - cmp eax,[rectangular_shade_x] - jl loop_fill_rectangle_x_paste - - mov eax,[y] - add eax,[Dy_] - mov [y],eax - cmp eax,[rectangular_shade_y] - - jl loop_fill_rectangle_y_paste - - call MovePictureToWorkScreen - and [number_panel],0 - and [number_menu],0 - mov [Paste_flag],1 - - jmp still - - no_paste: - - ;<<<<<<<<<>>>>>>>>> - cmp [number_menu],4 - jne no_cut - - cmp [instrument_used],1 - jne no_cut - - cmp [Activate_instrument],0 - jne no_cut - - mov eax,[OldX] - mov ebx,[OldY] - - cmp eax,[rectangular_shade_x] - jl no_remove_x_cut - - mov ecx,[rectangular_shade_x] - mov [OldX],ecx ; OldX <-----> rectangulare_shade_x - mov [rectangular_shade_x],eax - - no_remove_x_cut: - - cmp ebx,[rectangular_shade_y] - jl no_remove_y_cut - - mov ecx,[rectangular_shade_y] - mov [OldY],ecx ; OldY <-----> rectangulare_shade_y - mov [rectangular_shade_y],ebx - - no_remove_y_cut: - - mov eax,[OldX] - mov ebx,[OldY] - mov ecx,[rectangular_shade_x] - mov edx,[rectangular_shade_y] - inc eax - inc ebx - dec ecx - dec edx - - mov [x],eax - mov [y],ebx - mov esi,eax - mov edi,ebx - mov [Dx_],1 - mov [Dy_],1 - - sub ecx,eax - jnz no_signum_fill_r_x - - mov [Dx_],-1 - - no_signum_fill_r_x: - - sub edx,ebx - jnz no_signum_fill_r_y - - mov [Dy_],-1 - - no_signum_fill_r_y: - - mov [y],edi - loop_fill_rectangle_y: - - mov [x],esi - loop_fill_rectangle_x: - - push esi - push edi - - mov eax,[PointerToPicture] - mov ebx,[Picture_SizeX] - mov ecx,dword 0xffffff - mov esi,[x] - mov edi,[y] - call PutPixel - - pop edi - pop esi - - mov eax,[x] - add eax,[Dx_] - mov [x],eax - - cmp eax,[rectangular_shade_x] - jl loop_fill_rectangle_x - - mov eax,[y] - add eax,[Dy_] - mov [y],eax - - cmp eax,[rectangular_shade_y] - jl loop_fill_rectangle_y - - call MovePictureToWorkScreen - - and [number_panel],0 - and [number_menu],0 - - jmp still - no_cut: - - ;<<<<<>>>>> - cmp [number_menu],5 - jne no_cleare_all - - call cleare_work_arrea - - call MovePictureToWorkScreen - - and [number_panel],0 - and [number_menu],0 - - jmp still - no_cleare_all: - ;<<<<<>>>>> - - cmp [number_menu],6 - jne no_to_allocate_all - - mov [OldX],1 - mov [OldY],1 - mov eax,[Picture_SizeX] - mov ebx,[Picture_SizeY] - dec eax - dec ebx - mov [rectangular_shade_x],eax - mov [rectangular_shade_y],ebx - mov [instrument_used],1 - mov [Activate_instrument],1 - mov [Current_instrument],30 - mov [crossing],0 - and [number_panel],0 - and [number_menu],0 - ;call TakeButtonInstruments - ;call MovePictureToWorkScreen - jmp still - - no_to_allocate_all: - - no_edit: - - - jmp still - - ret +save1: +save_enter: + mcall 40,100111b + + call analizing_picture_to_palette + + ;eax => number of colors in picture + mov ebx,[PointerToPicture] + mov ecx,[PointerToEditBufer] + mov edx,[PointerToPalette] + mov esi,[Picture_SizeX] + mov edi,[Picture_SizeY] + + call coding_bmp + + mov eax,file_path + mov ecx,ebx + mov ebx,[PointerToEditBufer] + + call save_file + + mov [save_flag],1 + and [number_panel],0 + and [number_menu],0 + call drawwin + jmp still +;--------------------------------------------------------------------- +;save2: +; and [number_panel],0 +; and [number_menu],0 +; jmp still +;--------------------------------------------------------------------- +no_save: + ;<<<<<>>>>>> + cmp [number_menu],5 + jne no_exit_program + + mov eax,-1 + mcall +;--------------------------------------------------------------------- +no_exit_program: +no_file: +;|||||||||||||||||||||||||||||EDIT||||||||||||||||||||||||| +;<<<<<<<<<>>>>>>>>> + cmp [number_panel],6 + jne still ;no_edit + + cmp [number_menu],1 + jne no_undo + + cmp [number_undo],1 + jne no_one____ + + mov esi,[PointerToCopyPicture] + +no_one____: + cmp [number_undo],2 + jne no_two____ + + mov esi,[PointerToCopyPicture2] + +no_two____: + mov edi,[PointerToPicture] + mov ecx,[Picture_SizeX] + imul ecx,[Picture_SizeY] + lea ecx,[ecx+ecx*2] + add ecx,4 + shr ecx,2 + cld + rep movsd + call MovePictureToWorkScreen + + dec [number_undo] + jnz no_null_undo + + mov [number_undo],1 + +no_null_undo: + and [number_panel],0 + and [number_menu],0 + jmp still +;--------------------------------------------------------------------- +no_undo: +;<<<<<<<<<>>>>>>>>> + cmp [number_menu],2 + jne no_copy + + cmp [instrument_used],1 + jne no_copy + cmp [Activate_instrument],0 + jne no_copy + + mov eax,[OldX] + mov ebx,[OldY] + + cmp eax,[rectangular_shade_x] + jl no_remove_x_copy + + mov ecx,[rectangular_shade_x] + mov [OldX],ecx ; OldX <-----> rectangulare_shade_x + mov [rectangular_shade_x],eax + +no_remove_x_copy: + cmp ebx,[rectangular_shade_y] + jl no_remove_y_copy + + mov ecx,[rectangular_shade_y] + mov [OldY],ecx ; OldY <-----> rectangulare_shade_y + mov [rectangular_shade_y],ebx + +no_remove_y_copy: + mov eax,[OldX] + mov ebx,[OldY] + mov ecx,[rectangular_shade_x] + mov edx,[rectangular_shade_y] + inc eax + inc ebx + dec ecx + dec edx + + mov [x],eax + mov [y],ebx + mov esi,eax + mov edi,ebx + mov [Dx_],1 + mov [Dy_],1 + + sub ecx,eax + jnz no_signum_fill_r_x_copy + + mov [Dx_],-1 + +no_signum_fill_r_x_copy: + sub edx,ebx + jnz no_signum_fill_r_y_copy + + mov [Dy_],-1 + +no_signum_fill_r_y_copy: + mov ebx,[rectangular_shade_y] + sub ebx,edi + + mov edx,[PointerToEditBufer] + mov [y],edi + +loop_fill_rectangle_y_copy: + mov [x],esi + +loop_fill_rectangle_x_copy: + push esi edi + mov eax,[PointerToPicture] + mov ebx,[Picture_SizeX] + mov esi,[x] + mov edi,[y] + call GetColorOfPixel + mov [edx],ax + shr eax,16 + mov [edx+2],al + pop edi esi + + add edx,3 + mov eax,[x] + add eax,[Dx_] + mov [x],eax + + cmp eax,[rectangular_shade_x] + jl loop_fill_rectangle_x_copy + + mov eax,[y] + add eax,[Dy_] + mov [y],eax + + cmp eax,[rectangular_shade_y] + jl loop_fill_rectangle_y_copy + + call MovePictureToWorkScreen + + and [number_panel],0 + and [number_menu],0 + mov [DrawSprite_flag],1 + jmp still +;--------------------------------------------------------------------- +no_copy: +;<<<<<<<<<>>>>>>> + cmp [number_menu],3 + jne no_paste + + cmp [instrument_used],1 + jne no_paste + + cmp [Activate_instrument],0 + jne no_paste + + mov eax,[OldX] + mov ebx,[OldY] + + cmp eax,[rectangular_shade_x] + jl no_remove_x_paste + + mov ecx,[rectangular_shade_x] + mov [OldX],ecx ; OldX <-----> rectangulare_shade_x + mov [rectangular_shade_x],eax + +no_remove_x_paste: + cmp ebx,[rectangular_shade_y] + jl no_remove_y_paste + + mov ecx,[rectangular_shade_y] + mov [OldY],ecx ; OldY <-----> rectangulare_shade_y + mov [rectangular_shade_y],ebx + +no_remove_y_paste: + mov eax,[OldX] + mov ebx,[OldY] + mov ecx,[rectangular_shade_x] + mov edx,[rectangular_shade_y] + inc eax + inc ebx + dec ecx + dec edx + + mov [x],eax + mov [y],ebx + mov esi,eax + mov edi,ebx + mov [Dx_],1 + mov [Dy_],1 + + sub ecx,eax + jnz no_signum_fill_r_x_paste + + mov [Dx_],-1 + +no_signum_fill_r_x_paste: + sub edx,ebx + jnz no_signum_fill_r_y_paste + + mov [Dy_],-1 + +no_signum_fill_r_y_paste: + mov edx,[PointerToEditBufer] + mov [y],edi + +loop_fill_rectangle_y_paste: + mov [x],esi + +loop_fill_rectangle_x_paste: + push esi edi + mov ecx,[edx] + and ecx,0xffffff ;color + mov eax,[PointerToPicture] + mov ebx,[Picture_SizeX] + mov esi,[x] + mov edi,[y] + call PutPixel + pop edi esi + + add edx,3 + + mov eax,[x] + add eax,[Dx_] + mov [x],eax + cmp eax,[rectangular_shade_x] + jl loop_fill_rectangle_x_paste + + mov eax,[y] + add eax,[Dy_] + mov [y],eax + cmp eax,[rectangular_shade_y] + jl loop_fill_rectangle_y_paste + + call MovePictureToWorkScreen + and [number_panel],0 + and [number_menu],0 + mov [Paste_flag],1 + jmp still +;--------------------------------------------------------------------- +no_paste: +;<<<<<<<<<>>>>>>>>> + cmp [number_menu],4 + jne no_cut + + cmp [instrument_used],1 + jne no_cut + + cmp [Activate_instrument],0 + jne no_cut + + mov eax,[OldX] + mov ebx,[OldY] + + cmp eax,[rectangular_shade_x] + jl no_remove_x_cut + + mov ecx,[rectangular_shade_x] + mov [OldX],ecx ; OldX <-----> rectangulare_shade_x + mov [rectangular_shade_x],eax + +no_remove_x_cut: + cmp ebx,[rectangular_shade_y] + jl no_remove_y_cut + + mov ecx,[rectangular_shade_y] + mov [OldY],ecx ; OldY <-----> rectangulare_shade_y + mov [rectangular_shade_y],ebx + +no_remove_y_cut: + mov eax,[OldX] + mov ebx,[OldY] + mov ecx,[rectangular_shade_x] + mov edx,[rectangular_shade_y] + inc eax + inc ebx + dec ecx + dec edx + + mov [x],eax + mov [y],ebx + mov esi,eax + mov edi,ebx + mov [Dx_],1 + mov [Dy_],1 + + sub ecx,eax + jnz no_signum_fill_r_x + + mov [Dx_],-1 + +no_signum_fill_r_x: + sub edx,ebx + jnz no_signum_fill_r_y + + mov [Dy_],-1 + +no_signum_fill_r_y: + mov [y],edi + +loop_fill_rectangle_y: + mov [x],esi + +loop_fill_rectangle_x: + push esi edi + mov eax,[PointerToPicture] + mov ebx,[Picture_SizeX] + mov ecx,dword 0xffffff + mov esi,[x] + mov edi,[y] + call PutPixel + pop edi esi + + mov eax,[x] + add eax,[Dx_] + mov [x],eax + + cmp eax,[rectangular_shade_x] + jl loop_fill_rectangle_x + + mov eax,[y] + add eax,[Dy_] + mov [y],eax + + cmp eax,[rectangular_shade_y] + jl loop_fill_rectangle_y + + call MovePictureToWorkScreen + + and [number_panel],0 + and [number_menu],0 + jmp still +;--------------------------------------------------------------------- +no_cut: +;<<<<<>>>>> + cmp [number_menu],5 + jne no_cleare_all + + call cleare_work_arrea + call MovePictureToWorkScreen + + and [number_panel],0 + and [number_menu],0 + jmp still +;--------------------------------------------------------------------- +no_cleare_all: +;<<<<<>>>>> + cmp [number_menu],6 + jne still ;no_to_allocate_all + + mov [OldX],1 + mov [OldY],1 + mov eax,[Picture_SizeX] + mov ebx,[Picture_SizeY] + dec eax + dec ebx + mov [rectangular_shade_x],eax + mov [rectangular_shade_y],ebx + mov [instrument_used],1 + mov [Activate_instrument],1 + mov [Current_instrument],30 + mov [crossing],0 + and [number_panel],0 + and [number_menu],0 +; call TakeButtonInstruments +; call MovePictureToWorkScreen + jmp still +;--------------------------------------------------------------------- +;no_to_allocate_all: +;no_edit: +; jmp still +;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/media/animage/trunk/palette.inc b/programs/media/animage/trunk/palette.inc index 9df5b6a6b..235cf752b 100644 --- a/programs/media/animage/trunk/palette.inc +++ b/programs/media/animage/trunk/palette.inc @@ -2,55 +2,53 @@ ;-------analizing picture to palette------------------------ ;----------------------------------------------------------- analizing_picture_to_palette: + mov eax,[Picture_SizeX] + mov ebx,[Picture_SizeY] + imul eax,ebx + mov ecx,eax + mov edx,[PointerToPicture] + mov esi,1 ;counter colors in palette - mov eax,[Picture_SizeX] - mov ebx,[Picture_SizeY] - imul eax,ebx - mov ecx,eax - mov edx,[PointerToPicture] - mov esi,1 ;counter colors in palette +;put firs color of picture how one color in palette + mov ebp,[PointerToPalette] + mov eax,[edx] + and eax,0xffffff + mov [ebp],eax - ;put firs color of picture how one color in palette - mov ebp,[PointerToPalette] - mov eax,[edx] - and eax,0xffffff - mov [ebp],eax +analizing_to_palette: + mov eax,[edx] + and eax,0xffffff + mov edi,esi + mov ebp,[PointerToPalette] - analizing_to_palette: - mov eax,[edx] - and eax,0xffffff +next_color_in_palette: + mov ebx,[ebp] + and ebx,0xffffff + cmp ebx,eax ;this is color have in palette + je exit_loop_palette - mov edi,esi - mov ebp,[PointerToPalette] - next_color_in_palette: - mov ebx,[ebp] - and ebx,0xffffff - cmp ebx,eax ;this is color have in palette - je exit_loop_palette - add ebp,4 - dec edi - jnz next_color_in_palette + add ebp,4 + dec edi + jnz next_color_in_palette - inc esi - cmp esi,256 ;256 colors - ja more_than_256_colors - mov ebp,[PointerToPalette] - mov ebx,esi - dec ebx - shl ebx,2 - add ebp,ebx - mov [ebp],ax - shr eax,16 - mov [ebp+2],al + inc esi + cmp esi,256 ;256 colors + ja more_than_256_colors - exit_loop_palette: + mov ebp,[PointerToPalette] + mov ebx,esi + dec ebx + shl ebx,2 + add ebp,ebx + mov [ebp],ax + shr eax,16 + mov [ebp+2],al - add edx,3 - dec ecx - jnz analizing_to_palette +exit_loop_palette: + add edx,3 + dec ecx + jnz analizing_to_palette - - more_than_256_colors: - mov eax,esi - - ret \ No newline at end of file +more_than_256_colors: + mov eax,esi + ret \ No newline at end of file diff --git a/programs/media/animage/trunk/panel_data.inc b/programs/media/animage/trunk/panel_data.inc index 380da16dc..3039fb184 100644 --- a/programs/media/animage/trunk/panel_data.inc +++ b/programs/media/animage/trunk/panel_data.inc @@ -1,7 +1,7 @@ ;********************************************************** ;------------------TEXT DATA------------------------------- ;********************************************************** -name_of_program db 'Graphics editor <> V 1.2',0 +name_of_program db 'Graphics editor <> V 1.3',0 mouse_pos_x db 'X=' mouse_pos_y db 'Y=' new_text1 db 'PICTURE SIZE X' diff --git a/programs/media/animage/trunk/panel_engen.inc b/programs/media/animage/trunk/panel_engen.inc index 19098f83b..34c2188a5 100644 --- a/programs/media/animage/trunk/panel_engen.inc +++ b/programs/media/animage/trunk/panel_engen.inc @@ -2,539 +2,397 @@ ;-----interraction panel with user---------------- ;------------------------------------------------- panel_interraction: - ;>>>>>>>>>>>>>>>>>>>>>>>>>> - mov eax,18 - mov ebx,14 - ;mcall +;>>>>>>>>>>>>>>>>>>>>>>>>>> +; mcall 18,14 - and [Panel_flag],0 - ;collision with text on panel - next_columnus_text: + and [Panel_flag],0 +;collision with text on panel +next_columnus_text: + mov eax,[edi] + mov ebx,[edi+4] + sub eax,10 + sub ebx,3 + mov [Icon_text_x],eax + mov [Icon_text_y],ebx - mov eax,[edi] - mov ebx,[edi+4] - sub eax,10 - sub ebx,3 - mov [Icon_text_x],eax - mov [Icon_text_y],ebx + mov esi,[edi+8] + imul esi,10 + mov [button_menu_size_x],esi + mov [button_menu_size_y],dword 13 - mov esi,[edi+8] - imul esi,10 - mov [button_menu_size_x],esi - mov [button_menu_size_y],dword 13 + mov esi,[edi+8] + add edi,4*3 + add edi,esi - mov esi,[edi+8] - add edi,4*3 - add edi,esi + mov ecx,[MouseX] + mov edx,[MouseY] - mov ecx,[MouseX] - mov edx,[MouseY] + push edi + mov edi,[button_menu_size_y] + mov esi,[button_menu_size_x] + call columnus + pop edi - push edi - mov edi,[button_menu_size_y] - mov esi,[button_menu_size_x] - call columnus + mov esi,7 + test eax,eax + jz no_columnus_text - pop edi - mov esi,7 + mov esi,1 + mov [Panel_flag],1 + call GetMouseClick + test eax,eax + jz no_mouse_pressed - test eax,eax - jz no_columnus_text +; mcall 18,14 - mov esi,1 - mov [Panel_flag],1 - call GetMouseClick + jmp print_panel_menu - test eax,eax - jz no_mouse_pressed +no_mouse_pressed: +no_columnus_text: + mov eax,[Icon_text_x] + mov ebx,[Icon_text_y] + mov ecx,[button_menu_size_x] + mov edx,[button_menu_size_y] + call draw_volume_rectangle - mov eax,18 - mov ebx,14 - ;mcall + push [counter] + push edi + mov [counter],7 + mov edi,panel_text + call print_panel_text + pop edi + pop [counter] - call print_panel_menu + dec [counter] + jnz next_columnus_text - no_mouse_pressed: - - no_columnus_text: - - mov eax,[Icon_text_x] - mov ebx,[Icon_text_y] - mov ecx,[button_menu_size_x] ;------------------------- - mov edx,[button_menu_size_y] - call draw_volume_rectangle - - push [counter] - push edi - mov [counter],7 - mov edi,panel_text - call print_panel_text - - pop edi - pop [counter] - dec [counter] - jnz next_columnus_text - - ret + jmp still ;--------------------------------------------------------- ;-----draw panel menu(main engin of panel)---------------- ;--------------------------------------------------------- print_panel_menu: + push [counter] +;delit main buttons(some time) + mov [counter],10 + +next_icon_delit1: + mov edx,[counter] + add edx,11100000000000000000000000000000b + mcall 8 + inc [counter] + cmp [counter],30 + jl next_icon_delit1 + + ;delit buttons of brushes + mov [counter],40 + +next_icon_delit2: + mov edx,[counter] + add edx,11100000000000000000000000000000b + mcall 8 + inc [counter] + cmp [counter],45 + jl next_icon_delit2 + + ;delit buttons of zoom + mov [counter],45 + +next_icon_delit3: + mov edx,[counter] + add edx,11100000000000000000000000000000b + mcall 8 + inc [counter] + cmp [counter],50 + jl next_icon_delit3 + +;delit buttons of palette + mov edx,51 + add edx,11100000000000000000000000000000b + mcall 8 + +;delit buttons of color + mov edx,52 + add edx,11100000000000000000000000000000b + mcall 8 + + pop [counter] + + push esi + mov esi,[counter] + dec esi + shl esi,4 + + mov eax,[menu_rectangles+esi] + mov ebx,[menu_rectangles+esi+4] + mov ecx,[menu_rectangles+esi+8] + mov edx,[menu_rectangles+esi+12] + mov esi,1 + mov [menu_coordinat_x],eax + mov [menu_size_x],ecx + call draw_volume_rectangle + pop esi + +calculate_counter_menu: +;calculate menu counter + mov eax,[counter] + dec eax + shl eax,2 + mov ebx,[menu_counters+eax] + mov [counter_menu],ebx + + call GetMouseCoordinats + + and [menu_counter],0 + + push esi edi +;сглаживание анимации >>>>>>>>>>>>>>>>>> +; mcall 18,4 + +menu_loop: + mov eax,[menu_coordinat_x] + mov ebx,36 + mov ecx,[MouseX] + mov edx,[MouseY] + mov esi,[menu_size_x] + mov edi,18 + add ebx,[menu_counter] + add eax,2 + sub esi,3 + inc ebx + call columnus + mov esi,7 + + test eax,eax + jz no_columnus_menu_text + + mov esi,1 + +no_columnus_menu_text: + mov eax,[menu_coordinat_x] + mov ebx,36 + mov ecx,[menu_size_x] + mov edx,18 + add ebx,[menu_counter] + add eax,2 + sub ecx,3 + inc ebx + call draw_volume_rectangle + add [menu_counter],20 + + dec [counter_menu] + jnz menu_loop + +;print menu text + push [counter] + mov esi,[counter] + dec esi + shl esi,2 + mov edi,[menu_text_en+esi] + mov eax,[menu_counters+esi] + mov [counter],eax + call print_panel_text + pop [counter] + pop edi esi - push [counter] - ;delit main buttons(some time) +menu_still: + mcall 10 + mcall 2 + mcall 17 + call GetMouseClick + test eax,eax + jz calculate_counter_menu - mov [counter],10 + call GetMouseCoordinats +;calculate menu counter + mov eax,[counter] + dec eax + shl eax,2 + mov ebx,[menu_counters+eax] + mov [counter_menu],ebx - next_icon_delit1: + and [menu_counter],0 + and [counter_11],0 - mov eax,8 - mov edx,[counter] - add edx,11100000000000000000000000000000b - mcall - inc [counter] + push esi edi - cmp [counter],30 - jl next_icon_delit1 +menu_loop2: + mov eax,[menu_coordinat_x] + mov ebx,36 + mov ecx,[MouseX] + mov edx,[MouseY] + mov esi,[menu_size_x] + mov edi,18 + add ebx,[menu_counter] + add eax,2 + sub esi,3 + inc ebx + call columnus - ;delit buttons of brushes - mov [counter],40 + inc [counter_11] + test eax,eax + jz no_columnus_menu_text2 - next_icon_delit2: + mov esi,[counter_11] + mov [number_menu],esi - mov eax,8 - mov edx,[counter] - add edx,11100000000000000000000000000000b - mcall - inc [counter] +no_columnus_menu_text2: + add [menu_counter],20 + dec [counter_menu] + jnz menu_loop2 - cmp [counter],45 - jl next_icon_delit2 + pop edi esi - ;delit buttons of zoom - mov [counter],45 + mcall 5,15 - next_icon_delit3: + push [counter] + pusha + call drawwin + popa + pop [counter] - mov eax,8 - mov edx,[counter] - add edx,11100000000000000000000000000000b - mcall - inc [counter] + mov eax,[counter] + mov [number_panel],eax - cmp [counter],50 - jl next_icon_delit3 - - ;delit buttons of palette - mov eax,8 - mov edx,51 - add edx,11100000000000000000000000000000b - mcall - - - ;delit buttons of color - mov eax,8 - mov edx,52 - add edx,11100000000000000000000000000000b - mcall - - pop [counter] - - push esi - mov esi,[counter] - dec esi - shl esi,4 - - mov eax,[menu_rectangles+esi] - mov ebx,[menu_rectangles+esi+4] - mov ecx,[menu_rectangles+esi+8] - mov edx,[menu_rectangles+esi+12] - mov esi,1 - mov [menu_coordinat_x],eax - mov [menu_size_x],ecx - call draw_volume_rectangle - pop esi - - calculate_counter_menu: - - - ;calculate menu counter - mov eax,[counter] - dec eax - shl eax,2 - mov ebx,[menu_counters+eax] - mov [counter_menu],ebx - - call GetMouseCoordinats - - and [menu_counter],0 - push esi - push edi - ;сглаживание анимации >>>>>>>>>>>>>>>>>> - mov eax,18 - mov ebx,14 - ;mcall - - menu_loop: - - mov eax,[menu_coordinat_x] - mov ebx,36 - mov ecx,[MouseX] - mov edx,[MouseY] - mov esi,[menu_size_x] - mov edi,18 - add ebx,[menu_counter] - add eax,2 - sub esi,3 - inc ebx - call columnus - mov esi,7 - - test eax,eax - jz no_columnus_menu_text - - mov esi,1 - - no_columnus_menu_text: - - mov eax,[menu_coordinat_x] - mov ebx,36 - mov ecx,[menu_size_x] - mov edx,18 - add ebx,[menu_counter] - add eax,2 - sub ecx,3 - inc ebx - call draw_volume_rectangle - add [menu_counter],20 - - - dec [counter_menu] - jnz menu_loop - - - ;print menu text - push [counter] - mov esi,[counter] - dec esi - shl esi,2 - mov edi,[menu_text_en+esi] - mov eax,[menu_counters+esi] - mov [counter],eax - call print_panel_text - pop [counter] - pop edi - pop esi - - - menu_still: - - mov eax,10 - mcall - mov eax,2 - mcall - mov eax,17 - mcall - - call GetMouseClick - - test eax,eax - jz calculate_counter_menu - - call GetMouseCoordinats - - ;calculate menu counter - mov eax,[counter] - dec eax - shl eax,2 - mov ebx,[menu_counters+eax] - mov [counter_menu],ebx - - and [menu_counter],0 - and [counter_11],0 - - push esi - push edi - - menu_loop2: - - - mov eax,[menu_coordinat_x] - mov ebx,36 - mov ecx,[MouseX] - mov edx,[MouseY] - mov esi,[menu_size_x] - mov edi,18 - add ebx,[menu_counter] - add eax,2 - sub esi,3 - inc ebx - call columnus - - inc [counter_11] - - test eax,eax - jz no_columnus_menu_text2 - - mov esi,[counter_11] - mov [number_menu],esi - - no_columnus_menu_text2: - - add [menu_counter],20 - - dec [counter_menu] - jnz menu_loop2 - - pop edi - pop esi - - mov eax,5 - mov ebx,15 - mcall - - push [counter] - pushad - - call drawwin - - popad - pop [counter] - - mov eax,[counter] - mov [number_panel],eax - - call TakeInstruments - jmp still + jmp TakeInstruments ;--------------------------------------------------------- ;------print mouse position on panel---------------------- ;--------------------------------------------------------- PrintMousePos: - pushad + mov eax,[Window_SizeX] + sub eax,75 + mov ebx,20+15+6 + mov ecx,52 + mov edx,18 + mov esi,4 + call draw_volume_rectangle - mov eax,[Window_SizeX] - sub eax,75 - mov ebx,20+15+6 - mov ecx,52 - mov edx,18 - mov esi,4 - call draw_volume_rectangle + mov eax,[Window_SizeX] + sub eax,75 + mov ebx,20+15+6+18+2 + mov ecx,52 + mov edx,18 + mov esi,4 + call draw_volume_rectangle - mov eax,[Window_SizeX] - sub eax,75 - mov ebx,20+15+6+18+2 - mov ecx,52 - mov edx,18 - mov esi,4 - call draw_volume_rectangle + mov eax,[Window_SizeX] + sub eax,70 + mov ebx,20+15+6+6 + and ecx,0 + mov edx,mouse_pos_x + mov esi,2 + call print_text - mov eax,[Window_SizeX] - sub eax,70 - mov ebx,20+15+6+6 - and ecx,0 - mov edx,mouse_pos_x - mov esi,2 - call print_text + mov eax,[Window_SizeX] + sub eax,70 + mov ebx,20+15+6+6+18+1 + and ecx,0 + mov edx,mouse_pos_y + mov esi,2 + call print_text - mov eax,[Window_SizeX] - sub eax,70 - mov ebx,20+15+6+6+18+1 - and ecx,0 - mov edx,mouse_pos_y - mov esi,2 - call print_text + mov ecx,[ScreenX] + add ecx,[PosX] + mov edx,[Window_SizeX] + sub edx,55 + shl edx,16 + add edx,20+15+6+6 + and esi,0 + mcall 47,<4,0> - mov eax,47 - mov ebx,4*65536 - mov ecx,[ScreenX] - add ecx,[PosX] - mov edx,[Window_SizeX] - sub edx,55 - shl edx,16 - add edx,20+15+6+6 - and esi,0 - mcall - - mov eax,47 - mov ebx,4*65536 - mov ecx,[ScreenY] - add ecx,[PosY] - mov edx,[Window_SizeX] - sub edx,55 - shl edx,16 - add edx,20+15+6+18+1+6 - and esi,0 + mov ecx,[ScreenY] + add ecx,[PosY] + mov edx,[Window_SizeX] + sub edx,55 + shl edx,16 + add edx,20+15+6+18+1+6 mcall popad ret -;---------------------------------------------------------- -;---------------draw panel in window of program------------ -;---------------------------------------------------------- -draw_panel: - - mov eax,5 - mov ebx,20 - mov ecx,[Window_SizeX] - mov edx,15 - mov esi,6 - sub ecx,10 - call draw_volume_rectangle ; top menu - file and etc. - - ;mov eax,5 - ;mov ebx,20 - ;mov ecx,[Window_SizeX] - ;mov edx,15 - ;mov esi,6 - ;sub ecx,10 - ;call draw_volume_rectangle - - mov eax,5 - mov ebx,20+15+1 - mov ecx,[Window_SizeX] - mov edx,50 - mov esi,1 - sub ecx,10 - call draw_volume_rectangle ; tools panel - - mov eax,5 - mov ebx,20+15+1+50+1 - mov ecx,[Window_SizeX] - mov edx,[Window_SizeY] - mov esi,1 - sub ecx,10+20 - sub edx,20+15+1+50+1+5+20 - call draw_volume_rectangle ; picure area - - mov eax,5 - mov ebx,[Window_SizeY] - mov ecx,[Window_SizeX] - mov edx,20+10 - mov esi,3 - sub ecx,30 - sub ebx,25+10 - call draw_volume_rectangle ; horizontal scrollbar - - mov eax,[Window_SizeX] - mov ebx,20+15+1+49+2 - mov ecx,20+10 - mov edx,[Window_SizeY] - mov esi,3 - sub eax,25+10 - sub edx,20+15+1+49+5+20 - call draw_volume_rectangle ; vertical scrollbar - - mov eax,[Window_SizeX] - mov ebx,[Window_SizeY] - mov ecx,20+10 - mov edx,20+10 - mov esi,6 - sub eax,25+10 - sub ebx,25+10 - call draw_volume_rectangle ; down and right small area - - ;mov eax,445 - ;mov ebx,20+15+6 - ;mov ecx,37 - ;mov edx,37 - ;mov esi,4 - ;call draw_volume_rectangle - - ret - ;---------------------------------------------------------- ;----------print text on the panel and menu---------------- ;---------------------------------------------------------- print_panel_text: - next_panel_text: +next_panel_text: + mov eax,[edi] + mov ebx,[edi+4] +; xor ecx,ecx + mov ecx,0x10000000 + mov edx,edi + add edx,12 + mov esi,[edi+8] + add edi,esi + add edi,3*4 - mov eax,[edi] - mov ebx,[edi+4] - ;xor ecx,ecx - mov ecx,0x10000000 - mov edx,edi - add edx,12 - mov esi,[edi+8] - add edi,esi - add edi,3*4 + push edi + call print_text + pop edi - push edi - call print_text - pop edi - - dec [counter] - jnz next_panel_text + dec [counter] + jnz next_panel_text ret ;---------------------------------------------------------- ;------------draw lines of scoll--------------------------- ;---------------------------------------------------------- draw_scrollers: + mov edi,[CounterX] + mov eax,[Scroll1CoordinatX] + mov ebx,[Window_SizeY] + sub ebx,22+10 + mov ecx,[Window_SizeX] + sub ecx,10+5+20+10+1 + mov edx,14+10 + mov esi,1 + mov [Scroll1CoordinatX],eax + mov [Scroll1CoordinatY],ebx + mov [Scroll1MaxSizeY],edx + mov [Scroll1MaxSizeX],ecx + imul ecx,edi + push eax ebx edx + mov eax,ecx + mov ebx,[Picture_SizeX] + cdq + idiv ebx + mov ecx,eax + pop edx ebx eax + mov [Scroll1SizeX],ecx + mov edi,[Scroll1MaxSizeX] + sub edi,ecx + mov [Scroll1FreeX],edi + call draw_volume_rectangle - mov edi,[CounterX] - mov eax,[Scroll1CoordinatX] - mov ebx,[Window_SizeY] - sub ebx,22+10 - mov ecx,[Window_SizeX] - sub ecx,10+5+20+10+1 - mov edx,14+10 - mov esi,1 - mov [Scroll1CoordinatX],eax - mov [Scroll1CoordinatY],ebx - mov [Scroll1MaxSizeY],edx - mov [Scroll1MaxSizeX],ecx - imul ecx,edi - push eax - push ebx - push edx - mov eax,ecx - mov ebx,[Picture_SizeX] - cdq - idiv ebx - mov ecx,eax - pop edx - pop ebx - pop eax - mov [Scroll1SizeX],ecx - mov edi,[Scroll1MaxSizeX] - sub edi,ecx - mov [Scroll1FreeX],edi - call draw_volume_rectangle + mov eax,[Window_SizeX] + sub eax,22+10 + mov ebx,[Scroll2CoordinatY] + mov ecx,14+10 + mov edx,[Window_SizeY] + sub edx,20+15+1+49+10+20+11 + mov esi,1 + mov [Scroll2CoordinatX],eax + mov [Scroll2CoordinatY],ebx + mov [Scroll2MaxSizeX],ecx + mov [Scroll2MaxSizeY],edx - mov eax,[Window_SizeX] - sub eax,22+10 - mov ebx,[Scroll2CoordinatY] - mov ecx,14+10 - mov edx,[Window_SizeY] - sub edx,20+15+1+49+10+20+11 - mov esi,1 - mov [Scroll2CoordinatX],eax - mov [Scroll2CoordinatY],ebx - mov [Scroll2MaxSizeX],ecx - mov [Scroll2MaxSizeY],edx + imul edx,[CounterY] + push eax ebx + mov eax,edx + mov ebx,[Picture_SizeY] + cdq + idiv ebx + mov edx,eax + pop ebx eax + mov [Scroll2SizeY],edx + mov edi,[Scroll2MaxSizeY] + sub edi,edx + mov [Scroll2FreeY],edi - imul edx,[CounterY] - push eax - push ebx - mov eax,edx - mov ebx,[Picture_SizeY] - cdq - idiv ebx - mov edx,eax - pop ebx - pop eax - mov [Scroll2SizeY],edx - mov edi,[Scroll2MaxSizeY] - sub edi,edx - mov [Scroll2FreeY],edi + call draw_volume_rectangle - call draw_volume_rectangle + ret - ret - ret - -button_menu_size_x dd 0 -button_menu_size_y dd 0 \ No newline at end of file +button_menu_size_x dd 0 +button_menu_size_y dd 0 \ No newline at end of file diff --git a/programs/media/animage/trunk/screen.inc b/programs/media/animage/trunk/screen.inc index ac33f4c5f..58a12f72a 100644 --- a/programs/media/animage/trunk/screen.inc +++ b/programs/media/animage/trunk/screen.inc @@ -2,351 +2,342 @@ ;--------Move picture from array to work screeen----------- ;---------------------------------------------------------- MovePictureToWorkScreen: + call cleare_screen + mov eax,[Picture_SizeX] + mov ebx,[Picture_SizeY] + mov ecx,[MaxWorkScreen_SizeX] + mov edx,[MaxWorkScreen_SizeY] + mov esi,[k] + imul eax,esi + imul ebx,esi + cmp eax,ecx + jle lab1 - call cleare_screen + mov eax,[MaxWorkScreen_SizeX] + mov [WorkScreen_SizeX],eax + jmp lab2 - mov eax,[Picture_SizeX] - mov ebx,[Picture_SizeY] - mov ecx,[MaxWorkScreen_SizeX] - mov edx,[MaxWorkScreen_SizeY] - mov esi,[k] - imul eax,esi - imul ebx,esi +lab1: + mov [WorkScreen_SizeX],eax - cmp eax,ecx - jle lab1 - mov eax,[MaxWorkScreen_SizeX] - mov [WorkScreen_SizeX],eax - jmp lab2 - lab1: - mov [WorkScreen_SizeX],eax - lab2: +lab2: + cmp ebx,edx + jle lab3 + mov ebx,[MaxWorkScreen_SizeY] + mov [WorkScreen_SizeY],ebx + jmp lab4 - cmp ebx,edx - jle lab3 - mov ebx,[MaxWorkScreen_SizeY] - mov [WorkScreen_SizeY],ebx - jmp lab4 - lab3: - mov [WorkScreen_SizeY],ebx - lab4: +lab3: + mov [WorkScreen_SizeY],ebx - mov eax,[WorkScreen_SizeX] - mov ebx,[k] +lab4: + mov eax,[WorkScreen_SizeX] + mov ebx,[k] cdq - idiv ebx - mov [CounterX],eax - mov eax,[WorkScreen_SizeY] + idiv ebx + mov [CounterX],eax + mov eax,[WorkScreen_SizeY] cdq - idiv ebx - mov [CounterY],eax + idiv ebx + mov [CounterY],eax - mov eax,[WorkScreen_SizeX] - mov ecx,eax - mov ebx,[k] + mov eax,[WorkScreen_SizeX] + mov ecx,eax + mov ebx,[k] cdq - idiv ebx - imul eax,ebx - sub ecx,eax - lea ecx,[ecx+ecx*2] - ; - mov eax,[WorkScreen_SizeX] - mov ebx,[k] - dec ebx - imul eax,ebx - lea eax,[eax+eax*2] - add eax,ecx - mov [OffsetYWorkScreen],eax + idiv ebx + imul eax,ebx + sub ecx,eax + lea ecx,[ecx+ecx*2] + mov eax,[WorkScreen_SizeX] + mov ebx,[k] + dec ebx + imul eax,ebx + lea eax,[eax+eax*2] + add eax,ecx + mov [OffsetYWorkScreen],eax - mov ebx,[Picture_SizeX] - mov eax,[CounterX] - sub ebx,eax - lea ebx,[ebx+ebx*2] - mov [OffsetYPicture],ebx + mov ebx,[Picture_SizeX] + mov eax,[CounterX] + sub ebx,eax + lea ebx,[ebx+ebx*2] + mov [OffsetYPicture],ebx - mov eax,[WorkScreen_SizeX] - mov ebx,[k] - sub eax,ebx - lea eax,[eax+eax*2] - mov [OffsetYBigPixel],eax + mov eax,[WorkScreen_SizeX] + mov ebx,[k] + sub eax,ebx + lea eax,[eax+eax*2] + mov [OffsetYBigPixel],eax - mov eax,[PosX] - mov ebx,[PosY] - mov ecx,[Picture_SizeX] - imul ecx,ebx - add eax,ecx - lea eax,[eax+eax*2] - add eax,[PointerToPicture] + mov eax,[PosX] + mov ebx,[PosY] + mov ecx,[Picture_SizeX] + imul ecx,ebx + add eax,ecx + lea eax,[eax+eax*2] + add eax,[PointerToPicture] + mov ebx,[ScreenPointer] + mov edi,[CounterY] - mov ebx,[ScreenPointer] +;if size of picture natural(mastab is 1) than move picture to work screen + cmp [k],1 + jne no_zoom_1_ - mov edi,[CounterY] +screen_y_1: + mov esi,[CounterX] - ;if size of picture natural(mastab is 1) than move picture to work screen - cmp [k],1 - jne no_zoom_1_ - screen_y_1: - mov esi,[CounterX] - screen_x_1: - mov ecx,[eax] - and ecx,0xffffff - mov ebp,ecx - shr ecx,16 - mov [ebx],bp - mov [ebx+2],cl - add ebx,3; - add eax,3 - dec esi - jnz screen_x_1 - add eax,[OffsetYPicture] - add ebx,[OffsetYWorkScreen] - dec edi - jnz screen_y_1 - jmp fps - no_zoom_1_: +screen_x_1: + mov ecx,[eax] + and ecx,0xffffff + mov ebp,ecx + shr ecx,16 + mov [ebx],bp + mov [ebx+2],cl + add ebx,3; + add eax,3 + dec esi + jnz screen_x_1 + add eax,[OffsetYPicture] + add ebx,[OffsetYWorkScreen] + dec edi + jnz screen_y_1 + jmp fps - cmp [k],2 - jne no_zoom_2 +no_zoom_1_: + cmp [k],2 + jne no_zoom_2 - screen_y_2: - mov esi,[CounterX] - screen_x_2: - mov ecx,[eax] - and ecx,0xffffff - mov ebp,ecx - shr ecx,16 - mov edx,ebx - mov [edx],bp - mov [edx+2],cl - mov [edx+3],bp - mov [edx+3+2],cl - add edx,3*2 - add edx,[OffsetYBigPixel] - mov [edx],bp - mov [edx+2],cl - mov [edx+3],bp - mov [edx+3+2],cl - add edx,3*2 - add edx,[OffsetYBigPixel] - add ebx,3*2 - add eax,3 - dec esi - jnz screen_x_2 - add eax,[OffsetYPicture] - add ebx,[OffsetYWorkScreen] - dec edi - jnz screen_y_2 - jmp fps - no_zoom_2: +screen_y_2: + mov esi,[CounterX] - cmp [k],4 - jne no_zoom_4 - screen_y_4: - mov esi,[CounterX] - screen_x_4: - mov ecx,[eax] - and ecx,0xffffff - mov ebp,ecx - shr ecx,16 - mov edx,ebx - mov [edx],bp - mov [edx+2],cl - mov [edx+3],bp - mov [edx+3+2],cl - mov [edx+6],bp - mov [edx+6+2],cl - mov [edx+9],bp - mov [edx+9+2],cl - add edx,3*4 - add edx,[OffsetYBigPixel] - mov [edx],bp - mov [edx+2],cl - mov [edx+3],bp - mov [edx+3+2],cl - mov [edx+6],bp - mov [edx+6+2],cl - mov [edx+9],bp - mov [edx+9+2],cl - add edx,3*4 - add edx,[OffsetYBigPixel] - mov [edx],bp - mov [edx+2],cl - mov [edx+3],bp - mov [edx+3+2],cl - mov [edx+6],bp - mov [edx+6+2],cl - mov [edx+9],bp - mov [edx+9+2],cl - add edx,3*4 - add edx,[OffsetYBigPixel] - mov [edx],bp - mov [edx+2],cl - mov [edx+3],bp - mov [edx+3+2],cl - mov [edx+6],bp - mov [edx+6+2],cl - mov [edx+9],bp - mov [edx+9+2],cl - add edx,3*4 - add edx,[OffsetYBigPixel] - add ebx,4*3 - add eax,3 - dec esi - jnz screen_x_4 - add eax,[OffsetYPicture] - add ebx,[OffsetYWorkScreen] - dec edi - jnz screen_y_4 - jmp fps - no_zoom_4: - ;if zoom more than 4 - screen_y: - mov esi,[CounterX] - screen_x: - mov ecx,[eax] - and ecx,0xffffff - mov ebp,ecx - shr ecx,16 - push ebx - push eax - mov edx,[k] - big_pixel_y: - mov eax,[k] - big_pixel_x: - mov [ebx],bp - mov [ebx+2],cl - add ebx,3 - dec eax - jnz big_pixel_x - add ebx,[OffsetYBigPixel] - dec edx - jnz big_pixel_y - pop eax - pop ebx - mov edx,[k] - lea edx,[edx+edx*2] - add ebx,edx - add eax,3 - dec esi - jnz screen_x - add eax,[OffsetYPicture] - add ebx,[OffsetYWorkScreen] - dec edi - jnz screen_y +screen_x_2: + mov ecx,[eax] + and ecx,0xffffff + mov ebp,ecx + shr ecx,16 + mov edx,ebx + mov [edx],bp + mov [edx+2],cl + mov [edx+3],bp + mov [edx+3+2],cl + add edx,3*2 + add edx,[OffsetYBigPixel] + mov [edx],bp + mov [edx+2],cl + mov [edx+3],bp + mov [edx+3+2],cl + add edx,3*2 + add edx,[OffsetYBigPixel] + add ebx,3*2 + add eax,3 + dec esi + jnz screen_x_2 + add eax,[OffsetYPicture] + add ebx,[OffsetYWorkScreen] + dec edi + jnz screen_y_2 + jmp fps - fps: - ;mov eax,18 - ;mov ebx,14 - ;mcall +no_zoom_2: + cmp [k],4 + jne no_zoom_4 - mov eax,7 - mov ebx,[ScreenPointer] - mov ecx,[WorkScreen_SizeX] - mov edx,[WorkScreen_SizeY] - shl ecx,16 - add ecx,edx - mov edx,8*65536+20+15+49+5+1 - mcall +screen_y_4: + mov esi,[CounterX] - ret +screen_x_4: + mov ecx,[eax] + and ecx,0xffffff + mov ebp,ecx + shr ecx,16 + mov edx,ebx + mov [edx],bp + mov [edx+2],cl + mov [edx+3],bp + mov [edx+3+2],cl + mov [edx+6],bp + mov [edx+6+2],cl + mov [edx+9],bp + mov [edx+9+2],cl + add edx,3*4 + add edx,[OffsetYBigPixel] + mov [edx],bp + mov [edx+2],cl + mov [edx+3],bp + mov [edx+3+2],cl + mov [edx+6],bp + mov [edx+6+2],cl + mov [edx+9],bp + mov [edx+9+2],cl + add edx,3*4 + add edx,[OffsetYBigPixel] + mov [edx],bp + mov [edx+2],cl + mov [edx+3],bp + mov [edx+3+2],cl + mov [edx+6],bp + mov [edx+6+2],cl + mov [edx+9],bp + mov [edx+9+2],cl + add edx,3*4 + add edx,[OffsetYBigPixel] + mov [edx],bp + mov [edx+2],cl + mov [edx+3],bp + mov [edx+3+2],cl + mov [edx+6],bp + mov [edx+6+2],cl + mov [edx+9],bp + mov [edx+9+2],cl + add edx,3*4 + add edx,[OffsetYBigPixel] + add ebx,4*3 + add eax,3 + dec esi + jnz screen_x_4 + add eax,[OffsetYPicture] + add ebx,[OffsetYWorkScreen] + dec edi + jnz screen_y_4 + jmp fps + +no_zoom_4: +;if zoom more than 4 +screen_y: + mov esi,[CounterX] + +screen_x: + mov ecx,[eax] + and ecx,0xffffff + mov ebp,ecx + shr ecx,16 +;--------------------------------------------------------- + push ebx eax + mov edx,[k] + +big_pixel_y: + mov eax,[k] + +big_pixel_x: + mov [ebx],bp + mov [ebx+2],cl + add ebx,3 + dec eax + jnz big_pixel_x + add ebx,[OffsetYBigPixel] + dec edx + jnz big_pixel_y + pop eax ebx +;--------------------------------------------------------- + mov edx,[k] + lea edx,[edx+edx*2] + add ebx,edx + add eax,3 + dec esi + jnz screen_x + add eax,[OffsetYPicture] + add ebx,[OffsetYWorkScreen] + dec edi + jnz screen_y + +fps: + ;mcall 18,14 + mov ebx,[ScreenPointer] + mov ecx,[WorkScreen_SizeX] + mov edx,[WorkScreen_SizeY] + shl ecx,16 + add ecx,edx + mov edx,8*65536+20+15+49+5+1 + + mcall 7 + ret ;---------------------------------------------------------- ;--------------------clear screen-------------------------- ;---------------------------------------------------------- cleare_screen: + mov eax,[ScreenPointer] + mov ebx,[WorkScreen_SizeX] + imul ebx,[WorkScreen_SizeY] + lea ebx,[ebx+ebx*2] + shr ebx,3 + inc ebx + mov esi,0xffffff - mov eax,[ScreenPointer] - mov ebx,[WorkScreen_SizeX] - imul ebx,[WorkScreen_SizeY] - lea ebx,[ebx+ebx*2] - shr ebx,3 - inc ebx - mov esi,0xffffff - - clear_screen_loop: - - mov [eax],esi - mov [eax+3],esi - mov [eax+6],si - add eax,4+4 - - dec ebx - jnz clear_screen_loop +clear_screen_loop: + mov [eax],esi + mov [eax+3],esi + mov [eax+6],si + add eax,4+4 + dec ebx + jnz clear_screen_loop ret ;---------------------------------------------------------- ;-------------cleare work arrea(work screen)--------------- ;---------------------------------------------------------- cleare_work_arrea: + mov eax,[PointerToPicture] + mov ebx,[Picture_SizeX] + imul ebx,[Picture_SizeY] + lea ebx,[ebx+ebx*2] + shr ebx,3 + inc ebx + mov esi,0xffffff - mov eax,[PointerToPicture] - mov ebx,[Picture_SizeX] - imul ebx,[Picture_SizeY] - lea ebx,[ebx+ebx*2] - shr ebx,3 - inc ebx - mov esi,0xffffff - - clear_work_arrea_loop: - - mov [eax],esi - mov [eax+3],esi - mov [eax+6],si - add eax,4+4 - - dec ebx - jnz clear_work_arrea_loop +clear_work_arrea_loop: + mov [eax],esi + mov [eax+3],esi + mov [eax+6],si + add eax,4+4 + dec ebx + jnz clear_work_arrea_loop ret ;----------------------------------------------------------- ;calculate position work screen on a picture ;----------------------------------------------------------- CalculatePositionScreen: + mov eax,[Picture_SizeX] + mov ebx,[Picture_SizeY] + mov ecx,[CounterX] + mov edx,[CounterY] + sub eax,ecx + sub ebx,edx + cmp [PosX],eax + jle no_limit_screen_x + mov [PosX],eax - mov eax,[Picture_SizeX] - mov ebx,[Picture_SizeY] - mov ecx,[CounterX] - mov edx,[CounterY] - sub eax,ecx - sub ebx,edx +no_limit_screen_x: + cmp [PosY],ebx + jle no_limit_screen_y + mov [PosY],ebx - cmp [PosX],eax - jle no_limit_screen_x - mov [PosX],eax - no_limit_screen_x: +no_limit_screen_y: + cmp [PosX],0 + jns no_minimum_screen_x + mov [PosX],0 - cmp [PosY],ebx - jle no_limit_screen_y - mov [PosY],ebx - no_limit_screen_y: +no_minimum_screen_x: + cmp [PosY],0 + jns no_minimum_screen_y + mov [PosY],0 - cmp [PosX],0 - jns no_minimum_screen_x - mov [PosX],0 - no_minimum_screen_x: - - cmp [PosY],0 - jns no_minimum_screen_y - mov [PosY],0 - no_minimum_screen_y: - - ret +no_minimum_screen_y: + ret ;----------------------------------------------------------- ;-----------calculate cordinats on work picture-------------- ;----------------------------------------------------------- GetScreenCordinats: - - mov eax,[MouseX] - mov ebx,[MouseY] - sub eax,9 - sub ebx,87 - - mov ecx,[k] + mov eax,[MouseX] + mov ebx,[MouseY] + sub eax,9 + sub ebx,87 + mov ecx,[k] cdq - idiv ecx - mov [ScreenX],eax - mov eax,ebx + idiv ecx + mov [ScreenX],eax + mov eax,ebx cdq - idiv ecx - mov [ScreenY],eax - + idiv ecx + mov [ScreenY],eax ret \ No newline at end of file