Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 2184 → Rev 2185

/programs/develop/libraries/buf2d/trunk/about.htm
62,7 → 62,7
Ñ åå ïîìîùüþ ìîæíî ñîçäàâàòü áóôåðà ñ èçîáðàæåíèÿìè â ïàìÿòè, è ïðè íåîáõîäèìîñòè âûâîäèòü èõ íà ýêðàí.
Èçîáðàæåíèÿ ìîæíî íàêëàäûâàòü îäíî íà äðóãîå, ïîääåðæèâàåòñÿ ðàáîòà ñ ïðîçðà÷íûìè èçîáðàæåíèÿìè, åñòü ôóíêöèÿ ðèñîâàíèÿ ëèíè ïîêà íà ýòîì âñå.</p>
 
<p>Ïîñëåäíåå îáíîâëåíèå áèáëèîòåêè 25.03.11.</p>
<p>Ïîñëåäíåå îáíîâëåíèå áèáëèîòåêè 13.09.11.</p>
 
<h1><a name="f_buf">Ôîðìàòû áóôåðîâ</a></h1>
<p>Ïîääåðæèâàåòñÿ 3 ôîðìàòà áóôåðîâ.
293,5 → 293,6
<p>22.12.10 - èçìåíåíî èìÿ ôóíêöèè buf2d_cruve_bezier íà buf2d_curve_bezier.</p>
<p>25.03.11 - äîáàâëåíà ôóíêöèÿ ðèñîâàíèÿ äëÿ òî÷êè buf2d_set_pixel.</p>
<p>30.08.11 - äîáàâëåíà ôóíêöèÿ èçìåíåíèÿ ðàçìåðîâ áóôåðà buf2d_resize.</p>
<p>13.09.11 - îïòèìèçèðîâàíà ðàáîòà ôóíêöèé buf_filled_rect_by_size buf_rect_by_size, äîáàâëåíû ïðèìåðû èñïîëüçîâàíèÿ áèáëèîòåêè.</p>
</body>
</html>
/programs/develop/libraries/buf2d/trunk/buf2d.asm
1080,11 → 1080,19
jle @f
xchg ebx,esi ;¥á«¨ x0 > x1 â® ¬¥­ï¥¬ ¬¥áâ ¬¨ x0 ¨ x1
@@:
bt ebx,31
jae @f
;¥á«¨ ª®®à¤¨­ â  x0 ®âà¨æ â¥«ì­ ï
xor ebx,ebx
@@:
cmp esi,buf2d_w
jl @f
;¥á«¨ ª®®à¤¨­ â  x0 ¡®«ìè¥ è¨à¨­ë ¡ãä¥à 
mov esi,buf2d_w
;dec esi
@@:
cmp ebx,esi
jge .end24 ;¥á«¨ x0 >= x1 ¬®¦¥â ¢®§­¨ª­ãâì ª®£¤  ®¡¥ ª®®à¤¨­ âë x0, x1 ­ å®¤¨«¨áì §  ®¤­¨¬ ¨§ ¯à¥¤¥«®¢ ¡ãä¥à 
 
;¢ eax ¢ëç¨á«ï¥¬ ­ ç «® 1-© â®çª¨ «¨­¨¨ ¢ ¡ãä¥à¥ ¨§®¡à ¦¥­¨ï
mov eax,buf2d_w ;size x
1093,21 → 1101,17
lea eax,[eax+eax*2] ;(size_x*y+x)*3
add eax,buf2d_data ;ptr+(size_x*y+x)*3
 
mov ecx,esi
sub ecx,ebx ;¢ ecx ª®««¨ç¥á⢮ â®ç¥ª «¨­¨¨ ¢ë¢®¤¨¬ëå ¢ ¡ãä¥à
mov edx,dword[color]
mov ebx,edx ;ª®®à¤¨­ â  x0 ¢ ebx 㦥 ­¥ ­ã¦­ 
ror edx,16 ;¯®¢®à ç¨¢ ¥¬ ॣ¨áâà çâ® ¡ë 3-© ¡ ©â ¯®¯ « ¢ dl
cld
@@: ;横« ¯® ®á¨ x ®â x0 ¤® x1
cmp ebx,esi
jge @f
bt ebx,31
jc .otr_x
mov word[eax],dx ;copy pixel color
ror edx,16
mov word[eax],bx ;copy pixel color
mov byte[eax+2],dl
ror edx,16
.otr_x:
add eax,3
inc ebx
jmp @b
@@:
loop @b
.end24:
popad
ret
/programs/develop/libraries/buf2d/trunk/examples/build.bat
0,0 → 1,21
if not exist bin mkdir bin
@fasm.exe -m 16384 ..\buf2d.asm bin\buf2d.obj
@kpack bin\buf2d.obj
 
if not exist bin\font8x9.bmp @copy ..\..\..\..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@copy foto.jpg bin\foto.jpg
@copy img0.png bin\img0.png
@copy img1.png bin\img1.png
 
@fasm.exe -m 16384 e0_dr_lines.asm bin\e0_dr_lines.kex
@fasm.exe -m 16384 e1_scaling.asm bin\e1_scaling.kex
@fasm.exe -m 16384 e2_images.asm bin\e2_images.kex
@fasm.exe -m 16384 e3_text.asm bin\e3_text.kex
@fasm.exe -m 16384 e4_graf_ed.asm bin\e4_graf_ed.kex
 
@kpack bin\e0_dr_lines.kex
@kpack bin\e1_scaling.kex
@kpack bin\e2_images.kex
@kpack bin\e3_text.kex
@kpack bin\e4_graf_ed.kex
pause
/programs/develop/libraries/buf2d/trunk/examples/dll.inc
0,0 → 1,99
 
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
 
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
 
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
 
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
 
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
 
s_libdir:
db '/sys/lib/'
.fname rb 32
/programs/develop/libraries/buf2d/trunk/examples/e0_dr_lines.asm
0,0 → 1,150
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
dd mem,stacktop
dd 0,cur_dir_path
 
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
align 4
start:
load_library vectors_name, cur_dir_path, library_path, system_path, \
err_message_found_lib, head_f_l, import_buf2d_lib, err_message_import, head_f_i
cmp eax,-1
jz button.exit
 
mcall 40,0x27
stdcall [buf2d_create], buf_0 ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall [buf2d_line], buf_0, 110, 20, 125, 90, 0xffff00 ;à¨á㥬 «¨­¨î
stdcall [buf2d_line], buf_0, 60, 120, 110, 20, 0xd000 ;à¨á㥬 «¨­¨î
stdcall [buf2d_curve_bezier], buf_0, (10 shl 16)+20,(110 shl 16)+10,(50 shl 16)+90, dword 0xff
stdcall [buf2d_circle], buf_0, 125, 90, 30, 0xffffff ;à¨á㥬 ®ªà㦭®áâì
stdcall [buf2d_circle], buf_0, 25, 70, 15, 0xff0000 ;à¨á㥬 ®ªà㦭®áâì
 
align 4
red_win:
call draw_window
 
align 4
still:
mcall 10
cmp al,1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
 
align 4
draw_window:
pushad
mcall 12,1
 
;mov edx,0x32000000
mov edx,0x33000000
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
 
stdcall [buf2d_draw], buf_0
 
mcall 12,2
popad
ret
 
align 4
key:
mcall 2
 
cmp ah,27 ;Esc
je button.exit
 
jmp still
 
align 4
button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,1
jne still
.exit:
stdcall [buf2d_delete],buf_0 ;㤠«ï¥¬ ¡ãä¥à
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
 
caption db 'Test buf2d library, [Esc] - exit',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_line dd sz_buf2d_line
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
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_line db 'buf2d_line',0
sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ­¨¥ ®ªà㦭®áâ¨
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
 
align 4
buf_0:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 20 ;+4 left
dw 10 ;+6 top
dd 160 ;+8 w
dd 128 ;+12 h
dd 0x80 ;+16 color
db 24 ;+20 bit in pixel
 
;--------------------------------------------------
system_path db '/sys/lib/'
vectors_name db 'buf2d.obj',0
err_message_found_lib db 'Sorry I cannot load library buf2d.obj',0
head_f_i:
head_f_l db 'System error',0
err_message_import db 'Error on load import library buf2d.obj',0
;--------------------------------------------------
 
i_end: ;ª®­¥æ ª®¤ 
rb 1024
stacktop:
cur_dir_path:
rb 4096
library_path:
rb 4096
mem:
 
/programs/develop/libraries/buf2d/trunk/examples/e1_scaling.asm
0,0 → 1,182
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
dd mem,stacktop
dd 0,cur_dir_path
 
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
align 4
start:
load_library vectors_name, cur_dir_path, library_path, system_path, \
err_message_found_lib, head_f_l, import_buf2d_lib, err_message_import, head_f_i
cmp eax,-1
jz button.exit
 
mcall 40,0x27
stdcall [buf2d_create], buf_0 ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall [buf2d_line], buf_0, 110, 20, 125, 90, 0xffff00 ;à¨á㥬 «¨­¨î
stdcall [buf2d_line], buf_0, 60, 120, 110, 20, 0xd000 ;à¨á㥬 «¨­¨î
stdcall [buf2d_curve_bezier], buf_0, (10 shl 16)+20,(110 shl 16)+10,(50 shl 16)+90, dword 0xff
stdcall [buf2d_circle], buf_0, 125, 90, 30, 0xffffff ;à¨á㥬 ®ªà㦭®áâì
stdcall [buf2d_circle], buf_0, 25, 70, 15, 0xff0000 ;à¨á㥬 ®ªà㦭®áâì
 
stdcall [buf2d_img_hdiv2], buf_0 ;ᦨ¬ ¥¬ ¨§®¡à ¦¥­¨¥ ¢ ¡ãä¥à¥ ¯® ¢ëá®â¥ ¢ 2 à § 
stdcall [buf2d_img_wdiv2], buf_0 ;ᦨ¬ ¥¬ ¨§®¡à ¦¥­¨¥ ¢ ¡ãä¥à¥ ¯® è¨à¨­¥ ¢ 2 à § 
stdcall [buf2d_create_f_img], buf_1,[buf_0] ;ᮧ¤ ¥¬ ¬ «¥­ìª¨© ¡ãä¥à buf_1, ­  ®á­®¢¥ ᦠ⮣® ¨§®¡à ¦¥­¨ï ¨§ buf_0
 
;¥á«¨ ¡ë ¨á¯®«ì§®¢ « áì äã­ªæ¨ï buf2d_create, ⮣¤  ¡¨âë ¨§®¡à ¦¥­¨ï
;¯à¨è«®áì ¡ë ª®¯¨à®¢ âì á«¥¤ã騬¨ áâப ¬¨:
;xor ecx,ecx
;xor eax,eax
;mov cx,word[buf_1.size_x]
;mov ax,word[buf_1.size_y]
;imul ecx,eax
;imul ecx,3 ;ecx - ª®««¨ç¥á⢮ ¡ ©â ¢ ¬ «¥­ìª®¬ ¡ãä¥à¥
;stdcall mem_copy, dword[buf_0],dword[buf_1],ecx
 
stdcall [buf2d_clear], buf_0,0xffffff
stdcall [buf2d_bit_blt], buf_0, 15,10, buf_1
stdcall [buf2d_bit_blt], buf_0, 110,65, buf_1
 
stdcall [buf2d_conv_24_to_8], buf_1
;stdcall [buf2d_bit_blt_alpha], buf_0, 1,1, buf_1,0xff8080 ;à¨á㥬 ª®­âãàë ¨§®¡à ¦¥­¨ï ­  ä®â®£à ä¨¨
 
align 4
red_win:
call draw_window
 
align 4
still:
mcall 10
cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
 
align 4
draw_window:
pushad
mcall 12,1
 
;mov edx,0x32000000
mov edx,0x33000000
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
 
stdcall [buf2d_draw], buf_0
 
mcall 12,2
popad
ret
 
align 4
key:
mcall 2
 
cmp ah,27 ;Esc
je button.exit
 
jmp still
 
align 4
button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,1
jne still
.exit:
stdcall [buf2d_delete],buf_0 ;㤠«ï¥¬ ¡ãä¥à
stdcall [buf2d_delete],buf_1 ;㤠«ï¥¬ ¡ãä¥à
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
 
caption db 'Test buf2d library, [Esc] - exit',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_line dd sz_buf2d_line
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
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_line db 'buf2d_line',0
sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ­¨¥ ®ªà㦭®áâ¨
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
 
align 4
buf_0:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 20 ;+4 left
dw 10 ;+6 top
dd 160 ;+8 w
dd 128 ;+12 h
dd 0x80 ;+16 color
db 24 ;+20 bit in pixel
 
align 4
buf_1:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 10 ;+4 left
dw 10 ;+6 top
.size_x: dd 80 ;+8 w
.size_y: dd 64 ;+12 h
dd 0x80 ;+16 color
db 24 ;+20 bit in pixel
 
;--------------------------------------------------
system_path db '/sys/lib/'
vectors_name db 'buf2d.obj',0
err_message_found_lib db 'Sorry I cannot load library buf2d.obj',0
head_f_i:
head_f_l db 'System error',0
err_message_import db 'Error on load import library buf2d.obj',0
;--------------------------------------------------
 
i_end: ;ª®­¥æ ª®¤ 
rb 1024
stacktop:
cur_dir_path:
rb 4096
library_path:
rb 4096
mem:
 
/programs/develop/libraries/buf2d/trunk/examples/e2_images.asm
0,0 → 1,318
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 'mem.inc'
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_FILE0_SIZE equ 640*480*3 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬ 640 x 480
IMAGE_FILE1_SIZE equ 200*186*3 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬ 200 x 100
fn_foto db 'foto.jpg',0
 
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 fn_foto, image_data_foto,IMAGE_FILE0_SIZE
stdcall [buf2d_create_f_img], buf_0,[image_data_foto] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_foto] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
 
load_image_file 'img0.png',image_data_gray,IMAGE_FILE1_SIZE
stdcall [buf2d_create_f_img], buf_1,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
 
load_image_file 'img1.png',image_data_rgb, IMAGE_FILE1_SIZE
stdcall [buf2d_create_f_img], buf_2,[image_data_rgb] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_rgb] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
 
stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8¡¨â
stdcall [buf2d_conv_24_to_32],buf_2,buf_1 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
 
stdcall [buf2d_bit_blt], buf_0, 10,170, buf_2 ;à¨á㥬 ¨§®¡à ¦¥­¨¥ ­  ä®â®£à ä¨¨
stdcall [buf2d_bit_blt_transp], buf_0, 210,270, buf_2 ;à¨á㥬 ¯à®§à ç­®¥ ¨§®¡à ¦¥­¨¥ ­  ä®â®£à ä¨¨
stdcall [buf2d_bit_blt_alpha], buf_0, 410,170, buf_1,0xff8080 ;à¨á㥬 ª®­âãàë ¨§®¡à ¦¥­¨ï ­  ä®â®£à ä¨¨
 
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
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 640 ;+8 w
dd 480 ;+12 h
dd 0xffffff ;+16 color
db 24 ;+20 bit in pixel
 
align 4
buf_1:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 25 ;+4 left
dw 25 ;+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 235 ;+4 left
dw 25 ;+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_line dd sz_buf2d_line
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
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_line db 'buf2d_line',0
sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ­¨¥ ®ªà㦭®áâ¨
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',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:
/programs/develop/libraries/buf2d/trunk/examples/e3_text.asm
0,0 → 1,318
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 'mem.inc'
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 128*144*3 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬ 128 x 144
 
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 ;¯®«ãç ¥¬ á¨á⥬­ë¥ 梥â 
 
stdcall [buf2d_create], buf_0 ;ᮧ¤ ¥¬ ¡ãä¥à
 
load_image_file 'font8x9.bmp', image_data_foto,IMAGE_FILE1_SIZE
stdcall [buf2d_create_f_img], buf_1,[image_data_foto] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_foto] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
 
stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
stdcall [buf2d_bit_blt_alpha], buf_0, 70,10, buf_1,0x20d020 ;à¨á㥬 ¨á室­ãî ⥪á⮢ãî ¬ âà¨æã 16*16
stdcall [buf2d_convert_text_matrix], buf_1
stdcall [buf2d_bit_blt_alpha], buf_0, 10,10, buf_1,0xff8080 ;à¨á㥬 ¯à¥®¡à §®¢ ­­ãî ⥪á⮢ãî ¬ âà¨æã 1*256
stdcall [buf2d_draw_text], buf_0, buf_1,some_text,70,170,0x4040ff ;à¨á㥬 áâபã á ⥪á⮬
 
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
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 ;㤠«ï¥¬ ¡ãä¥à
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 text 13.09.11',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors ;á¨á⥬­ë¥ 梥â 
 
align 4
buf_0:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 5 ;+4 left
dw 5 ;+6 top
dd 640 ;+8 w
dd 480 ;+12 h
dd 0xffffff ;+16 color
db 24 ;+20 bit in pixel
 
align 4
buf_1:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 25 ;+4 left
dw 25 ;+6 top
dd 128 ;+8 w
dd 144 ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
 
some_text db 'à¨¬¥à ¢ë¢®¤  â¥áâ  ¢ ¡ãä¥à, ¢®§¬®¦¥­ ¢ë¢®¤:',13,13
db ' * ¢ ­¥áª®«ìª® áâப',13
db ' * ¬®¦­® § ¤ ¢ âì 梥â ⥪áâ ',13,13
db '‘¥£®¤­ï 13 ᥭâï¡àï 2011.',0
 
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_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
 
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_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',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:
/programs/develop/libraries/buf2d/trunk/examples/e4_graf_ed.asm
0,0 → 1,189
use32
org 0x0
db 'MENUET01' ;èäåíòèô. èñïîëíÿåìîãî ôàéëà âñåãäà 8 áàéò
dd 0x1
dd start
dd i_end ;ðàçìåð ïðèëîæåíèÿ
dd mem,stacktop
dd 0,cur_dir_path
 
include '../../../../../macros.inc'
include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
 
buf2d_l equ word[edi+4] ;îòñòóï ñëåâà
buf2d_t equ word[edi+6] ;îòñòóï ñâåðõó
 
align 4
start:
load_library vectors_name, cur_dir_path, library_path, system_path, \
err_message_found_lib, head_f_l, import_buf2d_lib, err_message_import, head_f_i
cmp eax,-1
jz button.exit
 
mcall 40,0x27
mcall 48,3,sc,sizeof.system_colors ;ïîëó÷àåì ñèñòåìíûå öâåòà
stdcall [buf2d_create], buf_0 ;ñîçäàåì áóôåð
 
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
cmp al,0x6
jz mouse
jmp still
 
align 4
draw_window:
pushad
mcall 12,1
 
mov edx,[sc.work]
or edx,0x33000000
mcall 0,(50 shl 16)+500,(30 shl 16)+370,,,caption
 
stdcall [buf2d_draw], buf_0
 
mcall 12,2
popad
ret
 
align 4
key:
mcall 2
; cmp ah,27 ;Esc
; je button.exit
jmp still
 
align 4
button:
mcall 17 ;ïîëó÷èòü êîä íàæàòîé êíîïêè
cmp ah,1
jne still
.exit:
stdcall [buf2d_delete],buf_0 ;óäàëÿåì áóôåð
mcall -1 ;âûõîä èç ïðîãðàììû
 
align 4
mouse:
;îáðàáàòûâàåì îêíî ðåäàêòîðà
mcall 37,2 ;get mouse buttons
cmp al,1
jne @f
mcall 37,1 ;get mouse coords
mov ebx,eax
shr ebx,16 ;â eax êîîðäèíàòà ìèøè ïî îñè 'x'
and eax,0xffff ;â eax êîîðäèíàòà ìèøè ïî îñè 'y'
mov edi,buf_0
sub ax,buf2d_t ;ñäâèãàåì êîîðäèíàòû ó÷èòûâàÿ ñìåùåíèå áóôåðà
sub bx,buf2d_l
 
;ðèñîâàíèå ïðè íàæàòèè
;stdcall [buf2d_circle], edi, ebx, eax, 20, 0xff0000 ;ðèñóåì îêðóæíîñòü
;stdcall [buf2d_flood_fill], edi, ebx, eax, 0, 0xff,0xff0000 ;çàëèâêà öâåòîì
sub eax,5
sub ebx,5
stdcall [buf2d_filled_rect_by_size], edi, ebx,eax, 10,10, 0xff0000 ;ðèñóåì ïðÿìîóãîëüíèê
stdcall [buf2d_draw], edi ;îáíîâëÿåì ýêðàí
@@:
jmp still
 
caption db 'Press left mouse button',0
sc system_colors ;ñèñòåìíûå öâåòà
 
;--------------------------------------------------
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_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
 
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_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
 
align 4
buf_0:
dd 0 ;óêàçàòåëü íà áóôåð èçîáðàæåíèÿ
dw 5 ;+4 left
dw 5 ;+6 top
dd 480 ;+8 w
dd 320 ;+12 h
.color: dd 0xffffff ;+16 color
db 24 ;+20 bit in pixel
 
;--------------------------------------------------
system_path db '/sys/lib/'
vectors_name db 'buf2d.obj',0
err_message_found_lib db 'Sorry I cannot load library buf2d.obj',0
head_f_i:
head_f_l db 'System error',0
err_message_import db 'Error on load import library buf2d.obj',0
;--------------------------------------------------
 
i_end: ;êîíåö êîäà
rb 2*4096
stacktop:
cur_dir_path:
rb 4096
library_path:
rb 4096
mem:
 
/programs/develop/libraries/buf2d/trunk/examples/foto.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/libraries/buf2d/trunk/examples/img0.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/libraries/buf2d/trunk/examples/img1.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/libraries/buf2d/trunk/examples/mem.inc
0,0 → 1,48
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
 
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
 
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp
/programs/develop/libraries/buf2d/trunk/examples
Property changes:
Added: bugtraq:number
+true
\ No newline at end of property
Added: tsvn:logminsize
+5
\ No newline at end of property