Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1632 → Rev 1631

/programs/media/animage/trunk/lib_data.inc
File deleted
\ No newline at end of file
/programs/media/animage/trunk/build.sh
File deleted
/programs/media/animage/trunk/animage.asm
1,13 → 1,10
;*******************************************************
;**************GRAPHICS EDITOR ANIMAGE *****************
;*******************************************************
; version: 1.2
; last update: 30/09/2010
; written by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Program used function 68 instead 64 is now,
; select path with OpenDialog
;--------------------------------------------------------
 
 
; version 1.1 year 9.12.2006
 
; AUTORS:
; programming by andrew_programmer
; design by golus
18,20 → 15,17
db 'MENUET01'
dd 0x1
dd START
dd IM_END
dd I_END ;0x19000;100 kb
dd stacktop ;0x19000;
dd file_path ;parameters
dd cur_dir_path
dd I_END
dd 0x19000;100 kb
dd 0x19000;
dd parameters,0x0
 
 
include '..\..\..\macros.inc'
include '../../../develop/libraries/box_lib/load_lib.mac'
@use_library
COLOR_ORDER equ MENUETOS
include 'gif_lite.inc'
include 'bmplib.inc'
;include 'dialog.inc'
include 'dialog.inc'
include 'dialog2.inc'
include 'design.inc'
include 'graphlib.inc'
41,21 → 35,17
include 'load_from_parameters.inc'
 
START:
mcall 68,11
load_libraries l_libs_start,end_l_libs
 
cmp eax,-1
jz close
;--------------------------------------------------------
;---------------set events mask--------------------------
;--------------------------------------------------------
mcall 40,1100111b
mov eax,40
mov ebx,1100111b
mcall
;---------------------------------------------------------
;-----------------------init data-------------------------
;---------------------------------------------------------
include 'init_data.inc'
 
;----------------------------------------------------------
;--------get memory and draw window of program-------------
;----------------------------------------------------------
71,35 → 61,19
;---------------------------------------------------------
;---------Check loading of file from psrsmeters-----------
;---------------------------------------------------------
; mov eax,parameters
; mov ebx,file_path
; call check_loading_from_parameters
mov eax,file_path
cmp [eax],byte 0
jz @f
call load_picture
@@:
 
;---------------------------------------------------------------------
mov edi,filename_area
mov esi,path4+5
call copy_str_1
mov eax,parameters
mov ebx,file_path
call check_loading_from_parameters
 
mov edi,file_path
cmp [edi],byte 0
jne @f
mov esi,path4
call copy_str_1
@@:
;OpenDialog initialisation
push dword OpenDialog_data
call [OpenDialog_Init]
;---------------------------------------------------------------------
;----------------------------------------------------------
;---------------------MAIN LOOP----------------------------
;----------------------------------------------------------
 
still:
 
call event
 
cmp eax,1
jne no_redraw_window
 
107,6 → 81,7
jmp still
 
no_redraw_window:
 
cmp eax,2
je keys
 
117,21 → 92,10
je mouse
 
jmp still
;---------------------------------------------------------------------
copy_str_1:
xor eax,eax
cld
@@:
lodsb
stosb
test eax,eax
jnz @b
ret
;---------------------------------------------------------------------
;---------------------------------------------------------
;---------------------------------------------------------
;---------------------------------------------------------
 
include 'events.inc'
include 'events_of_window.inc'
include 'events_of_keys.inc'
148,11 → 112,127
include 'files.inc'
include 'time.inc'
include 'memory.inc'
 
;-----------------------------------------------------------
;------------variables and data of program------------------
;-----------------------------------------------------------
 
CursorsID rd 10
 
parameters rb 257
 
file_path:
times 1024+16 db 0
 
time dd 0
sound_havent_memory db 150,64,0
include 'lib_data.inc'
PosX dd 0
PosY dd 0
PointerToIcons dd 0
ScreenPointer dd 0
PointerToPicture dd 0
PointerToCopyPicture dd 0
PointerToCopyPicture2 dd 0
PointerToEditBufer dd 0
PointerToSpriteBufer dd 0
PointerToPalette dd 0
Color dd 0
Number_Brush dd 0
Brush_SizeX dd 0
Brush_SizeY dd 0
Current_instrument dd 0
Last_instrument dd 0
Activate_instrument db 0
SColor dd 0
OldX dd 0
OldY dd 0
 
MouseX dd 0
MouseY dd 0
Window_SizeX dd 0
Window_SizeY dd 0
Window_CordinatX dd 0
Window_CordinatY dd 0
Picture_SizeX dd 0
Picture_SizeY dd 0
ScreenX dd 0
ScreenY dd 0
WorkScreen_SizeX dd 0
WorkScreen_SizeY dd 0
MaxWorkScreen_SizeX dd 0
MaxWorkScreen_SizeY dd 0
k dd 0
IPC_table rd 256
ReserveArray dd 0
register dd 0
CounterX dd 0
CounterY dd 0
OffsetYPicture dd 0
OffsetYWorkScreen dd 0
OffsetYBigPixel dd 0
 
Icon_X dd 0
Icon_Y dd 0
counter dd 0
counter2 dd 0
Icon_text_x dd 0
Icon_text_y dd 0
Panel_flag db 0
counter_menu dd 0
menu_coordinat_x dd 0
menu_size_x dd 0
menu_counter dd 0
counter_11 dd 0
number_panel dd 0
number_menu dd 0
 
Scroll1CoordinatX dd 0
Scroll1CoordinatY dd 0
Scroll1MaxSizeX dd 0
Scroll1MaxSizeY dd 0
Scroll1SizeX dd 0
Scroll1FreeX dd 0
 
Scroll2CoordinatX dd 0
Scroll2CoordinatY dd 0
Scroll2MaxSizeX dd 0
Scroll2MaxSizeY dd 0
Scroll2SizeY dd 0
Scroll2FreeY dd 0
 
extended_memory dd 0
type dw 0
x dd 0
y dd 0
save_flag db 0
exit_from_work_arrea db 0
 
Radius dd 0
Dx_ dd 0
Dy_ dd 0
line_width dd 0
lastik_is_active db 0
a_ellips dd 0
b_ellips dd 0
instrument_used db 0
used_OldX dd 0
used_OldY dd 0
rectangular_shade_x dd 0
rectangular_shade_y dd 0
crossing_old_x dd 0
crossing_old_y dd 0
crossing dd 0
finishing_crossing dd 0
number_undo dd 0
DrawSprite_flag db 0
Paste_flag db 0
SpriteSizeX dd 0
SpriteSizeY dd 0
SpriteCoordinatX dd 0
SpriteCoordinatY dd 0
SpriteOldCoordinatX dd 0
SpriteOldCoordinatY dd 0
 
include 'panel_data.inc'
include 'palitra256.inc'
include 'brushes.inc'
162,183 → 242,37
;-------------------ICON"S picture-------------------------
;----------------------------------------------------------
dd 0
 
panel_picture:
file 'panel_buttons.gif'
 
;****************cursors******************
brush_cursor:
file 'brush.cur'
;----------------------------------------------------------
 
flood_fill_cursor:
file 'flood_fill.cur'
;----------------------------------------------------------
 
lastik_cursor:
file 'lastik.cur'
;----------------------------------------------------------
 
other_cursor:
file 'other.cur'
;----------------------------------------------------------
 
pencil_cursor:
file 'pencil.cur'
;----------------------------------------------------------
 
pipette_cursor:
file 'pipette.cur'
;----------------------------------------------------------
 
spray_cursor:
file 'spray.cur'
;----------------------------------------------------------
 
zoom_cursor:
file 'zoom.cur'
 
;----------------------------------------------------------
IM_END:
;-----------------------------------------------------------
;------------variables and data of program------------------
;-----------------------------------------------------------
time rd 1
PosX rd 1
PosY rd 1
PointerToIcons rd 1
ScreenPointer rd 1
PointerToPicture rd 1
PointerToCopyPicture rd 1
PointerToCopyPicture2 rd 1
PointerToEditBufer rd 1
PointerToSpriteBufer rd 1
PointerToPalette rd 1
Color rd 1
Number_Brush rd 1
Brush_SizeX rd 1
Brush_SizeY rd 1
Current_instrument rd 1
Last_instrument rd 1
Activate_instrument rb 1
SColor rd 1
OldX rd 1
OldY rd 1
 
MouseX rd 1
MouseY rd 1
Window_SizeX rd 1
Window_SizeY rd 1
Window_CordinatX rd 1
Window_CordinatY rd 1
Picture_SizeX rd 1
Picture_SizeY rd 1
ScreenX rd 1
ScreenY rd 1
WorkScreen_SizeX rd 1
WorkScreen_SizeY rd 1
MaxWorkScreen_SizeX rd 1
MaxWorkScreen_SizeY rd 1
k rd 1
I_END:
 
ReserveArray rd 1
register rd 1
CounterX rd 1
CounterY rd 1
OffsetYPicture rd 1
OffsetYWorkScreen rd 1
OffsetYBigPixel rd 1
 
Icon_X rd 1
Icon_Y rd 1
counter rd 1
counter2 rd 1
Icon_text_x rd 1
Icon_text_y rd 1
Panel_flag rb 1
counter_menu rd 1
menu_coordinat_x rd 1
menu_size_x rd 1
menu_counter rd 1
counter_11 rd 1
number_panel rd 1
number_menu rd 1
 
Scroll1CoordinatX rd 1
Scroll1CoordinatY rd 1
Scroll1MaxSizeX rd 1
Scroll1MaxSizeY rd 1
Scroll1SizeX rd 1
Scroll1FreeX rd 1
 
Scroll2CoordinatX rd 1
Scroll2CoordinatY rd 1
Scroll2MaxSizeX rd 1
Scroll2MaxSizeY rd 1
Scroll2SizeY rd 1
Scroll2FreeY rd 1
 
;extended_memory rd 1
type rw 1
x rd 1
y rd 1
save_flag rb 1
exit_from_work_arrea rb 1
 
Radius rd 1
Dx_ rd 1
Dy_ rd 1
line_width rd 1
lastik_is_active rb 1
a_ellips rd 1
b_ellips rd 1
instrument_used rb 1
used_OldX rd 1
used_OldY rd 1
rectangular_shade_x rd 1
rectangular_shade_y rd 1
crossing_old_x rd 1
crossing_old_y rd 1
crossing rd 1
finishing_crossing rd 1
number_undo rd 1
DrawSprite_flag rb 1
Paste_flag rb 1
SpriteSizeX rd 1
SpriteSizeY rd 1
SpriteCoordinatX rd 1
SpriteCoordinatY rd 1
SpriteOldCoordinatX rd 1
SpriteOldCoordinatY rd 1
;---------------------------------------------------------------------
IncludeUGlobals
;---------------------------------------------------------------------
align 4
CursorsID rd 10
;---------------------------------------------------------------------
;align 4
;parameters
; rb 257
;---------------------------------------------------------------------
align 4
file_path:
rb 4096 ;rb 1024+16
;---------------------------------------------------------------------
align 4
filename_area:
rb 256
;---------------------------------------------------------------------
align 4
temp_dir_pach:
rb 4096
;---------------------------------------------------------------------
align 4
library_path:
rb 4096
;---------------------------------------------------------------------
align 4
cur_dir_path:
rb 4096
;---------------------------------------------------------------------
align 4
procinfo:
rb 1024
;---------------------------------------------------------------------
align 4
IPC_table rd 256
;---------------------------------------------------------------------
align 4
rb 4096
stacktop:
;---------------------------------------------------------------------
I_END:
/programs/media/animage/trunk/load_from_parameters.inc
5,25 → 5,26
;OUT
;value not returned
 
;check_loading_from_parameters:
check_loading_from_parameters:
 
; cmp [eax],byte 0
; jz no_parameters
cmp [eax],byte 0
jz no_parameters
 
;copy file name
; mov esi,eax
; mov edi,ebx
; mov ecx,256
; rep movsb
mov esi,eax
mov edi,ebx
mov ecx,256
rep movsb
 
;load file in memory
; call load_picture
call load_picture
 
; no_parameters:
no_parameters:
; ret
ret
 
 
; load picture from file to memory
 
load_picture:
82,8 → 83,36
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
 
imul eax,ebx
lea eax,[eax+eax*2]
 
mov ebx,[ScreenPointer]
add ebx,(1200*1000*3)+50*(20*20*3)+500000
 
mov [PointerToPicture],ebx
mov [PointerToCopyPicture],ebx
mov [PointerToCopyPicture2],ebx
mov [PointerToEditBufer],ebx
mov [PointerToSpriteBufer],ebx
 
add [PointerToCopyPicture],eax
 
add [PointerToCopyPicture2],eax
add [PointerToCopyPicture2],eax
 
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
 
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
 
call GetMemory
 
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
/programs/media/animage/trunk/menu_instruments.inc
172,7 → 172,35
mcall
 
;get memory for new picture
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
 
imul eax,ebx
lea eax,[eax+eax*2]
 
mov ebx,[ScreenPointer]
add ebx,(1200*1000*3)+50*(20*20*3)+500000
 
mov [PointerToPicture],ebx
mov [PointerToCopyPicture],ebx
mov [PointerToCopyPicture2],ebx
mov [PointerToEditBufer],ebx
mov [PointerToSpriteBufer],ebx
 
add [PointerToCopyPicture],eax
 
add [PointerToCopyPicture2],eax
add [PointerToCopyPicture2],eax
 
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
 
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
 
call GetMemory
 
and [save_flag],0
189,17 → 217,7
cmp [number_menu],2
jne no_open
 
; opendialog drawwin,open_1,open_2,file_path
;---------------------------------------------------------------------
mov [OpenDialog_data.type],0 ; open
push dword OpenDialog_data
call [OpenDialog_Start]
cmp [OpenDialog_data.status],1
jne still
;---------------------------------------------------------------------
 
opendialog drawwin,open_1,open_2,file_path
open_1:
 
mov eax,40
260,6 → 278,35
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
 
imul eax,ebx
lea eax,[eax+eax*2]
 
mov ebx,[ScreenPointer]
add ebx,(1200*1000*3)+50*(20*20*3)+500000
 
mov [PointerToPicture],ebx
mov [PointerToCopyPicture],ebx
mov [PointerToCopyPicture2],ebx
mov [PointerToEditBufer],ebx
mov [PointerToSpriteBufer],ebx
 
add [PointerToCopyPicture],eax
 
add [PointerToCopyPicture2],eax
add [PointerToCopyPicture2],eax
 
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
 
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
 
call GetMemory
;----------------------------------------------------------
;--------------------Load file in memory-------------------
333,17 → 380,8
cmp [number_menu],4
jne no_save
 
; savedialog drawwin,save1,save2,file_path
;---------------------------------------------------------------------
mov [OpenDialog_data.type],1 ; save
savedialog drawwin,save1,save2,file_path
push dword OpenDialog_data
call [OpenDialog_Start]
cmp [OpenDialog_data.status],1
jne still
;---------------------------------------------------------------------
 
save1:
 
save_enter:
/programs/media/animage/trunk/events_of_keys.inc
78,7 → 78,7
 
mov eax,CursorsID
call delete_cursors
close:
 
mov eax,-1
mcall
 
/programs/media/animage/trunk/init_data.inc
11,33 → 11,19
mov [WorkScreen_SizeY],100
mov [MaxWorkScreen_SizeX],100
mov [MaxWorkScreen_SizeY],100
mov [ScreenPointer],0x19000
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 [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
; mov [PointerToCopyPicture2],I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*2 ; S = 5696000, L = 768000 = 750 Kb
; mov [PointerToEditBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*3 ; S = 6464000, L = 768000 = 750 Kb
; mov [PointerToSpriteBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*4 ; S = 7232000, L = 768000 = 750 Kb
; mov [PointerToPalette], I_END+(1200*100*3)+50*(20*20*3)+1 ; S = 420001
; mov [ReserveArray], I_END+(1200*1000)*3+50*(20*20*3)+8 ; S = 3660008
 
mcall 68,12,4096
mov [ScreenPointer],eax
 
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
and [save_flag],0
mov [line_width],1
mov [lastik_is_active],0
46,7 → 32,7
and [number_undo],0
and [instrument_used],0
and [DrawSprite_flag],0
; and [extended_memory],0
and [extended_memory],0
 
;mov eax,68
;mov ebx,11
/programs/media/animage/trunk/memory.inc
1,76 → 1,28
;----------------------------------------------------------
;--------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
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,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 ; 4192384
mcall 68,20,,[ScreenPointer]
add ecx,[ScreenPointer]
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
add ecx,[extended_memory]
mcall
 
test eax,eax
jnz have_new_memory
jz have_new_memory
 
mov esi,sound_havent_memory
call sound
pushad
 
jmp still
 
have_new_memory:
mov [ScreenPointer],eax
call prepare_data_pointers
popad
ret
;---------------------------------------------------------
prepare_data_pointers:
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
imul eax,ebx
lea eax,[eax+eax*2]
mov ebx,[ScreenPointer]
add ebx,(1200*1000*3)+50*(20*20*3)+500000
 
mov [PointerToPicture],ebx
mov [PointerToCopyPicture],ebx
mov [PointerToCopyPicture2],ebx
mov [PointerToEditBufer],ebx
mov [PointerToSpriteBufer],ebx
 
add [PointerToCopyPicture],eax
 
add [PointerToCopyPicture2],eax
add [PointerToCopyPicture2],eax
 
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
add [PointerToEditBufer],eax
 
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax
ret
;---------------------------------------------------------
/programs/media/animage/trunk/build_en.bat
1,3 → 1,2
@fasm animage.asm animage
@kpack animage
@pause
/programs/media/animage/trunk/panel_data.inc
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.1',0
mouse_pos_x db 'X='
mouse_pos_y db 'Y='
new_text1 db 'PICTURE SIZE X'