Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3014 → Rev 3105

/programs/develop/libraries/buf2d/trunk/examples/build.bat
16,6 → 16,7
@fasm.exe -m 16384 e5_lines_sm.asm bin\e5_lines_sm.kex
@fasm.exe -m 16384 e6_vox_1g.asm bin\e6_vox_1g.kex
@fasm.exe -m 16384 e7_vox_3g.asm bin\e7_vox_3g.kex
@fasm.exe -m 16384 e8_filters.asm bin\e8_filters.kex
 
@kpack bin\e0_dr_lines.kex
@kpack bin\e1_scaling.kex
25,4 → 26,5
@kpack bin\e5_lines_sm.kex
@kpack bin\e6_vox_1g.kex
@kpack bin\e7_vox_3g.kex
@kpack bin\e8_filters.kex
pause
/programs/develop/libraries/buf2d/trunk/examples/e0_dr_lines.asm
10,7 → 10,7
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
/programs/develop/libraries/buf2d/trunk/examples/e1_scaling.asm
10,7 → 10,7
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
/programs/develop/libraries/buf2d/trunk/examples/e4_graf_ed.asm
10,7 → 10,7
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
/programs/develop/libraries/buf2d/trunk/examples/e5_lines_sm.asm
10,7 → 10,7
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
/programs/develop/libraries/buf2d/trunk/examples/e6_vox_1g.asm
10,7 → 10,7
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
/programs/develop/libraries/buf2d/trunk/examples/e7_vox_3g.asm
10,7 → 10,7
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
/programs/develop/libraries/buf2d/trunk/examples/e8_filters.asm
0,0 → 1,296
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
dd mem,stacktop
dd 0,sys_path
 
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include '../../../../../dll.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
 
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
 
IMAGE_FILE1_SIZE equ 200*186*3 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬ 200 x 100
 
BUF_STRUCT_SIZE equ 21
buf2d_data equ dword[edi] ;¤ ­­ë¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
buf2d_w equ dword[edi+8] ;è¨à¨­  ¡ãä¥à 
buf2d_h equ dword[edi+12] ;¢ëá®â  ¡ãä¥à 
buf2d_l equ word[edi+4]
buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã
buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢  ¨ á¯à ¢  ¤«ï ¡ãä¥à 
buf2d_color equ dword[edi+16] ;梥â ä®­  ¡ãä¥à 
buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥­¨ï
vox_offs_tree_table equ 4
 
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
jmp @f
local .path_str
.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
db 0
@@:
;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
copy_path .path_str,[32],file_name,0x0
else
copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
end if
 
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size
m2m [run_file_70.Buffer], [buf]
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff
je @f
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_decode], dword[buf],ebx,0
mov dword[image_data],eax
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_destroy], dword[image_data]
@@:
}
 
align 4
start:
load_libraries l_libs_start,load_lib_end
 
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib1
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
 
mcall 40,0x27
mcall 48,3,sc,sizeof.system_colors ;¯®«ãç ¥¬ á¨á⥬­ë¥ 梥â 
 
load_image_file 'img1.png',image_data_rgb, IMAGE_FILE1_SIZE
stdcall [buf2d_create_f_img], buf_0,[image_data_rgb] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall [buf2d_create_f_img], buf_1,[image_data_rgb] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall [buf2d_create_f_img], buf_2,[image_data_rgb] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_rgb] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
 
stdcall [buf2d_filter_dither], buf_1,0
stdcall [buf2d_filter_dither], buf_2,2
 
align 4
red_win:
call draw_window
 
align 4
still: ;£« ¢­ë© 横«
mcall 10
 
cmp al,0x1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,0x2
jz key
cmp al,0x3
jz button
 
jmp still
 
align 4
key:
push eax ebx
mcall 2
;...
pop ebx eax
jmp still
 
 
align 4
draw_window:
pushad
mcall 12,1
 
mov edx,[sc.work]
or edx,0x33000000
mcall 0,(20 shl 16)+670,(20 shl 16)+520,,,caption ;ᮧ¤ ­¨¥ ®ª­ 
 
stdcall [buf2d_draw], buf_0
stdcall [buf2d_draw], buf_1
stdcall [buf2d_draw], buf_2
mcall 12,2
popad
ret
 
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
 
system_dir0 db '/sys/lib/'
name_buf2d db 'buf2d.obj',0
err_message_found_lib0 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã buf2d.obj',0
err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ buf2d.obj',0
 
system_dir1 db '/sys/lib/'
name_libimg db 'libimg.obj',0
err_message_found_lib1 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
 
;library structures
l_libs_start:
lib0 l_libs name_buf2d, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, import_buf2d_lib, err_message_import0, head_f_i
lib1 l_libs name_libimg, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, import_libimg, err_message_import1, head_f_i
load_lib_end:
 
align 4
button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,1
jne still
.exit:
stdcall [buf2d_delete],buf_0 ;㤠«ï¥¬ ¡ãä¥à
stdcall [buf2d_delete],buf_1 ;㤠«ï¥¬ ¡ãä¥à
stdcall [buf2d_delete],buf_2 ;㤠«ï¥¬ ¡ãä¥à
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
 
image_data dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï ª à⨭ª¨ äã­ªæ¨ï¬¨ libimg
image_data_gray dd 0 ;¯ ¬ïâì á ¯à¥®¡à §®¢ ­­ë¬ ¨§®¡à ¦¥­¨¥¬ ¢ ä®à¬ â¥ 8-bit
image_data_rgb dd 0 ;¯ ¬ïâì á ¯à¥®¡à §®¢ ­­ë¬ ¨§®¡à ¦¥­¨¥¬ ¢ ä®à¬ â¥ rgb
image_data_foto dd 0
 
run_file_70 FileInfoBlock
caption db 'Draw images 13.09.11',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors ;á¨á⥬­ë¥ 梥â 
 
align 4
buf_0:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 5 ;+4 left
dw 5 ;+6 top
dd 200 ;+8 w
dd 186 ;+12 h
dd 0xffffff ;+16 color
db 24 ;+20 bit in pixel
 
align 4
buf_1:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 5 ;+4 left
dw 200 ;+6 top
dd 200 ;+8 w
dd 186 ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
 
align 4
buf_2:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 210 ;+4 left
dw 200 ;+6 top
dd 200 ;+8 w
dd 186 ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
 
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
 
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
 
align 4
import_buf2d_lib:
dd sz_lib_init
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_filter_dither dd sz_buf2d_filter_dither
dd 0,0
sz_lib_init db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_filter_dither db 'buf2d_filter_dither',0
 
i_end:
rb 1024
stacktop:
sys_path rb 4096
file_name:
rb 4096
plugin_path:
rb 4096
openfile_path:
rb 4096
filename_area:
rb 256
mem: