add menu 'Filters',

add icons for select zoom

git-svn-id: svn://kolibrios.org@6371 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-03-24 15:54:52 +00:00
parent e64a07b8b6
commit 7c423903ff
10 changed files with 218 additions and 125 deletions

View File

@ -59,15 +59,16 @@ ci_wnd_min_siz_x equ 585 ;minimum size x
ci_wnd_min_siz_y equ 400 ;minimum size y
; ¯ ­¥«ì ¨­áâà㬥­â®¢
ci_panel_x_pos equ 0 ;ª®®à¤¨­ â  x ¤«ï ¯ ­¥«¨
ci_panel_y_pos equ 20 ;ª®®à¤¨­ â  y ¤«ï ¯ ­¥«¨
ci_panel_but_y1 equ ci_panel_y_pos +5 ;ª®®à¤¨­ â  y ¤«ï 1-£® à鸞 ª­®¯®ª
ci_panel_but_y2 equ ci_panel_y_pos+30 ;ª®®à¤¨­ â  y ¤«ï 2-£® à鸞 ª­®¯®ª
ci_palete_y_pos equ ci_panel_y_pos+51 ;ª®®à¤¨­ â  y ¤«ï ¯ «¨âàë 梥⮢
ci_panel_x_pos equ 0 ;ª®®à¤. x ¤«ï ¯ ­¥«¨
ci_panel_y_pos equ 20 ;ª®®à¤. y ¤«ï ¯ ­¥«¨
ci_panel_but_y1 equ ci_panel_y_pos +5 ;ª®®à¤. y ¤«ï 1-£® à鸞 ª­®¯®ª
ci_panel_but_y2 equ ci_panel_y_pos+30 ;ª®®à¤. y ¤«ï 2-£® à鸞 ª­®¯®ª
ci_palete_y_pos equ ci_panel_y_pos+51 ;ª®®à¤. y ¤«ï ¯ «¨âàë 梥⮢
ci_panel_zoom_x equ 178 ;ª®®à¤. x ¤«ï ª­®¯®ª ¯ ­¥«¨ ¬ áèâ ¡ 
; ®ª­® । ªâ®à 
ci_edit_wnd_x_pos equ 0 ;ª®®à¤¨­ â  x ¤«ï ®ª­  । ªâ®à 
ci_edit_wnd_y_pos equ 71 ;ª®®à¤¨­ â  y ¤«ï ®ª­  । ªâ®à 
ci_edit_wnd_x_pos equ 0 ;ª®®à¤. x ¤«ï ®ª­  । ªâ®à 
ci_edit_wnd_y_pos equ 71 ;ª®®à¤. y ¤«ï ®ª­  । ªâ®à 
ci_edit_wnd_border equ 3 ;à ¬ª  ¢®ªà㣠®ª­  । ªâ®à 
; áªà®««¨­£¨
@ -195,7 +196,7 @@ include 'menu.inc'
;-----------------------------------------------------------
;------------variables and data of program------------------
;-----------------------------------------------------------
sound_havent_memory db 150,64,0
;sound_havent_memory db 150,64,0
include 'lib_data.inc'
include 'panel_data.inc'
@ -210,6 +211,10 @@ align 4
panel_picture:
file 'panel_buttons.png'
.end:
align 4
panel_zoom:
file 'panel_zoom.png'
.end:
;****************cursors******************
brush_cursor:
file 'brush.cur'

View File

@ -3,87 +3,80 @@
;------------------------------------------
align 4
keys:
mcall SF_GET_KEY
shr eax,8
mcall SF_GET_KEY
shr eax,8
cmp al,176
jne @f
sub [PosX],20
jmp change_screen
@@:
cmp al,179
jne @f
add [PosX],20
jmp change_screen
@@:
cmp al,177
jne @f
add [PosY],20
jmp change_screen
@@:
cmp al,178
jne @f
sub [PosY],20
jmp change_screen
@@:
cmp al,49 ;1
jne @f
mov [k],1
jmp zoom_ch
@@:
cmp al,50 ;2
jne @f
mov [k],2
jmp zoom_ch
@@:
cmp al,51 ;3
jne @f
mov [k],3
jmp zoom_ch
@@:
cmp al,52 ;4
jne @f
mov [k],4
jmp zoom_ch
@@:
cmp al,56 ;8
jne @f
mov [k],8
jmp zoom_ch
@@:
cmp al,48 ;0
jne @f
mov [k],16
zoom_ch:
call scrollbar_move_00
call drawwin
jmp change_screen
@@:
cmp al,255
jne @f
call analizing_picture_to_palette
call drawwin
jmp change_screen
@@:
jmp still
cmp al,176
jne key2
sub [PosX],20
jmp change_screen
key2:
cmp al,179
jne key3
add [PosX],20
jmp change_screen
key3:
cmp al,177
jne key4
add [PosY],20
jmp change_screen
key4:
cmp al,178
jne key5
sub [PosY],20
jmp change_screen
key5:
cmp al,49 ;1
jne key6
mov [k],1
call scrollbar_move_00
call drawwin
jmp change_screen
key6:
cmp al,50 ;2
jne key7
mov [k],2
call scrollbar_move_00
call drawwin
jmp change_screen
key7:
cmp al,52 ;4
jne key8
mov [k],4
call scrollbar_move_00
call drawwin
jmp change_screen
key8:
cmp al,56 ;8
jne key9
mov [k],8
call scrollbar_move_00
call drawwin
jmp change_screen
key9:
cmp al,48 ;0
jne key10
mov [k],16
call scrollbar_move_00
call drawwin
jmp change_screen
key10:
cmp al,255
jne key11
call analizing_picture_to_palette
call drawwin
jmp change_screen
key11:
;cmp al,27 ;Esc
;jne still
jmp still
mov eax,CursorsID
call delete_cursors
;cmp al,27 ;Esc
;jne still
;mov eax,CursorsID
;call delete_cursors
close:
mcall SF_TERMINATE_PROCESS
mcall SF_TERMINATE_PROCESS
jmp still
change_screen:
call CalculatePositionScreen
call MovePictureToWorkScreen
call draw_scrollers
call PrintMousePos
jmp still
change_screen:
call CalculatePositionScreen
call MovePictureToWorkScreen
call draw_scrollers
call PrintMousePos
jmp still

View File

@ -210,6 +210,7 @@ mouse_in_work_arrea:
;--------------end copy for undo-------------
no_undo___:
call TakeButtonInstruments
jmp still
no_use_instruments:

View File

@ -8,26 +8,65 @@ load_icons:
add edi,mem_screen
stdcall [img_to_rgb2], ebx,edi ;преобразуем изображение к формату rgb
stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения
stdcall [img_decode], panel_zoom, panel_zoom.end-panel_zoom, 0
mov ebx,eax
add edi,mem_panel_but
stdcall [img_to_rgb2], ebx,edi
stdcall [img_destroy], ebx
ret
draw_icons:
mov [Icon_X],ci_panel_x_pos+2
mov [Icon_Y],ci_panel_y_pos+3
;draw panel picture
mov edx,[Icon_X]
shl edx,16
add edx,[Icon_Y]
mov ebx,[ScreenPointer]
add ebx,mem_screen
mov ecx,417*65536+46
mcall SF_PUT_IMAGE
;draw panel picture
mov edx,[Icon_X]
shl edx,16
add edx,[Icon_Y]
mov ebx,[ScreenPointer]
add ebx,mem_screen
mov ecx,417*65536+46
mcall SF_PUT_IMAGE
;draw active zoom button
add ebx,mem_panel_but
xor eax,eax
cmp [k],1
je .end_calc
inc eax
cmp [k],2
je @f
inc eax
cmp [k],3
je @f
inc eax
cmp [k],4
je @f
inc eax
cmp [k],8
je @f
inc eax
cmp [k],16
je @f
inc eax
@@:
mov edx,eax
imul edx,18*21*3
add ebx,edx
.end_calc:
mov edx,eax
imul edx,18+1
add edx,ci_panel_zoom_x-1
shl edx,16
add edx,ci_panel_but_y2-2
mov ecx,18*65536+21
mcall SF_PUT_IMAGE
;main buttons of instrumnts
;main buttons of instrumnts
and [counter],0
mov [Icon_X],ci_panel_x_pos+4
and [counter],0
mov [Icon_X],ci_panel_x_pos+4
main_buttons:
@ -82,7 +121,7 @@ draw_icons:
;buttons of zoom
and [counter],0
mov [Icon_X],ci_panel_x_pos+178
mov [Icon_X],ci_panel_x_pos+ci_panel_zoom_x
next_button_zoom:

View File

@ -23,7 +23,7 @@ local .horizontal_width_put
mov [counter],5
.horizontal_width_put:
mov edx,[ebx+4807*4+ebp]
mov edx,[ebx+mem_offs_shape+ebp]
;and edx,0xffffff
mov [edi],dx
shr edx,16
@ -73,9 +73,9 @@ local .horizontal_width_save
mov eax,edi
mov edx,[eax]
;and edx,0xffffff
mov [ebx+4807*4+ebp],dx
mov [ebx+mem_offs_shape+ebp],dx
shr edx,16
mov [ebx+4807*4+2+ebp],dl
mov [ebx+mem_offs_shape+2+ebp],dl
add edi,3
add ebp,4

View File

@ -1,7 +1,9 @@
; load picture from file to memory
align 4
open_b rb 560
txt_not_memory db 'Cannot open image. Because there is not enough available memory.',0
align 4
load_picture:
mov [file_information.Function], SSF_GET_INFO
mov [file_information.Position], 0
@ -15,11 +17,11 @@ load_picture:
jnz .end_open
mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах
add ecx,mem_screen+mem_panel_b+mem_flood_f
add ecx,mem_screen+mem_panel_all+mem_flood_f
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
mov [ScreenPointer],eax
add eax,mem_screen+mem_panel_b
sub ecx,mem_screen+mem_panel_b+mem_flood_f
add eax,mem_screen+mem_panel_all
sub ecx,mem_screen+mem_panel_all+mem_flood_f
mov [file_information.Function], SSF_READ_FILE
mov [file_information.Position], 0
mov [file_information.Flags], 0
@ -32,7 +34,7 @@ load_picture:
je .end_open
;определяем вид изображения и пишем его параметры
mov eax,[ScreenPointer]
add eax,mem_screen+mem_panel_b
add eax,mem_screen+mem_panel_all
stdcall [img_decode], eax,ebx,0
push eax
;определяем размер декодированного изображения
@ -42,13 +44,21 @@ load_picture:
mov dword[Picture_SizeY],eax
imul ecx,eax
imul ecx,15
add ecx,mem_screen+mem_panel_b+mem_flood_f
add ecx,mem_screen+mem_panel_all+mem_flood_f
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
mov [ScreenPointer],eax
call prepare_data_pointers
pop ebx
stdcall [img_to_rgb2], ebx,[PointerToPicture] ;преобразуем изображение к формату rgb
or eax,eax
jnz .have_new_memory
notify_window_run txt_not_memory
pop ebx
jmp @f
.have_new_memory:
;notify_window_run sz_main_menu_File_Open
mov [ScreenPointer],eax
call prepare_data_pointers
pop ebx
stdcall [img_to_rgb2], ebx,[PointerToPicture] ;преобразуем изображение к формату rgb
mov [save_flag],1
@@:
stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения
mov [save_flag],1
.end_open:
ret

View File

@ -1,7 +1,25 @@
mem_screen equ 1200*1000*3 ;à §¬¥à ¯ ¬ï⨠¤«ï ®¡« á⨠íªà ­ 
mem_panel_b equ 50*(20*20*3) ;ŕ §ŹĽŕ Ż Źď⨠¤Ťď Ż ­ĽŤ¨ ¨­áâŕ㏼­âŽ˘
mem_panel_but equ 50*(20*20*3) ;¯ ¬ïâì ¤«ï ¯ ­¥«¨ ¨­áâà㬥­â®¢
mem_panel_zoom equ 6*(18*21*3) ;¯ ¬ïâì ¤«ï ¯ ­¥«¨ á ª­®¯ª ¬¨ ¬ áèâ ¡®¢
mem_panel_all equ mem_panel_but+mem_panel_zoom ;à §¬¥à ¯ ¬ï⨠¤«ï
;¢á¥å ¯ ­¥«¥© ¨­áâà㬥­â®¢
mem_flood_f equ 500000 ;à §¬¥à ¡ãä¥à  ¤«ï § «¨¢ª¨,   â ª¦¥ ¤«ï ¯ «¨âàë
mem_offs_shape equ 4807*4 ;ᬥ饭¨¥ ¤«ï à §¤¥«¥­¨ï ¬ áᨢ  ReserveArray
; ”®à¬ã«ë ¯à¨¬¥à­®£® ¢ëç¨á«¥­¨ï ¯ ¬ï⨠¤«ï । ªâ¨à®¢ ­¨ï:
;
; mem_flood_f ¯à¨¬¥à­® à ¢­® 4*((1200^2+1000^2)^0.5)*3*(1+5*5)
; .¥. 4 ¤¨ £®­ «¨ íªà ­  1200 ­  1000 㬭®¦¥­­ëå ­  26.
; <EFBFBD>  ª ¦¤ë© ¯¨ªá¥«ì à¨á㥬®© 䨣ãàë ¯à¨å®¤¨âáï â ª¦¥ ®¡« áâì
; ¯ ¬ï⨠¤«ï § ¯®¬¨­ ­¨ï ä®­®¢®£® ¨§®¡à ¦¥­¨ï, á ãç¥â®¬ ⮣®
; çâ® ¬ ªá¨¬ «ì­ë© à §¬¥à ª¨á⨠5*5 ¯®«ãç ¥¬ 26 = 1 + 5*5.
;
; <EFBFBD> ¬ïâì ReserveArray ¤¥«¨âáï ­  2 ®¡« áâ¨: 1-ï ¤«ï â®ç¥ª
; à¨á㥬®© 䨣ãàë, 2-ï ¤«ï § ¯®¬¨­ ­¨ï ãç á⪮¢ ä®­  5*5
; ¯à¨ªà¥¯«¥­­ëå ª ª ¦¤®© â®çª¥ à¨á㥬®© 䨣ãàë.
; <EFBFBD> §¤¥«¥­¨¥ í⮩ ¯ ¬ï⨠¯à®¨á室¨â ¢ ¯à®¯®à樨 1 ª 26,
; çâ® ¯à¨¬¥à­® à ¢­®: mem_flood_f / (1+5*5) ¨«¨ 4807*4.
;----------------------------------------------------------
;--------change size of memory which use program-----------
@ -10,22 +28,23 @@ GetMemory:
pusha
mov ecx,[Picture_SizeX]
mov edx,[Picture_SizeY]
imul ecx,edx
imul ecx,edx
lea ecx,[ecx+ecx*2]
lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5
add ecx,mem_screen+mem_panel_b+mem_flood_f
add ecx,mem_screen+mem_panel_all+mem_flood_f
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
test eax,eax
jnz have_new_memory
mov esi,sound_havent_memory
call sound
jnz .have_new_memory
;mov esi,sound_havent_memory
;call sound
notify_window_run txt_not_memory
popa
add esp,4
jmp still
have_new_memory:
.have_new_memory:
mov [ScreenPointer],eax
call prepare_data_pointers
call prepare_data_pointers
popa
ret
;---------------------------------------------------------
@ -35,7 +54,7 @@ prepare_data_pointers:
imul eax,ebx
lea eax,[eax+eax*2]
mov ebx,[ScreenPointer]
add ebx,mem_screen+mem_panel_b+mem_flood_f
add ebx,mem_screen+mem_panel_all+mem_flood_f
mov [PointerToPicture],ebx
mov [PointerToCopyPicture],ebx
@ -56,7 +75,7 @@ prepare_data_pointers:
add [PointerToSpriteBufer],eax
mov eax,[ScreenPointer]
add eax,mem_screen+mem_panel_b
add eax,mem_screen+mem_panel_all
mov [PointerToPalette],eax
mov [ReserveArray],eax

View File

@ -26,6 +26,8 @@ init_main_menu:
mov [main_menu_edit], eax
stdcall [ksubmenu_new]
mov [main_menu_instr], eax
stdcall [ksubmenu_new]
mov [main_menu_filters], eax
; init 'File' menu
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_New, 0x71
@ -67,7 +69,7 @@ init_main_menu:
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Edit, [main_menu_edit]
stdcall [ksubmenu_add], [main_menu], eax
; init 'Edit' menu
; init 'Instruments' menu
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Pencil, 0x51
stdcall [ksubmenu_add], [main_menu_instr], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Brush, 0x52
@ -97,6 +99,15 @@ init_main_menu:
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Instr, [main_menu_instr]
stdcall [ksubmenu_add], [main_menu], eax
; init 'Reflection' menu
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Filters_ReflectionLR, 0x41
stdcall [ksubmenu_add], [main_menu_filters], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Filters_ReflectionTB, 0x42
stdcall [ksubmenu_add], [main_menu_filters], eax
; add 'Reflection' menu to main
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Filters, [main_menu_filters]
stdcall [ksubmenu_add], [main_menu], eax
ret
put_main_menu:
@ -126,6 +137,8 @@ button_handler_main_menu:
menu_set 0x59, 5,9
menu_set 0x5a, 5,10
menu_set 0x5b, 5,11
menu_set 0x41, 4,1
menu_set 0x42, 4,2
.end_handler:
ret
@ -133,6 +146,7 @@ main_menu dd 0
main_menu_file dd 0
main_menu_edit dd 0
main_menu_instr dd 0
main_menu_filters dd 0
sz_main_menu_File db 'File', 0
sz_main_menu_File_New db 'New', 0
@ -161,3 +175,7 @@ sz_main_menu_Instr_Rectangle db 'Rectangle', 0
sz_main_menu_Instr_Circle db 'Circle', 0
sz_main_menu_Instr_Ellips db 'Ellips', 0
sz_main_menu_Instr_Hard_contour db 'Hard contour', 0
sz_main_menu_Filters db 'Filters', 0
sz_main_menu_Filters_ReflectionLR db 'Reflection |', 0
sz_main_menu_Filters_ReflectionTB db 'Reflection -', 0

View File

@ -607,6 +607,14 @@ no_edit:
instrument_set 11,20 ; draw hard contour
no_instruments:
;|||||||||||||||||||||||||FILTERS||||||||||||||||||||||||||
cmp [number_panel],4
jne no_filters
instrument_set 1,23 ; reflection from left to right
instrument_set 2,24 ; reflection from up to down
no_filters:
end_menu:
and [number_panel],0

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B