libs-dev: libimg encode example

git-svn-id: svn://kolibrios.org@2685 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2012-05-25 23:04:20 +00:00
parent 0f1707c32e
commit 91051dc850
5 changed files with 41 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -74,6 +74,28 @@ START:
stosb
dec ecx
jnz @b
stdcall [img.encode], [image_to_rgb2], (LIBIMG_FORMAT_ID_PNM), 0
; stdcall [img.encode], [image_initial], (LIBIMG_FORMAT_ID_PNM), 0
test eax, eax
jz exit
mov [encoded_file], eax
mov [encoded_file_size], ecx
invoke file.open, output_file, O_WRITE OR O_CREATE
or eax, eax
jz exit
mov [fh], eax
invoke file.write, [fh], [encoded_file], [encoded_file_size]
cmp eax, [encoded_file_size]
jne exit
invoke file.close, [fh]
inc eax
jz exit
stdcall mem.Free, [encoded_file]
;-----------------------------------------------------------------------------
redraw:
@ -176,9 +198,15 @@ endp
;-----------------------------------------------------------------------------
window_title db 'img.to_rgb2 test app',0
window_title db 'libimg to_rgb2 & encode demo',0
;input_file db '/hd0/1/in_1bpp.wbmp',0
;input_file db '/hd0/1/in_8bpp.tiff',0
input_file db '/hd0/1/in_32bpp.png',0
;output_file db '/hd0/1/out_1bpp.pnm',0
;output_file db '/hd0/1/out_8bpp.pnm',0
output_file db '/hd0/1/out_24bpp.pnm',0
;-----------------------------------------------------------------------------
align 16
@ -193,23 +221,29 @@ import libio , \
file.size , 'file_size' , \
file.open , 'file_open' , \
file.read , 'file_read' , \
file.write , 'file_write' , \
file.close , 'file_close'
import libimg , \
libimg.init , 'lib_init' , \
img.draw , 'img_draw' , \
img.decode , 'img_decode' , \
img.encode , 'img_encode' , \
img.create , 'img_create' , \
img.destroy , 'img_destroy', \
img.to_rgb2 , 'img_to_rgb2'
img.to_rgb2 , 'img_to_rgb2', \
img.formats_table, 'img_formats_table'
;-----------------------------------------------------------------------------
I_END:
img_data dd ?
img_data_len dd ?
fh dd ?
img_data dd ?
img_data_len dd ?
fh dd ?
image_initial dd ?
image_to_rgb2 dd ?
image_initial dd ?
image_to_rgb2 dd ?
encoded_file dd ?
encoded_file_size dd ?