forked from KolibriOS/kolibrios
* libs-dev: style of exported names changed, ini.get_int -> ini_get_int
* programs which use libs-dev updated accordingly * libimg: support for .ico and .cur files (icons and cursors) * kiv: show many different images in one file in one row git-svn-id: svn://kolibrios.org@1102 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
51a64dc292
commit
f705611d81
@ -374,41 +374,41 @@ library \
|
|||||||
libgfx,'libgfx.obj'
|
libgfx,'libgfx.obj'
|
||||||
|
|
||||||
import libini, \
|
import libini, \
|
||||||
ini.get_str,'ini.get_str',\
|
ini.get_str,'ini_get_str',\
|
||||||
ini.set_str,'ini.set_str',\
|
ini.set_str,'ini_set_str',\
|
||||||
ini.get_int,'ini.get_int',\
|
ini.get_int,'ini_get_int',\
|
||||||
ini.set_int,'ini.set_int',\
|
ini.set_int,'ini_set_int',\
|
||||||
ini.enum_sections,'ini.enum_sections',\
|
ini.enum_sections,'ini_enum_sections',\
|
||||||
ini.enum_keys,'ini.enum_keys'
|
ini.enum_keys,'ini_enum_keys'
|
||||||
|
|
||||||
import libio, \
|
import libio, \
|
||||||
\; file.aux.match_wildcard,'file.aux.match_wildcard',\
|
\; file.aux.match_wildcard,'file_aux_match_wildcard',\
|
||||||
file.find_first,'file.find_first',\
|
file.find_first,'file_find_first',\
|
||||||
file.find_next,'file.find_next',\
|
file.find_next,'file_find_next',\
|
||||||
file.find_close,'file.find_close',\
|
file.find_close,'file_find_close',\
|
||||||
file.open,'file.open',\
|
file.open,'file_open',\
|
||||||
file.seek,'file.seek',\
|
file.seek,'file_seek',\
|
||||||
file.write,'file.write',\
|
file.write,'file_write',\
|
||||||
file.truncate,'file.truncate',\
|
file.truncate,'file_truncate',\
|
||||||
file.close,'file.close'
|
file.close,'file_close'
|
||||||
|
|
||||||
import libgfx, \
|
import libgfx, \
|
||||||
gfx.open ,'gfx.open',\
|
gfx.open ,'gfx_open',\
|
||||||
gfx.close ,'gfx.close',\
|
gfx.close ,'gfx_close',\
|
||||||
gfx.pen.color ,'gfx.pen.color',\
|
gfx.pen.color ,'gfx_pen_color',\
|
||||||
gfx.brush.color ,'gfx.brush.color',\
|
gfx.brush.color ,'gfx_brush.color',\
|
||||||
gfx.pixel ,'gfx.pixel',\
|
gfx.pixel ,'gfx_pixel',\
|
||||||
gfx.move.to ,'gfx.move.to',\
|
gfx.move.to ,'gfx_move_to',\
|
||||||
gfx.line.to ,'gfx.line.to',\
|
gfx.line.to ,'gfx_line_to',\
|
||||||
gfx.line ,'gfx.line',\
|
gfx.line ,'gfx_line',\
|
||||||
gfx.polyline ,'gfx.polyline',\
|
gfx.polyline ,'gfx_polyline',\
|
||||||
gfx.polyline.to ,'gfx.polyline.to',\
|
gfx.polyline.to ,'gfx_polyline_to',\
|
||||||
gfx.fillrect ,'gfx.fillrect',\
|
gfx.fillrect ,'gfx_fillrect',\
|
||||||
gfx.fillrect.ex ,'gfx.fillrect.ex',\
|
gfx.fillrect.ex ,'gfx_fillrect_ex',\
|
||||||
gfx.framerect ,'gfx.framerect',\
|
gfx.framerect ,'gfx_framerect',\
|
||||||
gfx.framerect.ex,'gfx.framerect.ex',\
|
gfx.framerect.ex,'gfx_framerect_ex',\
|
||||||
gfx.rectangle ,'gfx.rectangle',\
|
gfx.rectangle ,'gfx_rectangle',\
|
||||||
gfx.rectangle.ex,'gfx.rectangle.ex'
|
gfx.rectangle.ex,'gfx_rectangle_ex'
|
||||||
|
|
||||||
I_END:
|
I_END:
|
||||||
|
|
||||||
|
@ -15,7 +15,13 @@ proc dll.Load, import_table:dword
|
|||||||
or eax,eax
|
or eax,eax
|
||||||
jz .fail
|
jz .fail
|
||||||
stdcall dll.Link,eax,edx
|
stdcall dll.Link,eax,edx
|
||||||
|
push eax
|
||||||
|
mov eax, [eax]
|
||||||
|
cmp dword [eax], 'lib_'
|
||||||
|
pop eax
|
||||||
|
jnz @f
|
||||||
stdcall dll.Init,[eax+4]
|
stdcall dll.Init,[eax+4]
|
||||||
|
@@:
|
||||||
pop esi
|
pop esi
|
||||||
add esi,8
|
add esi,8
|
||||||
jmp .next_lib
|
jmp .next_lib
|
||||||
|
@ -423,20 +423,20 @@ align 16
|
|||||||
|
|
||||||
export \
|
export \
|
||||||
lib_init , 'lib_init' , \
|
lib_init , 'lib_init' , \
|
||||||
0x01000000 , 'version' , \
|
0x00020002 , 'version' , \
|
||||||
gfx.open , 'gfx.open' , \
|
gfx.open , 'gfx_open' , \
|
||||||
gfx.close , 'gfx.close' , \
|
gfx.close , 'gfx_close' , \
|
||||||
gfx.pen.color , 'gfx.pen.color' , \
|
gfx.pen.color , 'gfx_pen_color' , \
|
||||||
gfx.brush.color , 'gfx.brush.color' , \
|
gfx.brush.color , 'gfx_brush_color' , \
|
||||||
gfx.pixel , 'gfx.pixel' , \
|
gfx.pixel , 'gfx_pixel' , \
|
||||||
gfx.move.to , 'gfx.move.to' , \
|
gfx.move.to , 'gfx_move_to' , \
|
||||||
gfx.line.to , 'gfx.line.to' , \
|
gfx.line.to , 'gfx_line_to' , \
|
||||||
gfx.line , 'gfx.line' , \
|
gfx.line , 'gfx_line' , \
|
||||||
gfx.polyline , 'gfx.polyline' , \
|
gfx.polyline , 'gfx_polyline' , \
|
||||||
gfx.polyline.to , 'gfx.polyline.to' , \
|
gfx.polyline.to , 'gfx_polyline_to' , \
|
||||||
gfx.fillrect , 'gfx.fillrect' , \
|
gfx.fillrect , 'gfx_fillrect' , \
|
||||||
gfx.fillrect.ex , 'gfx.fillrect.ex' , \
|
gfx.fillrect.ex , 'gfx_fillrect_ex' , \
|
||||||
gfx.framerect , 'gfx.framerect' , \
|
gfx.framerect , 'gfx_framerect' , \
|
||||||
gfx.framerect.ex , 'gfx.framerect.ex' , \
|
gfx.framerect.ex , 'gfx_framerect_ex' , \
|
||||||
gfx.rectangle , 'gfx.rectangle' , \
|
gfx.rectangle , 'gfx_rectangle' , \
|
||||||
gfx.rectangle.ex , 'gfx.rectangle.ex'
|
gfx.rectangle.ex , 'gfx_rectangle_ex'
|
||||||
|
@ -57,7 +57,7 @@ img.is.bmp:
|
|||||||
;endp
|
;endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.decode.bmp _data, _length ;//////////////////////////////////////////////////////////////;;
|
proc img.decode.bmp _data, _length, _options ;////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Decode data into image if it contains correctly formed raw data in BMP format ;;
|
;? Decode data into image if it contains correctly formed raw data in BMP format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -67,71 +67,77 @@ proc img.decode.bmp _data, _length ;////////////////////////////////////////////
|
|||||||
;< eax = 0 (error) or pointer to image ;;
|
;< eax = 0 (error) or pointer to image ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
locals
|
locals
|
||||||
|
length_rest dd ?
|
||||||
img dd ?
|
img dd ?
|
||||||
bTopDown db ?
|
bTopDown db ?
|
||||||
|
bIsIco db ?
|
||||||
endl
|
endl
|
||||||
|
img.decode.bmp.length_rest equ length_rest
|
||||||
|
mov [bIsIco], 0
|
||||||
|
.common: ; common place for BMP and ICO
|
||||||
|
|
||||||
push ebx esi edi
|
push ebx esi edi
|
||||||
|
|
||||||
; img.is.bmp has been already called by img.decode
|
|
||||||
; stdcall img.is.bmp, [_data], [_length]
|
|
||||||
; or eax, eax
|
|
||||||
; jz .error
|
|
||||||
|
|
||||||
mov ebx, [_data]
|
mov ebx, [_data]
|
||||||
; cmp [ebx + bmp.Header.info.Compression], bmp.BI_RGB
|
cmp [bIsIco], 0
|
||||||
; je @f
|
jnz @f
|
||||||
; mov eax, [ebx + bmp.Header.file.Size]
|
add ebx, sizeof.bmp.FileHeader
|
||||||
; cmp eax, [_length]
|
sub [_length], sizeof.bmp.FileHeader
|
||||||
; jne .error
|
@@:
|
||||||
; @@:
|
|
||||||
|
|
||||||
mov eax, [ebx + bmp.Header.info.Size]
|
mov eax, [ebx + bmp.InfoHeader.Size]
|
||||||
; sanity check: file length must be greater than size of headers
|
; sanity check: file length must be greater than size of headers
|
||||||
add eax, sizeof.bmp.FileHeader
|
|
||||||
cmp [_length], eax
|
cmp [_length], eax
|
||||||
jbe .error
|
jbe .error
|
||||||
|
|
||||||
mov [bTopDown], 0
|
mov [bTopDown], 0
|
||||||
|
|
||||||
cmp eax, sizeof.bmp.FileHeader + 12
|
cmp eax, 12
|
||||||
jz .old1
|
jz .old1
|
||||||
cmp eax, sizeof.bmp.FileHeader + 40
|
cmp eax, 40
|
||||||
jz .normal
|
jz .normal
|
||||||
cmp eax, sizeof.bmp.FileHeader + 56
|
cmp eax, 56
|
||||||
jnz .error
|
jnz .error
|
||||||
; convert images with <= 8 bpp to 8bpp, other - to 32 bpp
|
; convert images with <= 8 bpp to 8bpp, other - to 32 bpp
|
||||||
.normal:
|
.normal:
|
||||||
m2m eax, Image.bpp8
|
m2m eax, Image.bpp8
|
||||||
cmp [ebx + bmp.Header.info.BitCount], 8
|
cmp byte [ebx + 14], 8 ; bit count
|
||||||
jbe @f
|
jbe @f
|
||||||
mov al, Image.bpp32
|
mov al, Image.bpp32
|
||||||
@@:
|
@@:
|
||||||
push eax
|
push eax
|
||||||
mov eax, [ebx + bmp.Header.info.Height]
|
mov eax, [ebx + 8] ;[ebx + bmp.InfoHeader.Height]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jns @f
|
jns @f
|
||||||
inc [bTopDown]
|
inc [bTopDown]
|
||||||
neg eax
|
neg eax
|
||||||
|
@@:
|
||||||
|
cmp [bIsIco], 0 ; for icons Height is two times larger than image height
|
||||||
|
jz @f
|
||||||
|
shr eax, 1
|
||||||
@@:
|
@@:
|
||||||
pushd eax
|
pushd eax
|
||||||
pushd [ebx + bmp.Header.info.Width]
|
pushd [ebx + 4] ;[ebx + bmp.InfoHeader.Width]
|
||||||
jmp .create
|
jmp .create
|
||||||
.old1:
|
.old1:
|
||||||
m2m eax, Image.bpp8
|
m2m eax, Image.bpp8
|
||||||
cmp [ebx + bmp.Header.info.OldBitCount], 8
|
cmp byte [ebx + 10], 8 ; bit count
|
||||||
jbe @f
|
jbe @f
|
||||||
mov al, Image.bpp32
|
mov al, Image.bpp32
|
||||||
@@:
|
@@:
|
||||||
push eax
|
push eax
|
||||||
movsx eax, [ebx + bmp.Header.info.OldHeight]
|
movsx eax, word [ebx + 6] ;[ebx + bmp.InfoHeader.OldHeight]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jns @f
|
jns @f
|
||||||
inc [bTopDown]
|
inc [bTopDown]
|
||||||
neg eax
|
neg eax
|
||||||
|
@@:
|
||||||
|
cmp [bIsIco], 0 ; for icons Height is two times larger than image height
|
||||||
|
jz @f
|
||||||
|
shr eax, 1
|
||||||
@@:
|
@@:
|
||||||
push eax
|
push eax
|
||||||
movzx eax, [ebx + bmp.Header.info.OldWidth]
|
movzx eax, word [ebx + 4] ;[ebx + bmp.InfoHeader.OldWidth]
|
||||||
push eax
|
push eax
|
||||||
.create:
|
.create:
|
||||||
call img.create
|
call img.create
|
||||||
@ -151,9 +157,9 @@ endl
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop edi
|
pop edi
|
||||||
lea esi, [ebx + sizeof.bmp.FileHeader]
|
push edi
|
||||||
pushd [ebx + bmp.FileHeader.OffBits]
|
mov esi, ebx
|
||||||
mov ecx, [esi + bmp.InfoHeader.Size]
|
mov ecx, [ebx] ;[ebx + bmp.InfoHeader.Size]
|
||||||
cmp ecx, 12
|
cmp ecx, 12
|
||||||
jz .old2
|
jz .old2
|
||||||
rep movsb
|
rep movsb
|
||||||
@ -168,10 +174,28 @@ endl
|
|||||||
movsd ; Planes+BitCount
|
movsd ; Planes+BitCount
|
||||||
.decode:
|
.decode:
|
||||||
|
|
||||||
pop eax
|
pop edi
|
||||||
mov esi, [_length]
|
cmp [bIsIco], 0
|
||||||
sub esi, eax
|
jnz @f
|
||||||
|
mov edi, [_length]
|
||||||
|
add edi, sizeof.bmp.FileHeader
|
||||||
|
mov esi, [ebx - sizeof.bmp.FileHeader + bmp.FileHeader.OffBits]
|
||||||
|
jmp .offset_calculated
|
||||||
|
@@:
|
||||||
|
xor esi, esi
|
||||||
|
mov cl, byte [edi + bmp.Image.info.BitCount]
|
||||||
|
cmp cl, 8
|
||||||
|
ja @f
|
||||||
|
inc esi
|
||||||
|
add cl, 2
|
||||||
|
shl esi, cl
|
||||||
|
@@:
|
||||||
|
add esi, [edi + bmp.Image.info.Size]
|
||||||
|
mov edi, [_length]
|
||||||
|
.offset_calculated:
|
||||||
|
sub edi, esi
|
||||||
jbe .error.free
|
jbe .error.free
|
||||||
|
add esi, [_data]
|
||||||
|
|
||||||
mov eax, [edx + Image.Extended]
|
mov eax, [edx + Image.Extended]
|
||||||
mov eax, [eax + bmp.Image.info.Compression]
|
mov eax, [eax + bmp.Image.info.Compression]
|
||||||
@ -181,13 +205,13 @@ endl
|
|||||||
jmp .decoded
|
jmp .decoded
|
||||||
@@: cmp eax, bmp.BI_RLE8
|
@@: cmp eax, bmp.BI_RLE8
|
||||||
jne @f
|
jne @f
|
||||||
cmp [ebx + bmp.Header.info.BitCount], 8
|
cmp word [ebx + 14], 8 ;bmp.InfoHeader.BitCount
|
||||||
jnz .error.free
|
jnz .error.free
|
||||||
stdcall ._.rle
|
stdcall ._.rle
|
||||||
jmp .decoded
|
jmp .decoded
|
||||||
@@: cmp eax, bmp.BI_RLE4
|
@@: cmp eax, bmp.BI_RLE4
|
||||||
jne @f
|
jne @f
|
||||||
cmp [ebx + bmp.Header.info.BitCount], 4
|
cmp word [ebx + 14], 4
|
||||||
jnz .error.free
|
jnz .error.free
|
||||||
stdcall ._.rle
|
stdcall ._.rle
|
||||||
jmp .decoded
|
jmp .decoded
|
||||||
@ -218,6 +242,11 @@ endl
|
|||||||
stdcall img.flip, [img], FLIP_VERTICAL
|
stdcall img.flip, [img], FLIP_VERTICAL
|
||||||
@@:
|
@@:
|
||||||
mov eax, [img]
|
mov eax, [img]
|
||||||
|
mov ecx, [length_rest] ; return length for ICO code
|
||||||
|
cmp [bIsIco], 0
|
||||||
|
jz @f
|
||||||
|
mov [esp + 4], esi ; return pointer to end-of-data for ICO code
|
||||||
|
@@:
|
||||||
pop edi esi ebx
|
pop edi esi ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -228,7 +257,7 @@ endl
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.encode.bmp _img, _p_length ;/////////////////////////////////////////////////////////////;;
|
proc img.encode.bmp _img, _p_length, _options ;///////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Encode image into raw data in BMP format ;;
|
;? Encode image into raw data in BMP format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -263,7 +292,6 @@ proc img.decode.bmp._.rgb ;/////////////////////////////////////////////////////
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
mov ecx, [edx + Image.Extended]
|
mov ecx, [edx + Image.Extended]
|
||||||
mov [ecx + bmp.Image.info.AlphaMask], 0
|
mov [ecx + bmp.Image.info.AlphaMask], 0
|
||||||
mov edi, [edx + Image.Data]
|
|
||||||
|
|
||||||
movzx eax, [ecx + bmp.Image.info.BitCount]
|
movzx eax, [ecx + bmp.Image.info.BitCount]
|
||||||
cmp eax, 32
|
cmp eax, 32
|
||||||
@ -297,10 +325,10 @@ img.decode.bmp._.rgb.24bpp:
|
|||||||
and eax, not 3
|
and eax, not 3
|
||||||
mov ecx, [edx + Image.Height]
|
mov ecx, [edx + Image.Height]
|
||||||
imul eax, ecx
|
imul eax, ecx
|
||||||
cmp esi, eax
|
sub edi, eax
|
||||||
jb img.decode.bmp._.rgb.error
|
jb img.decode.bmp._.rgb.error
|
||||||
mov esi, ebx
|
mov [img.decode.bmp.length_rest], edi
|
||||||
add esi, [ebx + bmp.Header.file.OffBits]
|
mov edi, [edx + Image.Data]
|
||||||
|
|
||||||
.next_line:
|
.next_line:
|
||||||
push ecx edx
|
push ecx edx
|
||||||
@ -447,19 +475,20 @@ img.decode.bmp._.rgb.prepare_palette:
|
|||||||
and eax, not 3
|
and eax, not 3
|
||||||
mov ecx, [edx + Image.Height]
|
mov ecx, [edx + Image.Height]
|
||||||
imul eax, ecx
|
imul eax, ecx
|
||||||
cmp esi, eax
|
sub edi, eax
|
||||||
jb .ret
|
jb .ret
|
||||||
mov esi, [ebx + bmp.Header.info.Size]
|
mov [img.decode.bmp.length_rest], edi
|
||||||
add esi, sizeof.bmp.FileHeader
|
push esi
|
||||||
jc .ret
|
sub esi, ebx
|
||||||
mov eax, [ebx + bmp.Header.file.OffBits]
|
jc .ret.pop
|
||||||
sub eax, esi
|
sub esi, [ebx + bmp.InfoHeader.Size]
|
||||||
jc .ret
|
jc .ret.pop
|
||||||
push edi
|
mov eax, esi
|
||||||
mov edi, [edx + Image.Palette]
|
mov edi, [edx + Image.Palette]
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, 256
|
mov ecx, 256
|
||||||
cmp esi, sizeof.bmp.FileHeader + 12
|
mov esi, [ebx + bmp.InfoHeader.Size]
|
||||||
|
cmp esi, 12
|
||||||
jz .old
|
jz .old
|
||||||
shr eax, 2
|
shr eax, 2
|
||||||
add esi, ebx
|
add esi, ebx
|
||||||
@ -470,18 +499,21 @@ img.decode.bmp._.rgb.prepare_palette:
|
|||||||
rep movsd
|
rep movsd
|
||||||
jmp .common
|
jmp .common
|
||||||
.old:
|
.old:
|
||||||
|
add esi, ebx
|
||||||
|
@@:
|
||||||
movsd
|
movsd
|
||||||
dec esi
|
dec esi
|
||||||
sub eax, 3
|
sub eax, 3
|
||||||
jbe @f
|
jbe @f
|
||||||
sub ecx, 1
|
sub ecx, 1
|
||||||
jnz .old
|
jnz @b
|
||||||
@@:
|
@@:
|
||||||
.common:
|
.common:
|
||||||
pop ecx
|
pop ecx
|
||||||
pop edi
|
mov edi, [edx + Image.Data]
|
||||||
mov esi, ebx
|
clc
|
||||||
add esi, [ebx + bmp.Header.file.OffBits]
|
.ret.pop:
|
||||||
|
pop esi
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -507,15 +539,18 @@ endl
|
|||||||
|
|
||||||
mov [abs_mode_addr], .absolute_mode.rle8
|
mov [abs_mode_addr], .absolute_mode.rle8
|
||||||
mov [enc_mode_addr], .encoded_mode.rle8
|
mov [enc_mode_addr], .encoded_mode.rle8
|
||||||
cmp [ebx + bmp.Header.info.Compression], bmp.BI_RLE4
|
cmp [ebx + bmp.InfoHeader.Compression], bmp.BI_RLE4
|
||||||
jne @f
|
jne @f
|
||||||
mov [abs_mode_addr], .absolute_mode.rle4
|
mov [abs_mode_addr], .absolute_mode.rle4
|
||||||
mov [enc_mode_addr], .encoded_mode.rle4
|
mov [enc_mode_addr], .encoded_mode.rle4
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
push esi
|
push edi
|
||||||
xor eax, eax ; do not check file size in .prepare_palette
|
xor eax, eax ; do not check file size in .prepare_palette
|
||||||
|
push ebp
|
||||||
|
mov ebp, [ebp] ; set parent stack frame
|
||||||
call img.decode.bmp._.rgb.prepare_palette
|
call img.decode.bmp._.rgb.prepare_palette
|
||||||
|
pop ebp
|
||||||
pop ecx ; ecx = rest bytes in file
|
pop ecx ; ecx = rest bytes in file
|
||||||
jc .error
|
jc .error
|
||||||
|
|
||||||
@ -712,8 +747,6 @@ locals
|
|||||||
delta dd ?
|
delta dd ?
|
||||||
endl
|
endl
|
||||||
|
|
||||||
push edi
|
|
||||||
|
|
||||||
mov [delta], 4
|
mov [delta], 4
|
||||||
mov eax, [edx + Image.Extended]
|
mov eax, [edx + Image.Extended]
|
||||||
cmp [eax + bmp.Image.info.BitCount], 32
|
cmp [eax + bmp.Image.info.BitCount], 32
|
||||||
@ -725,9 +758,12 @@ endl
|
|||||||
mov ecx, [edx + Image.Width]
|
mov ecx, [edx + Image.Width]
|
||||||
imul ecx, [edx + Image.Height]
|
imul ecx, [edx + Image.Height]
|
||||||
imul ecx, [delta]
|
imul ecx, [delta]
|
||||||
cmp esi, ecx
|
sub edi, ecx
|
||||||
jb .error
|
jb .error
|
||||||
|
mov ecx, [ebp] ; use parent stack frame
|
||||||
|
mov [ecx + img.decode.bmp.length_rest - ebp], edi ; !
|
||||||
|
|
||||||
|
push esi
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
|
|
||||||
mov ecx, [esi + bmp.Image.info.RedMask]
|
mov ecx, [esi + bmp.Image.info.RedMask]
|
||||||
@ -759,8 +795,7 @@ endl
|
|||||||
mov [unshift.Alpha], al
|
mov [unshift.Alpha], al
|
||||||
|
|
||||||
mov edi, [edx + Image.Data]
|
mov edi, [edx + Image.Data]
|
||||||
mov esi, ebx
|
pop esi
|
||||||
add esi, [ebx + bmp.Header.file.OffBits]
|
|
||||||
|
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ proc img.is.gif _data, _length ;////////////////////////////////////////////////
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.decode.gif _data, _length ;//////////////////////////////////////////////////////////////;;
|
proc img.decode.gif _data, _length, _options ;////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Decode data into image if it contains correctly formed raw data in GIF format ;;
|
;? Decode data into image if it contains correctly formed raw data in GIF format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -86,6 +86,7 @@ locals
|
|||||||
cur_color_table_size dd ?
|
cur_color_table_size dd ?
|
||||||
transparent_color dd ?
|
transparent_color dd ?
|
||||||
background_color dd ?
|
background_color dd ?
|
||||||
|
options_bgr dd ?
|
||||||
prev_palette dd ?
|
prev_palette dd ?
|
||||||
aux_palette dd ?
|
aux_palette dd ?
|
||||||
img dd ?
|
img dd ?
|
||||||
@ -110,6 +111,7 @@ img.decode.gif._data equ _data
|
|||||||
img.decode.gif.aux_img_data equ aux_img_data
|
img.decode.gif.aux_img_data equ aux_img_data
|
||||||
img.decode.gif.aux_img_type equ aux_img_type
|
img.decode.gif.aux_img_type equ aux_img_type
|
||||||
img.decode.gif.aux_palette equ aux_palette
|
img.decode.gif.aux_palette equ aux_palette
|
||||||
|
img.decode.gif.options_bgr equ options_bgr
|
||||||
; offset of _length parameter for child functions with ebp-based frame
|
; offset of _length parameter for child functions with ebp-based frame
|
||||||
; child saved ebp, return address, 3 saved registers, 14 local variables
|
; child saved ebp, return address, 3 saved registers, 14 local variables
|
||||||
img.decode.gif._length_child equ _length + 4 + 4 + 4*3 + 4*14
|
img.decode.gif._length_child equ _length + 4 + 4 + 4*3 + 4*14
|
||||||
@ -130,8 +132,16 @@ img.decode.gif.cur_color_table_size_child equ ebp + 4 + 4 + 4*3 + 4
|
|||||||
mov [prev_num_colors], eax
|
mov [prev_num_colors], eax
|
||||||
lea eax, [background_color]
|
lea eax, [background_color]
|
||||||
mov [prev_palette], eax
|
mov [prev_palette], eax
|
||||||
; guard against incorrect gif files, which use Restore-To-Background disposal method, but do not define bgr color
|
; value for bgr color in transparent images
|
||||||
mov dword [eax], 0xFFFFFF
|
mov edx, 0xFFFFFF ; white bgr if no value given
|
||||||
|
mov ecx, [_options]
|
||||||
|
jecxz @f
|
||||||
|
cmp [ecx + ImageDecodeOptions.UsedSize], ImageDecodeOptions.BackgroundColor + 4
|
||||||
|
jb @f
|
||||||
|
mov edx, [ecx + ImageDecodeOptions.BackgroundColor]
|
||||||
|
@@:
|
||||||
|
mov [options_bgr], edx
|
||||||
|
mov dword [eax], edx
|
||||||
; guard against incorrect gif files without any color tables
|
; guard against incorrect gif files without any color tables
|
||||||
; "If no color table is available at
|
; "If no color table is available at
|
||||||
; all, the decoder is free to use a system color table or a table of its own. In
|
; all, the decoder is free to use a system color table or a table of its own. In
|
||||||
@ -790,22 +800,11 @@ proc img.decode.gif._.superimpose ;/////////////////////////////////////////////
|
|||||||
jnz .has_transparency
|
jnz .has_transparency
|
||||||
shl ecx, 2
|
shl ecx, 2
|
||||||
add ecx, [edx + Image.Palette]
|
add ecx, [edx + Image.Palette]
|
||||||
mov dword [background_color], 0xFFFFFF ; white background
|
push eax
|
||||||
mov dword [ecx], 0xFFFFFF
|
mov eax, [img.decode.gif.options_bgr]
|
||||||
; mov esi, [_data]
|
mov dword [background_color], eax
|
||||||
; test [esi+gif.Header.lsd.Packed], gif.LSD.Packed.GlobalColorTableFlag
|
mov dword [ecx], eax
|
||||||
; jz @f
|
pop eax
|
||||||
; movzx ecx, [esi+gif.Header.lsd.BackgroundColor]
|
|
||||||
; push ecx
|
|
||||||
; shl ecx, 2
|
|
||||||
; add ecx, [edx + Image.Palette]
|
|
||||||
; mov dword [ecx], 0xFFFFFF
|
|
||||||
; pop ecx
|
|
||||||
; lea ecx, [ecx*3]
|
|
||||||
; add esi, ecx
|
|
||||||
; mov byte [esi+sizeof.gif.Header+0], 0xFF
|
|
||||||
; mov byte [esi+sizeof.gif.Header+1], 0xFF
|
|
||||||
; mov byte [esi+sizeof.gif.Header+2], 0xFF
|
|
||||||
@@:
|
@@:
|
||||||
call img.decode.gif._.is_logical_screen
|
call img.decode.gif._.is_logical_screen
|
||||||
jnz .has_transparency
|
jnz .has_transparency
|
||||||
|
371
programs/develop/libraries/libs-dev/libimg/ico_cur/ico_cur.asm
Normal file
371
programs/develop/libraries/libs-dev/libimg/ico_cur/ico_cur.asm
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
;;================================================================================================;;
|
||||||
|
;;//// ico.asm //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ///////////////////////////////////;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
;; ;;
|
||||||
|
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||||
|
;; ;;
|
||||||
|
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
|
||||||
|
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
|
||||||
|
;; of the License, or (at your option) any later version. ;;
|
||||||
|
;; ;;
|
||||||
|
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
|
||||||
|
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
|
||||||
|
;; Lesser General Public License for more details. ;;
|
||||||
|
;; ;;
|
||||||
|
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev. ;;
|
||||||
|
;; If not, see <http://www.gnu.org/licenses/>. ;;
|
||||||
|
;; ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
;; ;;
|
||||||
|
;; References: ;;
|
||||||
|
;; 1. "Icons in Win32" ;;
|
||||||
|
;; by John Hornick, Microsoft Corporation ;;
|
||||||
|
;; http://msdn2.microsoft.com/en-us/library/ms997538.aspx ;;
|
||||||
|
;; ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
|
||||||
|
include 'ico_cur.inc'
|
||||||
|
|
||||||
|
;;================================================================================================;;
|
||||||
|
;;proc img.is.ico _data, _length ;////////////////////////////////////////////////////////////////;;
|
||||||
|
img.is.ico:
|
||||||
|
mov edx, 0x00010000 ; icon type = 1
|
||||||
|
jmp @f
|
||||||
|
img.is.cur:
|
||||||
|
mov edx, 0x00020000 ; cursor type = 2
|
||||||
|
@@:
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;? Determine if raw data could be decoded (is in ICO format) ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;> _data = raw data as read from file/stream ;;
|
||||||
|
;> _length = data length ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;< eax = false / true ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
; test 1 (length of data): data must contain FileHeader
|
||||||
|
mov ecx, [esp+8]
|
||||||
|
sub ecx, sizeof.ico.FileHeader
|
||||||
|
jb .nope
|
||||||
|
; test 2: signature
|
||||||
|
mov eax, [esp+4]
|
||||||
|
cmp dword [eax], edx ; Reserved & Type
|
||||||
|
jne .nope
|
||||||
|
; test 3: count must be non-zero
|
||||||
|
movzx eax, [eax + ico.FileHeader.Count]
|
||||||
|
test eax, eax
|
||||||
|
jz .nope
|
||||||
|
; test 4 (length of data): data must containt Count dir entries
|
||||||
|
shl eax, 4
|
||||||
|
sub ecx, eax
|
||||||
|
jae .yep
|
||||||
|
|
||||||
|
.nope:
|
||||||
|
xor eax, eax
|
||||||
|
ret 8
|
||||||
|
|
||||||
|
.yep:
|
||||||
|
xor eax, eax
|
||||||
|
inc eax
|
||||||
|
ret 8
|
||||||
|
;endp
|
||||||
|
|
||||||
|
;;================================================================================================;;
|
||||||
|
proc img.decode.ico_cur _data, _length, _options ;////////////////////////////////////////////////;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;? Decode data into image if it contains correctly formed raw data in ICO/CUR format ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;> _data = raw data as read from file/stream ;;
|
||||||
|
;> _length = data length ;;
|
||||||
|
;> _options = options for decoding (e.g. background color) ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;< eax = 0 (error) or pointer to image ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
locals
|
||||||
|
count dd ?
|
||||||
|
img dd ?
|
||||||
|
main_img dd ?
|
||||||
|
endl
|
||||||
|
|
||||||
|
push ebx esi edi
|
||||||
|
|
||||||
|
; img.is.ico has been already called by img.decode
|
||||||
|
; stdcall img.is.ico, [_data], [_length]
|
||||||
|
; or eax, eax
|
||||||
|
; jz .error
|
||||||
|
|
||||||
|
mov ebx, [_data]
|
||||||
|
movzx eax, [ebx + ico.FileHeader.Count]
|
||||||
|
mov [count], eax
|
||||||
|
and [img], 0
|
||||||
|
and [main_img], 0
|
||||||
|
.loop:
|
||||||
|
mov ecx, [ebx + sizeof.ico.FileHeader + ico.DirEntry.ByteSize]
|
||||||
|
mov edx, [ebx + sizeof.ico.FileHeader + ico.DirEntry.ImageOffset]
|
||||||
|
mov eax, [_length]
|
||||||
|
sub eax, edx
|
||||||
|
jb .skip
|
||||||
|
cmp eax, ecx
|
||||||
|
jb .skip
|
||||||
|
cmp ecx, 12 ; length test, see img.is.bmp
|
||||||
|
jb .skip
|
||||||
|
add edx, [_data]
|
||||||
|
push [_options]
|
||||||
|
push ecx
|
||||||
|
push edx
|
||||||
|
call img.decode.ico._.decode_icon_data
|
||||||
|
test eax, eax
|
||||||
|
jz .skip
|
||||||
|
push 0xFFFFFF ; set bgr to white if no given
|
||||||
|
mov edx, [_options]
|
||||||
|
test edx, edx
|
||||||
|
jz @f
|
||||||
|
cmp [edx + ImageDecodeOptions.UsedSize], ImageDecodeOptions.BackgroundColor + 4
|
||||||
|
jb @f
|
||||||
|
add esp, 4
|
||||||
|
push [edx + ImageDecodeOptions.BackgroundColor]
|
||||||
|
@@:
|
||||||
|
call img.decode.ico._.decode_icon_mask
|
||||||
|
test eax, eax
|
||||||
|
jz .skip
|
||||||
|
mov edx, [img]
|
||||||
|
test edx, edx
|
||||||
|
jz .first
|
||||||
|
mov [edx + Image.Next], eax
|
||||||
|
mov [eax + Image.Previous], edx
|
||||||
|
jmp @f
|
||||||
|
.first:
|
||||||
|
mov [main_img], eax
|
||||||
|
@@:
|
||||||
|
mov [img], eax
|
||||||
|
.skip:
|
||||||
|
add ebx, sizeof.ico.DirEntry
|
||||||
|
dec [count]
|
||||||
|
jnz .loop
|
||||||
|
|
||||||
|
mov eax, [main_img]
|
||||||
|
pop edi esi ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
;;================================================================================================;;
|
||||||
|
img.encode.cur:
|
||||||
|
proc img.encode.ico _img, _p_length, _options ;///////////////////////////////////////////////////;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;? Encode image into raw data in ICO format ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;> _img = pointer to image ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;< eax = 0 (error) or pointer to encoded data ;;
|
||||||
|
;< _p_length = encoded data length ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
;;================================================================================================;;
|
||||||
|
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
;! Below are private procs you should never call directly from your code ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
|
||||||
|
img.decode.ico._.decode_icon_data:
|
||||||
|
; create stack frame and jump to common BMP+ICO code
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
sub esp, 12
|
||||||
|
mov byte [ebp - 3], 1 ; bIsIco
|
||||||
|
jmp img.decode.bmp.common
|
||||||
|
|
||||||
|
img.decode.ico._.decode_icon_mask:
|
||||||
|
mov edx, [eax + Image.Width]
|
||||||
|
add edx, 31
|
||||||
|
shr edx, 3
|
||||||
|
and edx, not 3
|
||||||
|
push edx
|
||||||
|
imul edx, [eax + Image.Height]
|
||||||
|
cmp ecx, edx
|
||||||
|
pop edx
|
||||||
|
jb .error.free
|
||||||
|
mov edi, [eax + Image.Data]
|
||||||
|
push ebp ebx eax
|
||||||
|
xor ebp, ebp
|
||||||
|
mov ebx, [eax + Image.Extended]
|
||||||
|
cmp [ebx + bmp.Image.info.Height], 0
|
||||||
|
js @f
|
||||||
|
push edx
|
||||||
|
imul edx, [eax + Image.Height]
|
||||||
|
add esi, edx
|
||||||
|
pop edx
|
||||||
|
lea ebp, [edx+edx]
|
||||||
|
sub esi, edx
|
||||||
|
@@:
|
||||||
|
mov ebx, [eax + Image.Height]
|
||||||
|
mov ecx, [eax + Image.Width]
|
||||||
|
; for now, BMP code produces only 8 and 32 bpp images
|
||||||
|
cmp [eax + Image.Type], Image.bpp8
|
||||||
|
jz .bpp8
|
||||||
|
.bpp32:
|
||||||
|
mov edx, [esp+16] ; get background color
|
||||||
|
.bpp32.extloop:
|
||||||
|
push ecx
|
||||||
|
.bpp32.innloop:
|
||||||
|
lodsd
|
||||||
|
bswap eax
|
||||||
|
push 32
|
||||||
|
.bpp32.dwordloop:
|
||||||
|
add eax, eax
|
||||||
|
jnc @f
|
||||||
|
mov [edi], edx
|
||||||
|
@@:
|
||||||
|
add edi, 4
|
||||||
|
dec ecx
|
||||||
|
jz @f
|
||||||
|
dec dword [esp]
|
||||||
|
jnz .bpp32.dwordloop
|
||||||
|
@@:
|
||||||
|
pop eax
|
||||||
|
test ecx, ecx
|
||||||
|
jnz .bpp32.innloop
|
||||||
|
sub esi, ebp
|
||||||
|
pop ecx
|
||||||
|
dec ebx
|
||||||
|
jnz .bpp32.extloop
|
||||||
|
pop eax ebx ebp
|
||||||
|
ret 4
|
||||||
|
.bpp8:
|
||||||
|
push edi
|
||||||
|
mov edi, [eax + Image.Palette]
|
||||||
|
mov eax, [esp+20] ; get background color
|
||||||
|
; if palette already has index for bgr color, use it
|
||||||
|
push ecx
|
||||||
|
mov ecx, 256
|
||||||
|
repnz scasd
|
||||||
|
jnz .bpp8.notfound
|
||||||
|
not cl ; cl = index
|
||||||
|
pop edx
|
||||||
|
pop edi
|
||||||
|
.bpp8.extloop:
|
||||||
|
push edx
|
||||||
|
.bpp8.innloop:
|
||||||
|
lodsd
|
||||||
|
bswap eax
|
||||||
|
push 32
|
||||||
|
.bpp8.dwordloop:
|
||||||
|
add eax, eax
|
||||||
|
jnc @f
|
||||||
|
mov [edi], cl
|
||||||
|
@@:
|
||||||
|
inc edi
|
||||||
|
dec edx
|
||||||
|
jz @f
|
||||||
|
dec dword [esp]
|
||||||
|
jnz .bpp8.dwordloop
|
||||||
|
@@:
|
||||||
|
pop eax
|
||||||
|
test edx, edx
|
||||||
|
jnz .bpp8.innloop
|
||||||
|
sub esi, ebp
|
||||||
|
pop edx
|
||||||
|
dec ebx
|
||||||
|
jnz .bpp8.extloop
|
||||||
|
pop eax ebx ebp
|
||||||
|
ret 4
|
||||||
|
.bpp8.notfound:
|
||||||
|
; get maximum used color; if index < 255, then we can add one color to palette
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop eax
|
||||||
|
mov edx, [eax + Image.Width]
|
||||||
|
imul edx, ebx
|
||||||
|
mov edi, [eax + Image.Data]
|
||||||
|
xor ecx, ecx
|
||||||
|
.bpp8.scanloop:
|
||||||
|
cmp [edi], cl
|
||||||
|
jb @f
|
||||||
|
mov cl, [edi]
|
||||||
|
@@:
|
||||||
|
inc edi
|
||||||
|
dec edx
|
||||||
|
jnz .bpp8.scanloop
|
||||||
|
inc cl
|
||||||
|
jz .bpp8.nospace
|
||||||
|
mov edx, [esp+8]
|
||||||
|
mov edi, [eax + Image.Palette]
|
||||||
|
mov [edi+ecx*4], edx ; set palette color
|
||||||
|
mov edi, [eax + Image.Data]
|
||||||
|
mov edx, [eax + Image.Width]
|
||||||
|
push eax
|
||||||
|
jmp .bpp8.extloop
|
||||||
|
.bpp8.nospace:
|
||||||
|
; convert to 24 bpp
|
||||||
|
mov edx, [eax + Image.Width]
|
||||||
|
imul edx, ebx
|
||||||
|
lea edx, [edx*3]
|
||||||
|
push eax
|
||||||
|
invoke mem.alloc, edx
|
||||||
|
mov edi, eax
|
||||||
|
pop eax
|
||||||
|
test edi, edi
|
||||||
|
jz .error.free2
|
||||||
|
push eax esi edi
|
||||||
|
mov esi, eax
|
||||||
|
call img._.do_rgb
|
||||||
|
pop edi esi eax
|
||||||
|
xchg edi, [eax + Image.Data]
|
||||||
|
mov byte [eax + Image.Type], Image.bpp24
|
||||||
|
push eax
|
||||||
|
invoke mem.free, edi
|
||||||
|
pop eax
|
||||||
|
push eax
|
||||||
|
mov ecx, [eax + Image.Width]
|
||||||
|
.bpp24:
|
||||||
|
mov edx, [esp+16] ; get background color
|
||||||
|
.bpp24.extloop:
|
||||||
|
push ecx
|
||||||
|
.bpp24.innloop:
|
||||||
|
lodsd
|
||||||
|
bswap eax
|
||||||
|
push 32
|
||||||
|
.bpp24.dwordloop:
|
||||||
|
add eax, eax
|
||||||
|
jnc @f
|
||||||
|
mov [edi], dx
|
||||||
|
ror edx, 16
|
||||||
|
mov [edi+2], dl
|
||||||
|
ror edx, 16
|
||||||
|
@@:
|
||||||
|
add edi, 4
|
||||||
|
dec ecx
|
||||||
|
jz @f
|
||||||
|
dec dword [esp]
|
||||||
|
jnz .bpp24.dwordloop
|
||||||
|
@@:
|
||||||
|
pop eax
|
||||||
|
test ecx, ecx
|
||||||
|
jnz .bpp24.innloop
|
||||||
|
sub esi, ebp
|
||||||
|
pop ecx
|
||||||
|
dec ebx
|
||||||
|
jnz .bpp24.extloop
|
||||||
|
pop eax ebx ebp
|
||||||
|
ret 4
|
||||||
|
.error.free2:
|
||||||
|
pop ebx ebp
|
||||||
|
.error.free:
|
||||||
|
stdcall img._.delete, eax
|
||||||
|
xor eax, eax
|
||||||
|
ret 4
|
||||||
|
|
||||||
|
;;================================================================================================;;
|
||||||
|
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
;! Below is private data you should never use directly from your code ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
|
||||||
|
|
||||||
|
;
|
@ -1,5 +1,5 @@
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;;//// ico.asm //// (c) mike.dld, 2007-2008 //////////////////////////////////////////////////////;;
|
;;//// ico.inc //// (c) diamond, 2009 ////////////////////////////////////////////////////////////;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; This file is part of Common development libraries (Libs-Dev). ;;
|
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||||
@ -16,10 +16,31 @@
|
|||||||
;; If not, see <http://www.gnu.org/licenses/>. ;;
|
;; If not, see <http://www.gnu.org/licenses/>. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;; ;;
|
|
||||||
;; References: ;;
|
struct ico.FileHeader
|
||||||
;; 1. "Icons in Win32" ;;
|
Reserved dw ? ; must be 0
|
||||||
;; by John Hornick, Microsoft Corporation ;;
|
Type dw ? ; must be 1
|
||||||
;; http://msdn2.microsoft.com/en-us/library/ms997538.aspx ;;
|
Count dw ?
|
||||||
;; ;;
|
ends
|
||||||
;;================================================================================================;;
|
|
||||||
|
struct ico.DirEntry
|
||||||
|
Width db ?
|
||||||
|
Height db ?
|
||||||
|
ColorCount db ?
|
||||||
|
db ? ; reseved
|
||||||
|
dw ? ; reserved
|
||||||
|
dw ? ; reserved
|
||||||
|
ByteSize dd ?
|
||||||
|
ImageOffset dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct cur.DirEntry
|
||||||
|
Width db ?
|
||||||
|
Height db ?
|
||||||
|
ColorCount db ?
|
||||||
|
db ? ; reserved
|
||||||
|
XHotSpot dw ?
|
||||||
|
YHotSpot dw ?
|
||||||
|
ByteSize dd ?
|
||||||
|
ImageOffset dd ?
|
||||||
|
ends
|
@ -69,7 +69,7 @@ img.decode.jpg:
|
|||||||
.ret:
|
.ret:
|
||||||
mov [esp+28], eax
|
mov [esp+28], eax
|
||||||
popad
|
popad
|
||||||
ret 8
|
ret 12
|
||||||
.soi_ok:
|
.soi_ok:
|
||||||
mov [ebx + jpeg.work.restart_interval], ecx
|
mov [ebx + jpeg.work.restart_interval], ecx
|
||||||
mov [ebx + jpeg.work.adobe_ycck], cl
|
mov [ebx + jpeg.work.adobe_ycck], cl
|
||||||
|
@ -37,6 +37,7 @@ include 'jpeg/jpeg.asm'
|
|||||||
include 'png/png.asm'
|
include 'png/png.asm'
|
||||||
include 'tga/tga.asm'
|
include 'tga/tga.asm'
|
||||||
include 'z80/z80.asm'
|
include 'z80/z80.asm'
|
||||||
|
include 'ico_cur/ico_cur.asm'
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
|
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
|
||||||
@ -496,7 +497,7 @@ align 16
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.decode _data, _length ;//////////////////////////////////////////////////////////////////;;
|
proc img.decode _data, _length, _options ;////////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? --- TBD --- ;;
|
;? --- TBD --- ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -510,17 +511,18 @@ proc img.decode _data, _length ;////////////////////////////////////////////////
|
|||||||
or eax, eax
|
or eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
add ebx, sizeof.FormatsTableEntry
|
add ebx, sizeof.FormatsTableEntry
|
||||||
cmp dword[ebx], 0
|
cmp dword[ebx], eax ;0
|
||||||
jnz @b
|
jnz @b
|
||||||
jmp .error
|
pop ebx
|
||||||
@@: stdcall [ebx + FormatsTableEntry.Decode], [_data], [_length]
|
|
||||||
|
|
||||||
.error:
|
|
||||||
ret
|
ret
|
||||||
|
@@: mov eax, [ebx + FormatsTableEntry.Decode]
|
||||||
|
pop ebx
|
||||||
|
leave
|
||||||
|
jmp eax
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.encode _img, _p_length ;/////////////////////////////////////////////////////////////////;;
|
proc img.encode _img, _p_length, _options ;///////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? --- TBD --- ;;
|
;? --- TBD --- ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -1667,8 +1669,8 @@ img._.get_scanline_len: ;///////////////////////////////////////////////////////
|
|||||||
align 4
|
align 4
|
||||||
img._.formats_table:
|
img._.formats_table:
|
||||||
.bmp dd img.is.bmp, img.decode.bmp, img.encode.bmp
|
.bmp dd img.is.bmp, img.decode.bmp, img.encode.bmp
|
||||||
; .ico dd img.is.ico, img.decode.ico, img.encode.ico
|
.ico dd img.is.ico, img.decode.ico_cur, img.encode.ico
|
||||||
; .cur dd img.is.cur, img.decode.cur, img.encode.cur
|
.cur dd img.is.cur, img.decode.ico_cur, img.encode.cur
|
||||||
.gif dd img.is.gif, img.decode.gif, img.encode.gif
|
.gif dd img.is.gif, img.decode.gif, img.encode.gif
|
||||||
.png dd img.is.png, img.decode.png, img.encode.png
|
.png dd img.is.png, img.decode.png, img.encode.png
|
||||||
.jpg dd img.is.jpg, img.decode.jpg, img.encode.jpg
|
.jpg dd img.is.jpg, img.decode.jpg, img.encode.jpg
|
||||||
@ -1707,35 +1709,35 @@ align 4
|
|||||||
|
|
||||||
export \
|
export \
|
||||||
lib_init , 'lib_init' , \
|
lib_init , 'lib_init' , \
|
||||||
0x00010004 , 'version' , \
|
0x00050005 , 'version' , \
|
||||||
img.is_img , 'img.is_img' , \
|
img.is_img , 'img_is_img' , \
|
||||||
img.info , 'img.info' , \
|
img.info , 'img_info' , \
|
||||||
img.from_file , 'img.from_file' , \
|
img.from_file , 'img_from_file' , \
|
||||||
img.to_file , 'img.to_file' , \
|
img.to_file , 'img_to_file' , \
|
||||||
img.from_rgb , 'img.from_rgb' , \
|
img.from_rgb , 'img_from_rgb' , \
|
||||||
img.to_rgb , 'img.to_rgb' , \
|
img.to_rgb , 'img_to_rgb' , \
|
||||||
img.to_rgb2 , 'img.to_rgb2' , \
|
img.to_rgb2 , 'img_to_rgb2' , \
|
||||||
img.decode , 'img.decode' , \
|
img.decode , 'img_decode' , \
|
||||||
img.encode , 'img.encode' , \
|
img.encode , 'img_encode' , \
|
||||||
img.create , 'img.create' , \
|
img.create , 'img_create' , \
|
||||||
img.destroy , 'img.destroy' , \
|
img.destroy , 'img_destroy' , \
|
||||||
img.destroy.layer, 'img.destroy.layer', \
|
img.destroy.layer, 'img_destroy_layer', \
|
||||||
img.count , 'img.count' , \
|
img.count , 'img_count' , \
|
||||||
img.lock_bits , 'img.lock_bits' , \
|
img.lock_bits , 'img_lock_bits' , \
|
||||||
img.unlock_bits , 'img.unlock_bits' , \
|
img.unlock_bits , 'img_unlock_bits' , \
|
||||||
img.flip , 'img.flip' , \
|
img.flip , 'img_flip' , \
|
||||||
img.flip.layer , 'img.flip.layer' , \
|
img.flip.layer , 'img_flip_layer' , \
|
||||||
img.rotate , 'img.rotate' , \
|
img.rotate , 'img_rotate' , \
|
||||||
img.rotate.layer, 'img.rotate.layer', \
|
img.rotate.layer, 'img_rotate_layer', \
|
||||||
img.draw , 'img.draw'
|
img.draw , 'img_draw'
|
||||||
|
|
||||||
; import from deflate unpacker
|
; import from deflate unpacker
|
||||||
; is initialized only when PNG loading is requested
|
; is initialized only when PNG loading is requested
|
||||||
align 4
|
align 4
|
||||||
@IMPORT:
|
@IMPORT:
|
||||||
|
|
||||||
library kfar_arc, '../File Managers/kfar_arc.obj'
|
library archiver, 'archiver.obj'
|
||||||
import kfar_arc, \
|
import archiver, \
|
||||||
deflate_unpack2, 'deflate_unpack2'
|
deflate_unpack2, 'deflate_unpack2'
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
@ -49,6 +49,11 @@ Image.bpp16 = 5
|
|||||||
; bits in Image.Flags
|
; bits in Image.Flags
|
||||||
Image.IsAnimated = 1
|
Image.IsAnimated = 1
|
||||||
|
|
||||||
|
struct ImageDecodeOptions
|
||||||
|
UsedSize dd ? ; if >=8, the field BackgroundColor is valid, and so on
|
||||||
|
BackgroundColor dd ? ; used for transparent images as background
|
||||||
|
ends
|
||||||
|
|
||||||
FLIP_VERTICAL = 0x01
|
FLIP_VERTICAL = 0x01
|
||||||
FLIP_HORIZONTAL = 0x02
|
FLIP_HORIZONTAL = 0x02
|
||||||
FLIP_BOTH = FLIP_VERTICAL or FLIP_HORIZONTAL
|
FLIP_BOTH = FLIP_VERTICAL or FLIP_HORIZONTAL
|
||||||
|
@ -49,7 +49,7 @@ img.is.png:
|
|||||||
;endp
|
;endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;;proc img.decode.png _data, _length ;////////////////////////////////////////////////////////////;;
|
;;proc img.decode.png _data, _length, _options ;//////////////////////////////////////////////////;;
|
||||||
img.decode.png:
|
img.decode.png:
|
||||||
xor eax, eax ; .image = 0
|
xor eax, eax ; .image = 0
|
||||||
pushad
|
pushad
|
||||||
@ -76,6 +76,7 @@ virtual at ebp - .localsize
|
|||||||
rd 1
|
rd 1
|
||||||
.data dd ?
|
.data dd ?
|
||||||
.length dd ?
|
.length dd ?
|
||||||
|
.options dd ?
|
||||||
end virtual
|
end virtual
|
||||||
push 0 ; .idat_read = 0
|
push 0 ; .idat_read = 0
|
||||||
sub esp, .localsize-4
|
sub esp, .localsize-4
|
||||||
@ -99,7 +100,7 @@ end virtual
|
|||||||
add esp, .localsize
|
add esp, .localsize
|
||||||
popad
|
popad
|
||||||
mov [deflate_loader_mutex], eax
|
mov [deflate_loader_mutex], eax
|
||||||
ret
|
ret 12
|
||||||
.deflate_loaded:
|
.deflate_loaded:
|
||||||
; release mutex
|
; release mutex
|
||||||
mov [deflate_loader_mutex], 0
|
mov [deflate_loader_mutex], 0
|
||||||
@ -229,7 +230,7 @@ end virtual
|
|||||||
.eof:
|
.eof:
|
||||||
add esp, .localsize
|
add esp, .localsize
|
||||||
popad
|
popad
|
||||||
ret
|
ret 12
|
||||||
; PLTE chunk
|
; PLTE chunk
|
||||||
.palette:
|
.palette:
|
||||||
mov eax, [.image]
|
mov eax, [.image]
|
||||||
@ -876,4 +877,4 @@ end repeat
|
|||||||
|
|
||||||
img.encode.png:
|
img.encode.png:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret 8
|
ret 12
|
||||||
|
@ -78,7 +78,7 @@ proc img.is.tga _data, _length ;////////////////////////////////////////////////
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.decode.tga _data, _length ;//////////////////////////////////////////////////////////////;;
|
proc img.decode.tga _data, _length, _options ;////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Decode data into image if it contains correctly formed raw data in Targa format ;;
|
;? Decode data into image if it contains correctly formed raw data in Targa format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -217,7 +217,7 @@ endl
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.encode.tga _img, _p_length ;/////////////////////////////////////////////////////////////;;
|
proc img.encode.tga _img, _p_length, _options ;///////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Encode image into raw data in Targa format ;;
|
;? Encode image into raw data in Targa format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
@ -45,7 +45,7 @@ proc img.is.z80 _data, _length ;////////////////////////////////////////////////
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.decode.z80 _data, _length ;//////////////////////////////////////////////////////////////;;
|
proc img.decode.z80 _data, _length, _options ;////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Decode data into image if it contains correctly formed raw data in z80 screen format ;;
|
;? Decode data into image if it contains correctly formed raw data in z80 screen format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -209,7 +209,7 @@ img.decode.z80.failed:
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.encode.z80 _img, _p_length ;/////////////////////////////////////////////////////////////;;
|
proc img.encode.z80 _img, _p_length, _options ;///////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? Encode image into raw data in z80 screen format ;;
|
;? Encode image into raw data in z80 screen format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
@ -674,15 +674,15 @@ library \
|
|||||||
libio , 'libio.obj'
|
libio , 'libio.obj'
|
||||||
|
|
||||||
import libio , \
|
import libio , \
|
||||||
file.size , 'file.size' , \
|
file.size , 'file_size' , \
|
||||||
file.open , 'file.open' , \
|
file.open , 'file_open' , \
|
||||||
file.read , 'file.read' , \
|
file.read , 'file_read' , \
|
||||||
file.write , 'file.write' , \
|
file.write , 'file_write' , \
|
||||||
file.seek , 'file.seek' , \
|
file.seek , 'file_seek' , \
|
||||||
file.eof? , 'file.eof?' , \
|
file.eof? , 'file_iseof' , \
|
||||||
file.seteof , 'file.seteof' , \
|
file.seteof , 'file_seteof' , \
|
||||||
file.tell , 'file.tell' , \
|
file.tell , 'file_tell' , \
|
||||||
file.close , 'file.close'
|
file.close , 'file_close'
|
||||||
|
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
@ -699,12 +699,12 @@ align 16
|
|||||||
|
|
||||||
export \
|
export \
|
||||||
libini._.init , 'lib_init' , \
|
libini._.init , 'lib_init' , \
|
||||||
0x00040007 , 'version' , \
|
0x00080008 , 'version' , \
|
||||||
ini.enum_sections , 'ini.enum_sections' , \
|
ini.enum_sections , 'ini_enum_sections' , \
|
||||||
ini.enum_keys , 'ini.enum_keys' , \
|
ini.enum_keys , 'ini_enum_keys' , \
|
||||||
ini.get_str , 'ini.get_str' , \
|
ini.get_str , 'ini_get_str' , \
|
||||||
ini.get_int , 'ini.get_int' , \
|
ini.get_int , 'ini_get_int' , \
|
||||||
ini.get_color , 'ini.get_color' , \
|
ini.get_color , 'ini_get_color' , \
|
||||||
ini.set_str , 'ini.set_str' , \
|
ini.set_str , 'ini_set_str' , \
|
||||||
ini.set_int , 'ini.set_int' , \
|
ini.set_int , 'ini_set_int' , \
|
||||||
ini.set_color , 'ini.set_color'
|
ini.set_color , 'ini_set_color'
|
||||||
|
@ -534,17 +534,17 @@ align 16
|
|||||||
|
|
||||||
export \
|
export \
|
||||||
libio._.init , 'lib_init' , \
|
libio._.init , 'lib_init' , \
|
||||||
0x00030003 , 'version' , \
|
0x00040004 , 'version' , \
|
||||||
file.find_first , 'file.find_first' , \
|
file.find_first , 'file_find_first' , \
|
||||||
file.find_next , 'file.find_next' , \
|
file.find_next , 'file_find_next' , \
|
||||||
file.find_close , 'file.find_close' , \
|
file.find_close , 'file_find_close' , \
|
||||||
file.size , 'file.size' , \
|
file.size , 'file_size' , \
|
||||||
file.open , 'file.open' , \
|
file.open , 'file_open' , \
|
||||||
file.read , 'file.read' , \
|
file.read , 'file_read' , \
|
||||||
file.write , 'file.write' , \
|
file.write , 'file_write' , \
|
||||||
file.seek , 'file.seek' , \
|
file.seek , 'file_seek' , \
|
||||||
file.tell , 'file.tell' , \
|
file.tell , 'file_tell' , \
|
||||||
file.eof? , 'file.eof?' , \
|
file.eof? , 'file_iseof' , \
|
||||||
file.seteof , 'file.seteof' , \
|
file.seteof , 'file_seteof' , \
|
||||||
file.truncate , 'file.truncate' , \
|
file.truncate , 'file_truncate' , \
|
||||||
file.close , 'file.close'
|
file.close , 'file_close'
|
||||||
|
@ -528,44 +528,44 @@ library \
|
|||||||
libgfx,'libgfx.obj'
|
libgfx,'libgfx.obj'
|
||||||
|
|
||||||
import libini, \
|
import libini, \
|
||||||
ini.get_str ,'ini.get_str',\
|
ini.get_str ,'ini_get_str',\
|
||||||
ini.set_str ,'ini.set_str',\
|
ini.set_str ,'ini_set_str',\
|
||||||
ini.get_int ,'ini.get_int',\
|
ini.get_int ,'ini_get_int',\
|
||||||
ini.set_int ,'ini.set_int',\
|
ini.set_int ,'ini_set_int',\
|
||||||
ini.get_color,'ini.get_color',\
|
ini.get_color,'ini_get_color',\
|
||||||
ini.set_color,'ini.set_color'
|
ini.set_color,'ini_set_color'
|
||||||
|
|
||||||
import libio, \
|
import libio, \
|
||||||
file.find_first,'file.find_first',\
|
file.find_first,'file_find_first',\
|
||||||
file.find_next ,'file.find_next',\
|
file.find_next ,'file_find_next',\
|
||||||
file.find_close,'file.find_close',\
|
file.find_close,'file_find_close',\
|
||||||
file.size ,'file.size',\
|
file.size ,'file_size',\
|
||||||
file.open ,'file.open',\
|
file.open ,'file_open',\
|
||||||
file.read ,'file.read',\
|
file.read ,'file_read',\
|
||||||
file.write ,'file.write',\
|
file.write ,'file_write',\
|
||||||
file.seek ,'file.seek',\
|
file.seek ,'file_seek',\
|
||||||
file.tell ,'file.tell',\
|
file.tell ,'file_tell',\
|
||||||
file.eof? ,'file.eof?',\
|
file.eof? ,'file_iseof',\
|
||||||
file.truncate ,'file.truncate',\
|
file.truncate ,'file_truncate',\
|
||||||
file.close ,'file.close'
|
file.close ,'file_close'
|
||||||
|
|
||||||
import libgfx, \
|
import libgfx, \
|
||||||
gfx.open ,'gfx.open',\
|
gfx.open ,'gfx_open',\
|
||||||
gfx.close ,'gfx.close',\
|
gfx.close ,'gfx_close',\
|
||||||
gfx.pen.color ,'gfx.pen.color',\
|
gfx.pen.color ,'gfx_pen_color',\
|
||||||
gfx.brush.color ,'gfx.brush.color',\
|
gfx.brush.color ,'gfx_brush_color',\
|
||||||
gfx.pixel ,'gfx.pixel',\
|
gfx.pixel ,'gfx_pixel',\
|
||||||
gfx.move.to ,'gfx.move.to',\
|
gfx.move.to ,'gfx_move_to',\
|
||||||
gfx.line.to ,'gfx.line.to',\
|
gfx.line.to ,'gfx_line_to',\
|
||||||
gfx.line ,'gfx.line',\
|
gfx.line ,'gfx_line',\
|
||||||
gfx.polyline ,'gfx.polyline',\
|
gfx.polyline ,'gfx_polyline',\
|
||||||
gfx.polyline.to ,'gfx.polyline.to',\
|
gfx.polyline.to ,'gfx_polyline_to',\
|
||||||
gfx.fillrect ,'gfx.fillrect',\
|
gfx.fillrect ,'gfx_fillrect',\
|
||||||
gfx.fillrect.ex ,'gfx.fillrect.ex',\
|
gfx.fillrect.ex ,'gfx_fillrect_ex',\
|
||||||
gfx.framerect ,'gfx.framerect',\
|
gfx.framerect ,'gfx_framerect',\
|
||||||
gfx.framerect.ex,'gfx.framerect.ex',\
|
gfx.framerect.ex,'gfx_framerect_ex',\
|
||||||
gfx.rectangle ,'gfx.rectangle',\
|
gfx.rectangle ,'gfx_rectangle',\
|
||||||
gfx.rectangle.ex,'gfx.rectangle.ex'
|
gfx.rectangle.ex,'gfx_rectangle_ex'
|
||||||
|
|
||||||
TINYPAD_END: ; end of file
|
TINYPAD_END: ; end of file
|
||||||
|
|
||||||
|
@ -160,8 +160,8 @@ start:
|
|||||||
; load libini.obj and kfar.ini
|
; load libini.obj and kfar.ini
|
||||||
mov eax, libini_name
|
mov eax, libini_name
|
||||||
mov esi, ini_import
|
mov esi, ini_import
|
||||||
push 6
|
push 8
|
||||||
pop ebp ; we use version 6 of libini
|
pop ebp ; we use version 8 of libini
|
||||||
call load_dll_and_import
|
call load_dll_and_import
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .noini
|
jnz .noini
|
||||||
@ -8343,10 +8343,10 @@ standard_dll_path_size = $ - standard_dll_path
|
|||||||
aStart db 'START',0
|
aStart db 'START',0
|
||||||
aLibInit db 'lib_init',0
|
aLibInit db 'lib_init',0
|
||||||
aVersion db 'version',0
|
aVersion db 'version',0
|
||||||
aIniGetInt db 'ini.get_int',0
|
aIniGetInt db 'ini_get_int',0
|
||||||
aIniGetStr db 'ini.get_str',0
|
aIniGetStr db 'ini_get_str',0
|
||||||
aIniSetInt db 'ini.set_int',0
|
aIniSetInt db 'ini_set_int',0
|
||||||
aIniEnumKeys db 'ini.enum_keys',0
|
aIniEnumKeys db 'ini_enum_keys',0
|
||||||
aPluginLoad db 'plugin_load',0
|
aPluginLoad db 'plugin_load',0
|
||||||
aPluginUnload db 'plugin_unload',0
|
aPluginUnload db 'plugin_unload',0
|
||||||
aGetattr db 'getattr',0
|
aGetattr db 'getattr',0
|
||||||
|
@ -231,7 +231,7 @@ load_image:
|
|||||||
; invoke img.is_img, [img_data], [img_data_len]
|
; invoke img.is_img, [img_data], [img_data_len]
|
||||||
; or eax, eax
|
; or eax, eax
|
||||||
; jz exit
|
; jz exit
|
||||||
invoke img.decode, [img_data], [img_data_len]
|
invoke img.decode, [img_data], [img_data_len], 0
|
||||||
or eax, eax
|
or eax, eax
|
||||||
jz .error
|
jz .error
|
||||||
cmp [image], 0
|
cmp [image], 0
|
||||||
@ -513,6 +513,10 @@ load_directory:
|
|||||||
jz .copy
|
jz .copy
|
||||||
cmp ecx, 'jpe'
|
cmp ecx, 'jpe'
|
||||||
jz .copy
|
jz .copy
|
||||||
|
cmp ecx, 'ico'
|
||||||
|
jz .copy
|
||||||
|
cmp ecx, 'cur'
|
||||||
|
jz .copy
|
||||||
cmp ecx, 'jpeg'
|
cmp ecx, 'jpeg'
|
||||||
jz @f
|
jz @f
|
||||||
cmp ecx, 'jpeG'
|
cmp ecx, 'jpeG'
|
||||||
@ -722,6 +726,41 @@ draw_cur_frame:
|
|||||||
push 5 ; x
|
push 5 ; x
|
||||||
push [cur_frame]
|
push [cur_frame]
|
||||||
call [img.draw]
|
call [img.draw]
|
||||||
|
mov eax, [image]
|
||||||
|
test [eax + Image.Flags], Image.IsAnimated
|
||||||
|
jnz .done
|
||||||
|
cmp [eax + Image.Next], 0
|
||||||
|
jnz .additional_frames
|
||||||
|
.done:
|
||||||
|
ret
|
||||||
|
.additional_frames:
|
||||||
|
mov ebx, [procinfo+62]
|
||||||
|
sub ebx, 4
|
||||||
|
jbe .done
|
||||||
|
push 5
|
||||||
|
pop esi
|
||||||
|
.afloop:
|
||||||
|
sub ebx, [eax + Image.Width]
|
||||||
|
jbe .done
|
||||||
|
dec ebx
|
||||||
|
jz .done
|
||||||
|
add esi, [eax + Image.Width]
|
||||||
|
mov eax, [eax + Image.Next]
|
||||||
|
push eax
|
||||||
|
inc esi
|
||||||
|
push 0 ; ypos
|
||||||
|
push 0 ; xpos
|
||||||
|
mov ecx, [procinfo+66]
|
||||||
|
sub ecx, 34
|
||||||
|
push ecx ; max height
|
||||||
|
push ebx ; max width
|
||||||
|
push 35 ; y
|
||||||
|
push esi ; x
|
||||||
|
push eax ; image
|
||||||
|
call [img.draw]
|
||||||
|
pop eax
|
||||||
|
cmp [eax + Image.Next], 0
|
||||||
|
jnz .afloop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; void* __stdcall mem.Alloc(unsigned size);
|
; void* __stdcall mem.Alloc(unsigned size);
|
||||||
@ -961,27 +1000,27 @@ library \
|
|||||||
|
|
||||||
import libio , \
|
import libio , \
|
||||||
libio.init , 'lib_init' , \
|
libio.init , 'lib_init' , \
|
||||||
file.size , 'file.size' , \
|
file.size , 'file_size' , \
|
||||||
file.open , 'file.open' , \
|
file.open , 'file_open' , \
|
||||||
file.read , 'file.read' , \
|
file.read , 'file_read' , \
|
||||||
file.close , 'file.close'
|
file.close , 'file_close'
|
||||||
|
|
||||||
import libgfx , \
|
import libgfx , \
|
||||||
libgfx.init , 'lib_init' , \
|
libgfx.init , 'lib_init' , \
|
||||||
gfx.open , 'gfx.open' , \
|
gfx.open , 'gfx_open' , \
|
||||||
gfx.close , 'gfx.close' , \
|
gfx.close , 'gfx_close' , \
|
||||||
gfx.pen.color , 'gfx.pen.color' , \
|
gfx.pen.color , 'gfx_pen_color' , \
|
||||||
gfx.line , 'gfx.line'
|
gfx.line , 'gfx_line'
|
||||||
|
|
||||||
import libimg , \
|
import libimg , \
|
||||||
libimg.init , 'lib_init' , \
|
libimg.init , 'lib_init' , \
|
||||||
img.is_img , 'img.is_img' , \
|
img.is_img , 'img_is_img' , \
|
||||||
img.to_rgb2 , 'img.to_rgb2', \
|
img.to_rgb2 , 'img_to_rgb2', \
|
||||||
img.decode , 'img.decode' , \
|
img.decode , 'img_decode' , \
|
||||||
img.flip , 'img.flip' , \
|
img.flip , 'img_flip' , \
|
||||||
img.rotate , 'img.rotate' , \
|
img.rotate , 'img_rotate' , \
|
||||||
img.destroy , 'img.destroy', \
|
img.destroy , 'img_destroy', \
|
||||||
img.draw , 'img.draw'
|
img.draw , 'img_draw'
|
||||||
|
|
||||||
import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
|
import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ library \
|
|||||||
libini,'libini.obj'
|
libini,'libini.obj'
|
||||||
|
|
||||||
import libini, \
|
import libini, \
|
||||||
ini.get_str,'ini.get_str'
|
ini.get_str,'ini_get_str'
|
||||||
|
|
||||||
include_debug_strings
|
include_debug_strings
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user