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
This commit is contained in:
Marat Zakiyanov (Mario79) 2010-10-04 20:40:19 +00:00
parent 74199525db
commit bab525b2cf
12 changed files with 2070 additions and 2409 deletions

View File

@ -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
@ -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:

View File

@ -1,11 +1,9 @@
;-----------------------------------------------------
;----------------------------------------------------------
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
@ -14,9 +12,8 @@ draw_volume_rectangle:
mov [color_line2],0xffffff
mov [color_line3],0xc7cbcf
jmp exit_colors
no_volume_light_rectangle:
;----------------------------------------------------------
no_volume_light_rectangle:
cmp esi,2
jne no_pressed_rectangle
@ -24,11 +21,9 @@ draw_volume_rectangle:
mov [color_line1],0xaeabae
mov [color_line2],0x666666
mov [color_line3],0x666666
jmp exit_colors
no_pressed_rectangle:
;----------------------------------------------------------
no_pressed_rectangle:
cmp esi,3
jne no_pressed_panel
@ -37,9 +32,8 @@ draw_volume_rectangle:
mov [color_line2],7000
mov [color_line3],0xffffff
jmp exit_colors
no_pressed_panel:
;----------------------------------------------------------
no_pressed_panel:
cmp esi,4
jne no_pressed_light_panel
@ -48,9 +42,8 @@ draw_volume_rectangle:
mov [color_line2],7000
mov [color_line3],0xffffff
jmp exit_colors
no_pressed_light_panel:
;----------------------------------------------------------
no_pressed_light_panel:
cmp esi,5
jne no_light_pressed_rectangle
@ -58,11 +51,9 @@ draw_volume_rectangle:
mov [color_line1],0xaeabae
mov [color_line2],0x666666
mov [color_line3],0x666666
jmp exit_colors
no_light_pressed_rectangle:
;----------------------------------------------------------
no_light_pressed_rectangle:
cmp esi,6
jne no_work_rectangle
@ -71,9 +62,8 @@ draw_volume_rectangle:
mov [color_line2],0xc7cbcf
mov [color_line3],0xc7cbcf
jmp exit_colors
no_work_rectangle:
;----------------------------------------------------------
no_work_rectangle:
cmp esi,7
jne no_work_rectangle_2
@ -82,11 +72,10 @@ draw_volume_rectangle:
mov [color_line2],0xc7cbcf
mov [color_line3],0xc7cbcf
jmp exit_colors
no_work_rectangle_2:
exit_colors:
;draw rectangle
;----------------------------------------------------------
no_work_rectangle_2:
exit_colors:
;draw rectangle
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
@ -95,7 +84,7 @@ draw_volume_rectangle:
add ecx,[line_size_y]
mov edx,[color_rectangle]
call draw_rectangle
;line 1
;line 1
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -105,7 +94,7 @@ draw_volume_rectangle:
add ecx,[line_y]
add ebx,[line_size_x]
call draw_line
;line 2
;line 2
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -115,7 +104,7 @@ draw_volume_rectangle:
add ecx,[line_y]
add ecx,[line_size_y]
call draw_line
;line 3
;line 3
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -127,7 +116,7 @@ draw_volume_rectangle:
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
;line 4
;line 4
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -139,7 +128,7 @@ draw_volume_rectangle:
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
;light line 1
;light line 1
mov edx,[color_line2]
mov ebx,[line_x]
mov ecx,[line_y]
@ -153,7 +142,7 @@ draw_volume_rectangle:
dec ebx
inc ecx
call draw_line
;light line 2
;light line 2
mov edx,[color_line2]
mov ebx,[line_x]
mov ecx,[line_y]
@ -167,7 +156,7 @@ draw_volume_rectangle:
dec ecx
inc ebx
call draw_line
;light line 3
;light line 3
mov edx,[color_line3]
mov ebx,[line_x]
mov ecx,[line_y]
@ -183,7 +172,7 @@ draw_volume_rectangle:
dec ebx
dec ecx
call draw_line
;light line 4
;light line 4
mov edx,[color_line3]
mov ebx,[line_x]
mov ecx,[line_y]
@ -199,12 +188,10 @@ draw_volume_rectangle:
dec ecx
dec ebx
call draw_line
ret
;----------------------------------------------------------
rectangle:
no_light_rectangle:
no_light_rectangle:
mov [line_x],eax
mov [line_y],ebx
mov [line_size_x],ecx
@ -221,16 +208,12 @@ rectangle:
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
;line 1
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -240,7 +223,7 @@ draw_conture:
add ecx,[line_y]
add ebx,[line_size_x]
call draw_line
;line 2
;line 2
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -250,7 +233,7 @@ draw_conture:
add ecx,[line_y]
add ecx,[line_size_y]
call draw_line
;line 3
;line 3
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -262,7 +245,7 @@ draw_conture:
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
;line 4
;line 4
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
@ -274,11 +257,9 @@ draw_conture:
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
ret
;----------------------------------------------------------
columnus:
sub eax,ecx
jns no_columnus
neg eax
@ -291,9 +272,9 @@ columnus:
ja no_columnus
mov eax,1
jmp columnus_true
no_columnus:
no_columnus:
xor eax,eax
columnus_true:
columnus_true:
ret
;----------------------------------------------------------
print_text:
@ -307,8 +288,7 @@ print_text:
ret
;----------------------------------------------------------
draw_rectangle:
mov eax,13
mcall
mcall 13
ret
;------------------------
draw_line:

View File

@ -2,10 +2,8 @@
;-------------interraction MOUSE--------------
;---------------------------------------------
mouse:
call GetMouseCoordinats
;panel
;panel
mov edx,[Window_SizeX]
sub edx,5
@ -22,23 +20,19 @@ mouse:
jae no_panel
call GetMouseCoordinats
mov [counter],7
mov edi,panel_text
call panel_interraction
jmp still
no_panel:
jmp panel_interraction
no_panel:
cmp [Panel_flag],0
jz no_redraw_panel
mov [counter],7
mov edi,panel_text
call panel_interraction
no_redraw_panel:
jmp panel_interraction
no_redraw_panel:
call GetMouseCoordinats
mov eax,[MouseX]
mov ebx,[MouseY]
@ -52,21 +46,17 @@ mouse:
cmp ebx,edx
jae mouse_scroll
jmp no_scrollers
mouse_scroll:
mouse_scroll:
mov [exit_from_work_arrea],1 ;mouse situated after work arrea
;scrollers
;scrollers
call GetMouseClick
cmp eax,1
jne no_click
call GetMouseCoordinats
;interraction with horizontal scroller
;interraction with horizontal scroller
mov eax,[Scroll1CoordinatX]
mov ebx,[Scroll1CoordinatY]
mov ecx,[MouseX]
@ -74,11 +64,9 @@ mouse:
mov esi,[Scroll1MaxSizeX]
mov edi,[Scroll1MaxSizeY]
call columnus
test eax,eax
jz no_horizontal
mov eax,9
mov ebx,[Scroll1CoordinatY]
mov ecx,[Scroll1MaxSizeX]
@ -96,14 +84,12 @@ mouse:
mov edx,8+1
add edx,[Scroll1MaxSizeX]
mov [Scroll1CoordinatX],eax
sub eax,9
jns no_min_scroll
mov [Scroll1CoordinatX],9
no_min_scroll:
no_min_scroll:
cmp ecx,edx
jl no_max_scroll
@ -111,8 +97,7 @@ mouse:
sub edx,ebx
mov [Scroll1CoordinatX],edx
no_max_scroll:
;
no_max_scroll:
mov eax,[Scroll1CoordinatX]
sub eax,9
mov ebx,[Picture_SizeX]
@ -121,11 +106,9 @@ mouse:
cdq
idiv ebx
mov [PosX],eax
jmp no_vertical
no_horizontal:
no_horizontal:
mov eax,[Scroll2CoordinatX]
mov ebx,[Scroll2CoordinatY]
mov ecx,[MouseX]
@ -133,7 +116,6 @@ mouse:
mov esi,[Scroll2MaxSizeX]
mov edi,[Scroll2MaxSizeY]
call columnus
test eax,eax
jz no_vertical
@ -160,8 +142,7 @@ mouse:
mov [Scroll2CoordinatY],89
no_min_scroll2:
no_min_scroll2:
cmp ecx,edx
jl no_max_scroll2
@ -169,8 +150,7 @@ mouse:
sub edx,ebx
mov [Scroll2CoordinatY],edx
no_max_scroll2:
;
no_max_scroll2:
mov eax,[Scroll2CoordinatY]
sub eax,89
mov ebx,[Picture_SizeY]
@ -180,19 +160,15 @@ mouse:
idiv ebx
mov [PosY],eax
no_vertical:
no_vertical:
call CalculatePositionScreen
call draw_scrollers
call MovePictureToWorkScreen
no_click:
no_click:
jmp still
no_scrollers:
no_scrollers:
mov eax,[MouseX]
mov ebx,[MouseY]
mov ecx,[Window_SizeX]
@ -211,50 +187,39 @@ mouse:
cmp ebx,edx
jae not_work_arrea
jmp mouse_in_work_arrea
not_work_arrea:
not_work_arrea:
mov [exit_from_work_arrea],1
jmp still
mouse_in_work_arrea:
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-------------
;------------begin copy for undo-------------
inc [number_undo]
cmp [number_undo],1
jne no_one__
mov edi,[PointerToCopyPicture]
no_one__:
no_one__:
cmp [number_undo],2
jne no_two__
mov edi,[PointerToCopyPicture2]
no_two__:
no_two__:
cmp [number_undo],3
jne no_three__
;copy bufer number two to bufer number one
;copy bufer number two to bufer number one
mov esi,[PointerToCopyPicture2]
mov edi,[PointerToCopyPicture]
mov ecx,[Picture_SizeX]
@ -265,12 +230,11 @@ mouse:
inc ecx
cld
rep movsd
;end copy
;end copy
dec [number_undo]
mov edi,[PointerToCopyPicture2]
no_three__:
no_three__:
mov esi,[PointerToPicture]
mov ecx,[Picture_SizeX]
imul ecx,[Picture_SizeY]
@ -280,39 +244,28 @@ mouse:
inc ecx
cld
rep movsd
;--------------end copy for undo-------------
no_undo___:
;--------------end copy for undo-------------
no_undo___:
call TakeButtonInstruments
no_use_instruments:
no_use_instruments:
mov eax,[Current_instrument]
and [Activate_instrument],0
jmp still
;-----------------------------------------------
;---------get mouse cordinats-------------------
;-----------------------------------------------
GetMouseCoordinats:
mov eax,37
mov ebx,1
mcall
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
mcall 37,2
ret

View File

@ -2,16 +2,14 @@
;-------------draw window of program-----------------------
;----------------------------------------------------------
drawwin:
mov eax,9
mov ebx,IPC_table
or ecx,-1
mcall
mcall 9,procinfo
mov esi,procinfo
mov eax,[IPC_table+34]
mov ebx,[IPC_table+38]
mov ecx,[IPC_table+42]
mov edx,[IPC_table+46]
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
@ -23,16 +21,14 @@ drawwin:
mov [Window_SizeX],585
mov ecx,[Window_SizeX]
no_minimum_size_x:
no_minimum_size_x:
cmp [Window_SizeY],400
jae no_minimum_size_y
mov [Window_SizeY],400
mov edx,[Window_SizeY]
no_minimum_size_y:
no_minimum_size_y:
mov [MaxWorkScreen_SizeX],ecx
mov [MaxWorkScreen_SizeY],edx
sub [MaxWorkScreen_SizeX],20+10+5+10
@ -43,62 +39,129 @@ drawwin:
mov [MaxWorkScreen_SizeX],ecx
no_znak1:
no_znak1:
cmp [MaxWorkScreen_SizeY],0
jns no_znak2
mov [MaxWorkScreen_SizeY],edx
no_znak2:
no_znak2:
mov eax,12
mov ebx,1
mcall
and eax,0
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]
mov edx,0x43aabbcc
xor esi,esi ;0x805080d0
xor edi,edi ;0x005080d0
mcall
call draw_panel
call PrintMousePos
; 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.
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 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
call draw_scrollers
call draw_icons
;------------------------------------------------
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
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
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
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
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
;-----------------------------------------------------------------------------

View File

@ -17,15 +17,6 @@
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 [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
; mov [PointerToCopyPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3) ; S = 4928000, L = 768000 = 750 Kb
@ -46,17 +37,4 @@
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
finit

View File

@ -1,33 +1,6 @@
;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
@ -36,7 +9,7 @@ load_picture:
mov esi,[ScreenPointer]
add esi,0x10000
;-------------is this BMP file ?----------------
;-------------is this BMP file ?----------------
xor eax,eax
mov ax,[esi]
mov [type],ax
@ -50,16 +23,13 @@ load_picture:
mov ebx,[esi+22]
mov [Picture_SizeX],eax
mov [Picture_SizeY],ebx
jmp exit_type_1
no_bmp_file_1:
;-------------is this GIF file ?----------------
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
@ -70,56 +40,49 @@ load_picture:
mov bx,word[esi+2]
mov [Picture_SizeX],eax
mov [Picture_SizeY],ebx
jmp exit_type_1
no_gif_file_1:
no_gif_file_1:
jmp no_unpakcing_file_1
exit_type_1:
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
exit_type_1:
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
call GetMemory
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
mov eax,file_path
mov ebx,[PointerToCopyPicture]
add ebx,1000
call load_file
;----------------------------------------------------------
;-------------------Unpacking picture----------------------
;----------------------------------------------------------
;----------------------------------------------------------
;-------------------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
;BMP DECODER
call bmptoimg
mov [save_flag],1
no_unpakcing_bmp_file_1:
jmp no_unpakcing_file_1
no_unpakcing_bmp_file_1:
cmp [type],'GI'
jne no_unpakcing_file_1
;GIF DECODER
;GIF DECODER
sub edi,8
call ReadGIF
mov [save_flag],1
no_unpakcing_file_1:
no_unpakcing_file_1:
call MovePictureToWorkScreen
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
ret

View File

@ -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
;---------------------------------------------------------

View File

@ -2,12 +2,11 @@
;-----------instruments of menu-----------------------------
;-----------------------------------------------------------
TakeInstruments:
;|||||||||||||||||||FILE||||||||||||||||||||||
;|||||||||||||||||||FILE||||||||||||||||||||||
cmp [number_panel],7
jne no_file
;<<<<<NEW>>>>>>>
;<<<<<NEW>>>>>>>
cmp [number_menu],1
jne no_new
@ -60,31 +59,17 @@ TakeInstruments:
mov esi,2
call print_text
mov eax,8
mov ebx,177*65536+40
mov ecx,115*65536+14
mov edx,1000000000000000000000000000000b
add edx,1000
mcall
mov edx,1000000000000000000000000000000b+1000
mcall 8,<177,40>,<115,14>,
mov eax,8
mov ebx,177*65536+40
mov ecx,139*65536+14
mov edx,1000000000000000000000000000000b
add edx,1001
mcall
mov edx,1000000000000000000000000000000b+1001
mcall ,,<139,14>,
mov eax,8
mov ebx,175*65536+40
mov ecx,170*65536+15
mov edx,1000000000000000000000000000000b
add edx,1002
mcall
mov edx,1000000000000000000000000000000b+1002
mcall ,<175,40>,<170,15>
no_activate_space:
mov eax,10
mcall
no_activate_space:
mcall 10
cmp eax,1
je exit_new
@ -92,8 +77,7 @@ TakeInstruments:
cmp eax,3
jne no_activate_space
mov eax,17
mcall
mcall 17
shr eax,8
cmp eax,1000
@ -117,11 +101,9 @@ TakeInstruments:
call value
mov [Picture_SizeX],eax
jmp no_activate_space
no_picture_size_x:
;---------------------------------------------------------------------
no_picture_size_x:
cmp eax,1001
jne no_picture_size_y
@ -140,39 +122,23 @@ TakeInstruments:
call value
mov [Picture_SizeY],eax
jmp no_activate_space
no_picture_size_y:
;---------------------------------------------------------------------
no_picture_size_y:
cmp eax,1002
jne no_activate_space
exit_new:
exit_new:
mov edx,11100000000000000000000000000000b+1002
mcall 8,<175,40>,<170,15>
mov eax,8
mov ebx,175*65536+40
mov ecx,170*65536+15
mov edx,11100000000000000000000000000000b
add edx,1002
mcall
mov edx,11100000000000000000000000000000b+1001
mcall ,<177,40>,<139,14>
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
mov edx,11100000000000000000000000000000b+1000
mcall ,,<115,14>
;get memory for new picture
call GetMemory
and [save_flag],0
@ -181,11 +147,10 @@ TakeInstruments:
call cleare_work_arrea
call drawwin
jmp still
no_new:
;<<<<<OPEN>>>>>>>
;---------------------------------------------------------------------
no_new:
;<<<<<OPEN>>>>>>>
cmp [number_menu],2
jne no_open
@ -199,12 +164,8 @@ TakeInstruments:
cmp [OpenDialog_data.status],1
jne still
;---------------------------------------------------------------------
open_1:
mov eax,40
mov ebx,100111b
mcall
open_1:
mcall 40,100111b
mov eax,file_path
mov ebx,[ScreenPointer]
@ -214,7 +175,7 @@ TakeInstruments:
mov esi,[ScreenPointer]
add esi,0x10000
;-------------is this BMP file ?----------------
;-------------is this BMP file ?----------------
xor eax,eax
mov ax,[esi]
mov [type],ax
@ -228,12 +189,10 @@ TakeInstruments:
mov ebx,[esi+22]
mov [Picture_SizeX],eax
mov [Picture_SizeY],ebx
jmp exit_type
no_bmp_file:
;-------------is this GIF file ?----------------
;---------------------------------------------------------------------
no_bmp_file:
;-------------is this GIF file ?----------------
xor eax,eax
mov ax,[esi]
mov [type],ax
@ -248,32 +207,26 @@ TakeInstruments:
mov bx,word[esi+2]
mov [Picture_SizeX],eax
mov [Picture_SizeY],ebx
jmp exit_type
no_gif_file:
;---------------------------------------------------------------------
no_gif_file:
jmp no_unpakcing_file
exit_type:
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
;---------------------------------------------------------------------
exit_type:
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
call GetMemory
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
mov eax,file_path
mov ebx,[PointerToCopyPicture]
add ebx,1000
call load_file
;----------------------------------------------------------
;-------------------Unpacking picture----------------------
;----------------------------------------------------------
;----------------------------------------------------------
;-------------------Unpacking picture----------------------
;----------------------------------------------------------
mov esi,[PointerToCopyPicture]
add esi,1000
mov edi,[PointerToPicture]
@ -282,56 +235,50 @@ TakeInstruments:
cmp [type],'BM'
jne no_unpakcing_bmp_file
;BMP DECODER
call bmptoimg
mov [save_flag],1
jmp draw_1
no_unpakcing_bmp_file:
;---------------------------------------------------------------------
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 ReadGIF
mov [save_flag],1
jmp draw_1
;---------------------------------------------------------------------
no_unpakcing_file:
call load_icons
draw_1:
call drawwin
open_2:
open_2:
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
and [number_panel],0
and [number_menu],0
jmp still
no_open:
;---------------------------------------------------------------------
no_open:
;<<<<<<<<<<<SAVE>>>>>>>>>>>>
cmp [number_menu],3
jne no_save_
mov al,[save_flag]
test al,al
jz no_save_file
jmp save_enter
no_save_file:
;---------------------------------------------------------------------
no_save_file:
and [number_panel],0
and [number_menu],0
jmp still
no_save_:
;---------------------------------------------------------------------
no_save_:
;<<<<<<<<<SAVE AS>>>>>>>>>>>
cmp [number_menu],4
jne no_save
@ -362,15 +309,12 @@ draw_1:
cmp [OpenDialog_data.status],1
jne still
;---------------------------------------------------------------------
save1:
save_enter:
mov eax,40
mov ebx,100111b
mcall
save1:
save_enter:
mcall 40,100111b
call analizing_picture_to_palette
;eax => number of colors in picture
mov ebx,[PointerToPicture]
mov ecx,[PointerToEditBufer]
@ -383,9 +327,6 @@ draw_1:
mov eax,file_path
mov ecx,ebx
mov ebx,[PointerToEditBufer]
push eax
push ebx
push ecx
call save_file
@ -393,33 +334,27 @@ draw_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:
;---------------------------------------------------------------------
;save2:
; and [number_panel],0
; and [number_menu],0
; jmp still
;---------------------------------------------------------------------
no_save:
;<<<<<<EXIT>>>>>>>
cmp [number_menu],5
jne no_exit_program
mov eax,-1
mcall
no_exit_program:
no_file:
;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
;<<<<<<<<<<UNDO>>>>>>>>>>
;---------------------------------------------------------------------
no_exit_program:
no_file:
;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
;<<<<<<<<<<UNDO>>>>>>>>>>
cmp [number_panel],6
jne no_edit
jne still ;no_edit
cmp [number_menu],1
jne no_undo
@ -429,15 +364,13 @@ draw_1:
mov esi,[PointerToCopyPicture]
no_one____:
no_one____:
cmp [number_undo],2
jne no_two____
mov esi,[PointerToCopyPicture2]
no_two____:
no_two____:
mov edi,[PointerToPicture]
mov ecx,[Picture_SizeX]
imul ecx,[Picture_SizeY]
@ -453,15 +386,13 @@ draw_1:
mov [number_undo],1
no_null_undo:
no_null_undo:
and [number_panel],0
and [number_menu],0
jmp still
no_undo:
;<<<<<<<<<<COPY>>>>>>>>>>
;---------------------------------------------------------------------
no_undo:
;<<<<<<<<<<COPY>>>>>>>>>>
cmp [number_menu],2
jne no_copy
@ -480,8 +411,7 @@ draw_1:
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
no_remove_x_copy:
no_remove_x_copy:
cmp ebx,[rectangular_shade_y]
jl no_remove_y_copy
@ -489,8 +419,7 @@ draw_1:
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
no_remove_y_copy:
no_remove_y_copy:
mov eax,[OldX]
mov ebx,[OldY]
mov ecx,[rectangular_shade_x]
@ -512,43 +441,35 @@ draw_1:
mov [Dx_],-1
no_signum_fill_r_x_copy:
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:
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:
loop_fill_rectangle_y_copy:
mov [x],esi
loop_fill_rectangle_x_copy:
push esi
push edi
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
pop esi
pop edi esi
add edx,3
mov eax,[x]
add eax,[Dx_]
mov [x],eax
@ -568,12 +489,10 @@ draw_1:
and [number_panel],0
and [number_menu],0
mov [DrawSprite_flag],1
jmp still
no_copy:
;<<<<<<<<<<PASTE>>>>>>>>
;---------------------------------------------------------------------
no_copy:
;<<<<<<<<<<PASTE>>>>>>>>
cmp [number_menu],3
jne no_paste
@ -593,8 +512,7 @@ draw_1:
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
no_remove_x_paste:
no_remove_x_paste:
cmp ebx,[rectangular_shade_y]
jl no_remove_y_paste
@ -602,8 +520,7 @@ draw_1:
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
no_remove_y_paste:
no_remove_y_paste:
mov eax,[OldX]
mov ebx,[OldY]
mov ecx,[rectangular_shade_x]
@ -625,37 +542,29 @@ draw_1:
mov [Dx_],-1
no_signum_fill_r_x_paste:
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:
no_signum_fill_r_y_paste:
mov edx,[PointerToEditBufer]
mov [y],edi
loop_fill_rectangle_y_paste:
loop_fill_rectangle_y_paste:
mov [x],esi
loop_fill_rectangle_x_paste:
push esi
push edi
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
pop esi
pop edi esi
add edx,3
@ -669,19 +578,16 @@ draw_1:
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:
;<<<<<<<<<<CUT>>>>>>>>>>
;---------------------------------------------------------------------
no_paste:
;<<<<<<<<<<CUT>>>>>>>>>>
cmp [number_menu],4
jne no_cut
@ -701,8 +607,7 @@ draw_1:
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
no_remove_x_cut:
no_remove_x_cut:
cmp ebx,[rectangular_shade_y]
jl no_remove_y_cut
@ -710,8 +615,7 @@ draw_1:
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
no_remove_y_cut:
no_remove_y_cut:
mov eax,[OldX]
mov ebx,[OldY]
mov ecx,[rectangular_shade_x]
@ -733,33 +637,27 @@ draw_1:
mov [Dx_],-1
no_signum_fill_r_x:
no_signum_fill_r_x:
sub edx,ebx
jnz no_signum_fill_r_y
mov [Dy_],-1
no_signum_fill_r_y:
no_signum_fill_r_y:
mov [y],edi
loop_fill_rectangle_y:
loop_fill_rectangle_y:
mov [x],esi
loop_fill_rectangle_x:
push esi
push edi
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
pop esi
pop edi esi
mov eax,[x]
add eax,[Dx_]
@ -779,27 +677,24 @@ draw_1:
and [number_panel],0
and [number_menu],0
jmp still
no_cut:
;<<<<<<CLEARE ALL>>>>>>
;---------------------------------------------------------------------
no_cut:
;<<<<<<CLEARE ALL>>>>>>
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:
;<<<<<<TO ALLOCATE ALL>>>>>>
;---------------------------------------------------------------------
no_cleare_all:
;<<<<<<TO ALLOCATE ALL>>>>>>
cmp [number_menu],6
jne no_to_allocate_all
jne still ;no_to_allocate_all
mov [OldX],1
mov [OldY],1
@ -815,15 +710,11 @@ draw_1:
mov [crossing],0
and [number_panel],0
and [number_menu],0
;call TakeButtonInstruments
;call MovePictureToWorkScreen
; call TakeButtonInstruments
; call MovePictureToWorkScreen
jmp still
no_to_allocate_all:
no_edit:
jmp still
ret
;---------------------------------------------------------------------
;no_to_allocate_all:
;no_edit:
; jmp still
;---------------------------------------------------------------------

View File

@ -2,7 +2,6 @@
;-------analizing picture to palette------------------------
;-----------------------------------------------------------
analizing_picture_to_palette:
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
imul eax,ebx
@ -10,23 +9,24 @@ analizing_picture_to_palette:
mov edx,[PointerToPicture]
mov esi,1 ;counter colors in palette
;put firs color of picture how one color in palette
;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:
analizing_to_palette:
mov eax,[edx]
and eax,0xffffff
mov edi,esi
mov ebp,[PointerToPalette]
next_color_in_palette:
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
@ -34,6 +34,7 @@ analizing_picture_to_palette:
inc esi
cmp esi,256 ;256 colors
ja more_than_256_colors
mov ebp,[PointerToPalette]
mov ebx,esi
dec ebx
@ -43,14 +44,11 @@ analizing_picture_to_palette:
shr eax,16
mov [ebp+2],al
exit_loop_palette:
exit_loop_palette:
add edx,3
dec ecx
jnz analizing_to_palette
more_than_256_colors:
more_than_256_colors:
mov eax,esi
ret

View File

@ -1,7 +1,7 @@
;**********************************************************
;------------------TEXT DATA-------------------------------
;**********************************************************
name_of_program db 'Graphics editor <<ANIMAGE>> V 1.2',0
name_of_program db 'Graphics editor <<ANIMAGE>> V 1.3',0
mouse_pos_x db 'X='
mouse_pos_y db 'Y='
new_text1 db 'PICTURE SIZE X'

View File

@ -2,15 +2,12 @@
;-----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:
;collision with text on panel
next_columnus_text:
mov eax,[edi]
mov ebx,[edi+4]
sub eax,10
@ -34,33 +31,27 @@ panel_interraction:
mov edi,[button_menu_size_y]
mov esi,[button_menu_size_x]
call columnus
pop edi
mov esi,7
mov esi,7
test eax,eax
jz no_columnus_text
mov esi,1
mov [Panel_flag],1
call GetMouseClick
test eax,eax
jz no_mouse_pressed
mov eax,18
mov ebx,14
;mcall
; mcall 18,14
call print_panel_menu
no_mouse_pressed:
no_columnus_text:
jmp print_panel_menu
no_mouse_pressed:
no_columnus_text:
mov eax,[Icon_text_x]
mov ebx,[Icon_text_y]
mov ecx,[button_menu_size_x] ;-------------------------
mov ecx,[button_menu_size_x]
mov edx,[button_menu_size_y]
call draw_volume_rectangle
@ -69,75 +60,60 @@ panel_interraction:
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)
;delit main buttons(some time)
mov [counter],10
next_icon_delit1:
mov eax,8
next_icon_delit1:
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
mcall 8
inc [counter]
cmp [counter],30
jl next_icon_delit1
;delit buttons of brushes
mov [counter],40
next_icon_delit2:
mov eax,8
next_icon_delit2:
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
mcall 8
inc [counter]
cmp [counter],45
jl next_icon_delit2
;delit buttons of zoom
mov [counter],45
next_icon_delit3:
mov eax,8
next_icon_delit3:
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
mcall 8
inc [counter]
cmp [counter],50
jl next_icon_delit3
;delit buttons of palette
mov eax,8
;delit buttons of palette
mov edx,51
add edx,11100000000000000000000000000000b
mcall
mcall 8
;delit buttons of color
mov eax,8
;delit buttons of color
mov edx,52
add edx,11100000000000000000000000000000b
mcall
mcall 8
pop [counter]
@ -156,10 +132,8 @@ print_panel_menu:
call draw_volume_rectangle
pop esi
calculate_counter_menu:
;calculate menu counter
calculate_counter_menu:
;calculate menu counter
mov eax,[counter]
dec eax
shl eax,2
@ -169,15 +143,12 @@ print_panel_menu:
call GetMouseCoordinats
and [menu_counter],0
push esi
push edi
;ᣫ ¦¨¢ ­¨¥  ­¨¬ æ¨¨ >>>>>>>>>>>>>>>>>>
mov eax,18
mov ebx,14
;mcall
menu_loop:
push esi edi
;ᣫ ¦¨¢ ­¨¥  ­¨¬ æ¨¨ >>>>>>>>>>>>>>>>>>
; mcall 18,4
menu_loop:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[MouseX]
@ -196,8 +167,7 @@ print_panel_menu:
mov esi,1
no_columnus_menu_text:
no_columnus_menu_text:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[menu_size_x]
@ -209,12 +179,10 @@ print_panel_menu:
call draw_volume_rectangle
add [menu_counter],20
dec [counter_menu]
jnz menu_loop
;print menu text
;print menu text
push [counter]
mov esi,[counter]
dec esi
@ -224,27 +192,19 @@ print_panel_menu:
mov [counter],eax
call print_panel_text
pop [counter]
pop edi
pop esi
pop edi esi
menu_still:
mov eax,10
mcall
mov eax,2
mcall
mov eax,17
mcall
menu_still:
mcall 10
mcall 2
mcall 17
call GetMouseClick
test eax,eax
jz calculate_counter_menu
call GetMouseCoordinats
;calculate menu counter
;calculate menu counter
mov eax,[counter]
dec eax
shl eax,2
@ -254,12 +214,9 @@ print_panel_menu:
and [menu_counter],0
and [counter_11],0
push esi
push edi
menu_loop2:
push esi edi
menu_loop2:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[MouseX]
@ -273,48 +230,37 @@ print_panel_menu:
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:
no_columnus_menu_text2:
add [menu_counter],20
dec [counter_menu]
jnz menu_loop2
pop edi
pop esi
pop edi esi
mov eax,5
mov ebx,15
mcall
mcall 5,15
push [counter]
pushad
pusha
call drawwin
popad
popa
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
@ -347,8 +293,6 @@ PrintMousePos:
mov esi,2
call print_text
mov eax,47
mov ebx,4*65536
mov ecx,[ScreenX]
add ecx,[PosX]
mov edx,[Window_SizeX]
@ -356,105 +300,27 @@ PrintMousePos:
shl edx,16
add edx,20+15+6+6
and esi,0
mcall
mcall 47,<4,0>
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
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
; xor ecx,ecx
mov ecx,0x10000000
mov edx,edi
add edx,12
@ -473,7 +339,6 @@ print_panel_text:
;------------draw lines of scoll---------------------------
;----------------------------------------------------------
draw_scrollers:
mov edi,[CounterX]
mov eax,[Scroll1CoordinatX]
mov ebx,[Window_SizeY]
@ -487,17 +352,13 @@ draw_scrollers:
mov [Scroll1MaxSizeY],edx
mov [Scroll1MaxSizeX],ecx
imul ecx,edi
push eax
push ebx
push edx
push eax ebx edx
mov eax,ecx
mov ebx,[Picture_SizeX]
cdq
idiv ebx
mov ecx,eax
pop edx
pop ebx
pop eax
pop edx ebx eax
mov [Scroll1SizeX],ecx
mov edi,[Scroll1MaxSizeX]
sub edi,ecx
@ -517,15 +378,13 @@ draw_scrollers:
mov [Scroll2MaxSizeY],edx
imul edx,[CounterY]
push eax
push ebx
push eax ebx
mov eax,edx
mov ebx,[Picture_SizeY]
cdq
idiv ebx
mov edx,eax
pop ebx
pop eax
pop ebx eax
mov [Scroll2SizeY],edx
mov edi,[Scroll2MaxSizeY]
sub edi,edx
@ -534,7 +393,6 @@ draw_scrollers:
call draw_volume_rectangle
ret
ret
button_menu_size_x dd 0
button_menu_size_y dd 0

View File

@ -2,9 +2,7 @@
;--------Move picture from array to work screeen-----------
;----------------------------------------------------------
MovePictureToWorkScreen:
call cleare_screen
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
mov ecx,[MaxWorkScreen_SizeX]
@ -12,25 +10,27 @@ MovePictureToWorkScreen:
mov esi,[k]
imul eax,esi
imul ebx,esi
cmp eax,ecx
jle lab1
mov eax,[MaxWorkScreen_SizeX]
mov [WorkScreen_SizeX],eax
jmp lab2
lab1:
mov [WorkScreen_SizeX],eax
lab2:
lab1:
mov [WorkScreen_SizeX],eax
lab2:
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
lab4:
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
cdq
@ -49,7 +49,7 @@ MovePictureToWorkScreen:
imul eax,ebx
sub ecx,eax
lea ecx,[ecx+ecx*2]
;
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
dec ebx
@ -58,7 +58,6 @@ MovePictureToWorkScreen:
add eax,ecx
mov [OffsetYWorkScreen],eax
mov ebx,[Picture_SizeX]
mov eax,[CounterX]
sub ebx,eax
@ -79,17 +78,17 @@ MovePictureToWorkScreen:
lea eax,[eax+eax*2]
add eax,[PointerToPicture]
mov ebx,[ScreenPointer]
mov edi,[CounterY]
;if size of picture natural(mastab is 1) than move picture to work screen
;if size of picture natural(mastab is 1) than move picture to work screen
cmp [k],1
jne no_zoom_1_
screen_y_1:
screen_y_1:
mov esi,[CounterX]
screen_x_1:
screen_x_1:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
@ -105,14 +104,15 @@ MovePictureToWorkScreen:
dec edi
jnz screen_y_1
jmp fps
no_zoom_1_:
no_zoom_1_:
cmp [k],2
jne no_zoom_2
screen_y_2:
screen_y_2:
mov esi,[CounterX]
screen_x_2:
screen_x_2:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
@ -139,13 +139,15 @@ MovePictureToWorkScreen:
dec edi
jnz screen_y_2
jmp fps
no_zoom_2:
no_zoom_2:
cmp [k],4
jne no_zoom_4
screen_y_4:
screen_y_4:
mov esi,[CounterX]
screen_x_4:
screen_x_4:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
@ -200,21 +202,25 @@ MovePictureToWorkScreen:
dec edi
jnz screen_y_4
jmp fps
no_zoom_4:
;if zoom more than 4
screen_y:
no_zoom_4:
;if zoom more than 4
screen_y:
mov esi,[CounterX]
screen_x:
screen_x:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
push ebx
push eax
;---------------------------------------------------------
push ebx eax
mov edx,[k]
big_pixel_y:
big_pixel_y:
mov eax,[k]
big_pixel_x:
big_pixel_x:
mov [ebx],bp
mov [ebx+2],cl
add ebx,3
@ -223,8 +229,8 @@ MovePictureToWorkScreen:
add ebx,[OffsetYBigPixel]
dec edx
jnz big_pixel_y
pop eax
pop ebx
pop eax ebx
;---------------------------------------------------------
mov edx,[k]
lea edx,[edx+edx*2]
add ebx,edx
@ -236,26 +242,21 @@ MovePictureToWorkScreen:
dec edi
jnz screen_y
fps:
;mov eax,18
;mov ebx,14
;mcall
mov eax,7
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
mcall 7
ret
;----------------------------------------------------------
;--------------------clear screen--------------------------
;----------------------------------------------------------
cleare_screen:
mov eax,[ScreenPointer]
mov ebx,[WorkScreen_SizeX]
imul ebx,[WorkScreen_SizeY]
@ -264,13 +265,11 @@ cleare_screen:
inc ebx
mov esi,0xffffff
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
@ -278,7 +277,6 @@ cleare_screen:
;-------------cleare work arrea(work screen)---------------
;----------------------------------------------------------
cleare_work_arrea:
mov eax,[PointerToPicture]
mov ebx,[Picture_SizeX]
imul ebx,[Picture_SizeY]
@ -287,13 +285,11 @@ cleare_work_arrea:
inc ebx
mov esi,0xffffff
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
@ -301,45 +297,41 @@ cleare_work_arrea:
;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
no_limit_screen_x:
no_limit_screen_x:
cmp [PosY],ebx
jle no_limit_screen_y
mov [PosY],ebx
no_limit_screen_y:
no_limit_screen_y:
cmp [PosX],0
jns no_minimum_screen_x
mov [PosX],0
no_minimum_screen_x:
no_minimum_screen_x:
cmp [PosY],0
jns no_minimum_screen_y
mov [PosY],0
no_minimum_screen_y:
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]
cdq
idiv ecx
@ -348,5 +340,4 @@ GetScreenCordinats:
cdq
idiv ecx
mov [ScreenY],eax
ret