forked from KolibriOS/kolibrios
img.scale and img.convert fix for multiframe images
new function: img.get_scaled_size git-svn-id: svn://kolibrios.org@6807 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c299820b03
commit
741b6ad89c
@ -17,15 +17,70 @@
|
|||||||
;; ;;
|
;; ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.convert _src, _dst, _dst_type, _flags, _param ;;
|
proc img.convert _src, _dst, _dst_type, _flags, _param ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? scale _image ;;
|
;? convert _image ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;> [_src] = pointer to source image ;;
|
;> [_src] = pointer to source image ;;
|
||||||
|
;> [_dst] = pointer to destination image, or 0 to create a new one ;;
|
||||||
|
;> [_dst_type] = Image.Type of resulting image ;;
|
||||||
;> [_flags] = see libimg.inc ;;
|
;> [_flags] = see libimg.inc ;;
|
||||||
;> [_dst_type] = the Image.Type of converted image ;;
|
;> [_param] = depends on _flags fields, see libimg.inc ;;
|
||||||
;> [_dst] = pointer to destination image, if any ;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;< eax = 0 / pointer to converted image ;;
|
||||||
|
;< ecx = error code / undefined ;;
|
||||||
|
;;================================================================================================;;
|
||||||
|
push ebx esi edi 0 0
|
||||||
|
mov ebx, [_src]
|
||||||
|
@@:
|
||||||
|
mov eax, [ebx + Image.Previous]
|
||||||
|
test eax, eax
|
||||||
|
jz .loop
|
||||||
|
mov ebx, eax
|
||||||
|
jmp @b
|
||||||
|
.loop:
|
||||||
|
stdcall img.convert.layer, ebx, [_dst], [_dst_type], [_flags], [_param]
|
||||||
|
test eax, eax
|
||||||
|
jz .error
|
||||||
|
cmp dword[esp + 4], 0
|
||||||
|
jnz @f
|
||||||
|
mov [esp + 4], eax
|
||||||
|
@@:
|
||||||
|
mov ecx, [esp]
|
||||||
|
jecxz @f
|
||||||
|
mov [ecx + Image.Next], eax
|
||||||
|
@@:
|
||||||
|
push [ebx + Image.Flags]
|
||||||
|
pop [eax + Image.Flags]
|
||||||
|
push [ebx + Image.Delay]
|
||||||
|
pop [eax + Image.Delay]
|
||||||
|
mov [eax + Image.Previous], ecx
|
||||||
|
mov [esp], eax
|
||||||
|
mov ebx, [ebx + Image.Next]
|
||||||
|
test ebx, ebx
|
||||||
|
jnz .loop
|
||||||
|
.quit:
|
||||||
|
pop eax eax edi esi ebx
|
||||||
|
ret
|
||||||
|
.error:
|
||||||
|
pop eax eax edi esi ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
;;================================================================================================;;
|
||||||
|
proc img.convert.layer _src, _dst, _dst_type, _flags, _param ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;? convert _image layer ;;
|
||||||
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
|
;> [_src] = pointer to source image ;;
|
||||||
|
;> [_dst] = pointer to destination image, or 0 to create a new one ;;
|
||||||
|
;> [_dst_type] = Image.Type of resulting image ;;
|
||||||
|
;> [_flags] = see libimg.inc ;;
|
||||||
|
;> [_param] = depends on _flags fields, see libimg.inc ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;< eax = 0 / pointer to converted image ;;
|
;< eax = 0 / pointer to converted image ;;
|
||||||
;< ecx = error code / undefined ;;
|
;< ecx = error code / undefined ;;
|
||||||
@ -34,6 +89,8 @@ locals
|
|||||||
width rd 1
|
width rd 1
|
||||||
height rd 1
|
height rd 1
|
||||||
endl
|
endl
|
||||||
|
push ebx esi edi
|
||||||
|
|
||||||
mov ebx, [_src]
|
mov ebx, [_src]
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
mov ecx, [_dst_type]
|
mov ecx, [_dst_type]
|
||||||
@ -151,6 +208,13 @@ endl
|
|||||||
mov eax, [_dst]
|
mov eax, [_dst]
|
||||||
jmp .quit
|
jmp .quit
|
||||||
|
|
||||||
|
.bpp8g_to_bpp8g:
|
||||||
|
mov ecx, [ebx + Image.Width]
|
||||||
|
imul ecx, [ebx + Image.Height]
|
||||||
|
rep movsb
|
||||||
|
mov eax, [_dst]
|
||||||
|
jmp .quit
|
||||||
|
|
||||||
.bpp8g_to_bpp24:
|
.bpp8g_to_bpp24:
|
||||||
mov ecx, [ebx + Image.Width]
|
mov ecx, [ebx + Image.Width]
|
||||||
imul ecx, [ebx + Image.Height]
|
imul ecx, [ebx + Image.Height]
|
||||||
@ -199,6 +263,19 @@ endl
|
|||||||
jnz @b
|
jnz @b
|
||||||
mov eax, [_dst]
|
mov eax, [_dst]
|
||||||
jmp .quit
|
jmp .quit
|
||||||
|
.bpp24_to_bpp32:
|
||||||
|
mov ecx, [ebx + Image.Width]
|
||||||
|
imul ecx, [ebx + Image.Height]
|
||||||
|
@@:
|
||||||
|
lodsw
|
||||||
|
ror eax, 16
|
||||||
|
lodsb
|
||||||
|
rol eax, 16
|
||||||
|
stosd
|
||||||
|
dec ecx
|
||||||
|
jnz @b
|
||||||
|
mov eax, [_dst]
|
||||||
|
jmp .quit
|
||||||
|
|
||||||
|
|
||||||
.bpp32:
|
.bpp32:
|
||||||
@ -561,25 +638,28 @@ end repeat
|
|||||||
.error:
|
.error:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
.quit:
|
.quit:
|
||||||
|
pop edi esi ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
img.convert.bpp8i.table:
|
img.convert.bpp8i.table:
|
||||||
dd Image.bpp24, img.convert.bpp8i_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp8i_to_bpp24
|
||||||
img.convert.bpp8g.table:
|
img.convert.bpp8g.table:
|
||||||
dd Image.bpp24, img.convert.bpp8g_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp8g_to_bpp24
|
||||||
dd Image.bpp1, img.convert.bpp8g_to_bpp1
|
dd Image.bpp8g, img.convert.layer.bpp8g_to_bpp8g
|
||||||
|
dd Image.bpp1, img.convert.layer.bpp8g_to_bpp1
|
||||||
img.convert.bpp24.table:
|
img.convert.bpp24.table:
|
||||||
dd Image.bpp24, img.convert.bpp24_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp24_to_bpp24
|
||||||
dd Image.bpp8g, img.convert.bpp24_to_bpp8g
|
dd Image.bpp8g, img.convert.layer.bpp24_to_bpp8g
|
||||||
|
dd Image.bpp32, img.convert.layer.bpp24_to_bpp32
|
||||||
img.convert.bpp32.table:
|
img.convert.bpp32.table:
|
||||||
dd Image.bpp24, img.convert.bpp32_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp32_to_bpp24
|
||||||
img.convert.bpp15.table:
|
img.convert.bpp15.table:
|
||||||
dd Image.bpp24, img.convert.bpp15_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp15_to_bpp24
|
||||||
img.convert.bpp16.table:
|
img.convert.bpp16.table:
|
||||||
dd Image.bpp24, img.convert.bpp16_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp16_to_bpp24
|
||||||
img.convert.bpp1.table:
|
img.convert.bpp1.table:
|
||||||
dd Image.bpp24, img.convert.bpp1_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp1_to_bpp24
|
||||||
img.convert.bpp8a.table:
|
img.convert.bpp8a.table:
|
||||||
dd Image.bpp24, img.convert.bpp8a_to_bpp24
|
dd Image.bpp24, img.convert.layer.bpp8a_to_bpp24
|
||||||
|
@ -49,7 +49,6 @@ include 'xbm/xbm.asm'
|
|||||||
|
|
||||||
include 'scale.asm'
|
include 'scale.asm'
|
||||||
include 'convert.asm'
|
include 'convert.asm'
|
||||||
;include 'transform.asm'
|
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
|
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
|
||||||
@ -186,7 +185,10 @@ endp
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
proc img.to_rgb _img ;////////////////////////////////////////////////////////////////////////////;;
|
proc img.to_rgb _img ;////////////////////////////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? decodes image data into RGB triplets and returns pointer to memory area containing them ;;
|
;? decodes image data into RGB triplets and returns pointer to memory area of following structure:;;
|
||||||
|
;? width dd ? ;;
|
||||||
|
;? height dd ? ;;
|
||||||
|
;? rgb triplets ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;> [_img] = pointer to source image ;;
|
;> [_img] = pointer to source image ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
@ -696,13 +698,13 @@ proc img.encode _img, _common, _specific ;//////////////////////////////////////
|
|||||||
;? encode image to some format ;;
|
;? encode image to some format ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;> [_img] = pointer to input image ;;
|
;> [_img] = pointer to input image ;;
|
||||||
;> [_common] = some most important options ;;
|
;> [_common] = some most important/common options ;;
|
||||||
; 0x00 : byte : format id (defined in libimg.inc) ;;
|
; 0x00 : byte : format id (defined in libimg.inc) ;;
|
||||||
; 0x01 : byte : fast encoding (0) / best compression ratio (255) ;;
|
; 0x01 : byte : fast encoding (0) / best compression ratio (255) ;;
|
||||||
; 0 : store uncompressed data (if supported both by the format and libimg) ;;
|
; 0 : store uncompressed data (if supported both by the format and libimg) ;;
|
||||||
; 1 - 255 : use compression, if supported ;;
|
; 1 - 255 : use compression, if supported ;;
|
||||||
; this option may be ignored if any format specific options are defined ;;
|
; this option may be ignored if any format specific options are defined ;;
|
||||||
; i.e. the 0 here will be ignored if some compression algorithm is specified ;;
|
; i.e. 0 here will be ignored if particular compression algorithm is specified ;;
|
||||||
; 0x02 : byte : flags (bitfield) ;;
|
; 0x02 : byte : flags (bitfield) ;;
|
||||||
; 0x01 : return an error if format specific conditions cannot be met ;;
|
; 0x01 : return an error if format specific conditions cannot be met ;;
|
||||||
; 0x02 : preserve current bit depth. means 8bpp/16bpp/24bpp and so on ;;
|
; 0x02 : preserve current bit depth. means 8bpp/16bpp/24bpp and so on ;;
|
||||||
@ -719,65 +721,65 @@ proc img.encode _img, _common, _specific ;//////////////////////////////////////
|
|||||||
; 3 : specific conditions cannot be satisfied ;;
|
; 3 : specific conditions cannot be satisfied ;;
|
||||||
; 4 : bit depth cannot be preserved ;;
|
; 4 : bit depth cannot be preserved ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
mov ebx, [_img]
|
mov ebx, [_img]
|
||||||
|
|
||||||
movzx eax, byte[_common]
|
movzx eax, byte[_common]
|
||||||
dec eax
|
dec eax
|
||||||
imul eax, sizeof.FormatsTableEntry
|
imul eax, sizeof.FormatsTableEntry
|
||||||
add eax, FormatsTableEntry.Capabilities
|
add eax, FormatsTableEntry.Capabilities
|
||||||
add eax, img.formats_table
|
add eax, img.formats_table
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
test eax, 1 ; is encoding to this format supported at all?
|
test eax, 1 ; is encoding to this format supported at all?
|
||||||
jnz @f
|
jnz @f
|
||||||
mov ecx, LIBIMG_ERROR_FORMAT
|
mov ecx, LIBIMG_ERROR_FORMAT
|
||||||
jmp .error
|
jmp .error
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [ebx + Image.Type]
|
mov ecx, [ebx + Image.Type]
|
||||||
mov edx, 1
|
mov edx, 1
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
test eax, edx
|
test eax, edx
|
||||||
jnz .bit_depth_ok
|
jnz .bit_depth_ok
|
||||||
test byte[_common+2], LIBIMG_ENCODE_STRICT_BIT_DEPTH
|
test byte[_common+2], LIBIMG_ENCODE_STRICT_BIT_DEPTH
|
||||||
jz @f
|
jz @f
|
||||||
mov ecx, LIBIMG_ERROR_BIT_DEPTH
|
mov ecx, LIBIMG_ERROR_BIT_DEPTH
|
||||||
jmp .error
|
jmp .error
|
||||||
@@:
|
@@:
|
||||||
mov edx, 1 SHL Image.bpp24
|
mov edx, 1 SHL Image.bpp24
|
||||||
test eax, edx
|
test eax, edx
|
||||||
jnz @f
|
jnz @f
|
||||||
mov ecx, LIBIMG_ERROR_BIT_DEPTH
|
mov ecx, LIBIMG_ERROR_BIT_DEPTH
|
||||||
jmp .error
|
jmp .error
|
||||||
@@:
|
@@:
|
||||||
stdcall img.create, [ebx + Image.Width], [ebx + Image.Height], Image.bpp24
|
stdcall img.create, [ebx + Image.Width], [ebx + Image.Height], Image.bpp24
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
mov ecx, LIBIMG_ERROR_OUT_OF_MEMORY
|
mov ecx, LIBIMG_ERROR_OUT_OF_MEMORY
|
||||||
jmp .error
|
jmp .error
|
||||||
@@:
|
@@:
|
||||||
push eax
|
push eax
|
||||||
stdcall img.to_rgb2, ebx, [eax + Image.Data]
|
stdcall img.to_rgb2, ebx, [eax + Image.Data]
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
.bit_depth_ok:
|
.bit_depth_ok:
|
||||||
movzx eax, byte[_common]
|
movzx eax, byte[_common]
|
||||||
dec eax
|
dec eax
|
||||||
imul eax, sizeof.FormatsTableEntry
|
imul eax, sizeof.FormatsTableEntry
|
||||||
add eax, FormatsTableEntry.Encode
|
add eax, FormatsTableEntry.Encode
|
||||||
add eax, img.formats_table
|
add eax, img.formats_table
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
stdcall eax, [_img], [_common], [_specific]
|
stdcall eax, [_img], [_common], [_specific]
|
||||||
push eax ecx
|
push eax ecx
|
||||||
cmp ebx, [_img]
|
cmp ebx, [_img]
|
||||||
je @f
|
je @f
|
||||||
stdcall img.destroy, ebx
|
stdcall img.destroy, ebx
|
||||||
@@:
|
@@:
|
||||||
pop ecx eax
|
pop ecx eax
|
||||||
jmp .quit
|
jmp .quit
|
||||||
|
|
||||||
.error:
|
.error:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
.quit:
|
.quit:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
@ -2301,6 +2303,9 @@ endl
|
|||||||
|
|
||||||
|
|
||||||
.flip:
|
.flip:
|
||||||
|
stdcall img.flip.layer, [_img], FLIP_VERTICAL
|
||||||
|
test eax, eax
|
||||||
|
jz .error
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.exchange_dims:
|
.exchange_dims:
|
||||||
@ -2435,15 +2440,15 @@ img.formats_table:
|
|||||||
dd 0
|
dd 0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
img.types_table: ; entries order must correspond to type defnitions in libimg.inc
|
img.types_table: ; entries order must correspond to type defnitions in libimg.inc
|
||||||
dd 0 ; there is no Image.bpp* = 0
|
dd 0 ; there is no Image.bpp* = 0
|
||||||
.bpp8i dd (1 SHL Image.bpp24)
|
.bpp8i dd (1 SHL Image.bpp24)
|
||||||
.bpp24 dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp8g)
|
.bpp24 dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp8g)
|
||||||
.bpp32 dd (1 SHL Image.bpp24)
|
.bpp32 dd (1 SHL Image.bpp24)
|
||||||
.bpp15 dd (1 SHL Image.bpp24)
|
.bpp15 dd (1 SHL Image.bpp24)
|
||||||
.bpp16 dd (1 SHL Image.bpp24)
|
.bpp16 dd (1 SHL Image.bpp24)
|
||||||
.bpp1 dd (1 SHL Image.bpp24)
|
.bpp1 dd (1 SHL Image.bpp24)
|
||||||
.bpp8g dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp1 )
|
.bpp8g dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp1 ) OR (1 SHL Image.bpp8g)
|
||||||
.bpp8a dd (1 SHL Image.bpp24)
|
.bpp8a dd (1 SHL Image.bpp24)
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
@ -2656,11 +2661,12 @@ endp
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
img._.get_scanline_len: ;/////////////////////////////////////////////////////////////////////////;;
|
img._.get_scanline_len: ;/////////////////////////////////////////////////////////////////////////;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;? --- TBD --- ;;
|
;? Get scanline length of image in bytes ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;> --- TBD --- ;;
|
;> eax = width of image in pixels ;;
|
||||||
|
;> ebx = image ;;
|
||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;< --- TBD --- ;;
|
;< eax = scanline length in bytes ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
cmp [ebx + Image.Type], Image.bpp1
|
cmp [ebx + Image.Type], Image.bpp1
|
||||||
jz .bpp1.1
|
jz .bpp1.1
|
||||||
@ -2748,31 +2754,32 @@ align 4
|
|||||||
@EXPORT:
|
@EXPORT:
|
||||||
|
|
||||||
export \
|
export \
|
||||||
lib_init , 'lib_init' , \
|
lib_init , 'lib_init' , \
|
||||||
0x00050007 , 'version' , \
|
0x00050007 , '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' , \
|
||||||
img.scale , 'img_scale' , \
|
img.scale , 'img_scale' , \
|
||||||
img.convert , 'img_convert' , \
|
img.get_scaled_size, 'img_get_scaled_size', \
|
||||||
img.formats_table, 'img_formats_table'
|
img.convert , 'img_convert' , \
|
||||||
|
img.formats_table , 'img_formats_table'
|
||||||
|
|
||||||
; import from deflate unpacker
|
; import from deflate unpacker
|
||||||
; is initialized only when PNG loading is requested
|
; is initialized only when PNG loading is requested
|
||||||
|
@ -18,68 +18,71 @@
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
|
|
||||||
; list of format id's
|
; list of format id's
|
||||||
LIBIMG_FORMAT_BMP = 1
|
LIBIMG_FORMAT_BMP = 1
|
||||||
LIBIMG_FORMAT_ICO = 2
|
LIBIMG_FORMAT_ICO = 2
|
||||||
LIBIMG_FORMAT_CUR = 3
|
LIBIMG_FORMAT_CUR = 3
|
||||||
LIBIMG_FORMAT_GIF = 4
|
LIBIMG_FORMAT_GIF = 4
|
||||||
LIBIMG_FORMAT_PNG = 5
|
LIBIMG_FORMAT_PNG = 5
|
||||||
LIBIMG_FORMAT_JPEG = 6
|
LIBIMG_FORMAT_JPEG = 6
|
||||||
LIBIMG_FORMAT_TGA = 7
|
LIBIMG_FORMAT_TGA = 7
|
||||||
LIBIMG_FORMAT_PCX = 8
|
LIBIMG_FORMAT_PCX = 8
|
||||||
LIBIMG_FORMAT_XCF = 9
|
LIBIMG_FORMAT_XCF = 9
|
||||||
LIBIMG_FORMAT_TIFF = 10
|
LIBIMG_FORMAT_TIFF = 10
|
||||||
LIBIMG_FORMAT_PNM = 11
|
LIBIMG_FORMAT_PNM = 11
|
||||||
LIBIMG_FORMAT_WBMP = 12
|
LIBIMG_FORMAT_WBMP = 12
|
||||||
LIBIMG_FORMAT_XBM = 13
|
LIBIMG_FORMAT_XBM = 13
|
||||||
LIBIMG_FORMAT_Z80 = 14
|
LIBIMG_FORMAT_Z80 = 14
|
||||||
|
|
||||||
; scale type ; corresponding img.scale params
|
; scale type ; corresponding img.scale params
|
||||||
LIBIMG_SCALE_INTEGER = 1 ; scale factor ; reserved 0
|
LIBIMG_SCALE_NONE = 0 ; do not scale
|
||||||
LIBIMG_SCALE_TILE = 2 ; new width ; new height
|
LIBIMG_SCALE_INTEGER = 1 ; scale factor ; reserved 0
|
||||||
LIBIMG_SCALE_STRETCH = 3 ; new width ; new height
|
LIBIMG_SCALE_TILE = 2 ; new width ; new height
|
||||||
LIBIMG_SCALE_FIT_RECT = 4 ; new width ; new height
|
LIBIMG_SCALE_STRETCH = 3 ; new width ; new height
|
||||||
LIBIMG_SCALE_FIT_WIDTH = 5 ; new width ; new height
|
LIBIMG_SCALE_FIT_BOTH = LIBIMG_SCALE_STRETCH
|
||||||
LIBIMG_SCALE_FIT_HEIGHT = 6 ; new width ; new height
|
LIBIMG_SCALE_FIT_MIN = 4 ; new width ; new height
|
||||||
LIBIMG_SCALE_FIT_MAX = 7 ; new width ; new height
|
LIBIMG_SCALE_FIT_RECT = LIBIMG_SCALE_FIT_MIN
|
||||||
|
LIBIMG_SCALE_FIT_WIDTH = 5 ; new width ; new height
|
||||||
|
LIBIMG_SCALE_FIT_HEIGHT = 6 ; new width ; new height
|
||||||
|
LIBIMG_SCALE_FIT_MAX = 7 ; new width ; new height
|
||||||
|
|
||||||
; interpolation algorithm
|
; interpolation algorithm
|
||||||
LIBIMG_INTER_NONE = 0 ; use it with LIBIMG_SCALE_INTEGER, LIBIMG_SCALE_TILE, etc
|
LIBIMG_INTER_NONE = 0 ; use it with LIBIMG_SCALE_INTEGER, LIBIMG_SCALE_TILE, etc
|
||||||
LIBIMG_INTER_BILINEAR = 1
|
LIBIMG_INTER_BILINEAR = 1
|
||||||
;LIBIMG_INTER_BICUBIC = 2
|
;LIBIMG_INTER_BICUBIC = 2
|
||||||
;LIBIMG_INTER_LANCZOS = 3
|
;LIBIMG_INTER_LANCZOS = 3
|
||||||
LIBIMG_INTER_DEFAULT = LIBIMG_INTER_BILINEAR
|
LIBIMG_INTER_DEFAULT = LIBIMG_INTER_BILINEAR
|
||||||
|
|
||||||
; error codes
|
; error codes
|
||||||
LIBIMG_ERROR_OUT_OF_MEMORY = 1
|
LIBIMG_ERROR_OUT_OF_MEMORY = 1
|
||||||
LIBIMG_ERROR_FORMAT = 2
|
LIBIMG_ERROR_FORMAT = 2
|
||||||
LIBIMG_ERROR_CONDITIONS = 3
|
LIBIMG_ERROR_CONDITIONS = 3
|
||||||
LIBIMG_ERROR_BIT_DEPTH = 4
|
LIBIMG_ERROR_BIT_DEPTH = 4
|
||||||
LIBIMG_ERROR_ENCODER = 5
|
LIBIMG_ERROR_ENCODER = 5
|
||||||
LIBIMG_ERROR_SRC_TYPE = 6
|
LIBIMG_ERROR_SRC_TYPE = 6
|
||||||
LIBIMG_ERROR_SCALE = 7
|
LIBIMG_ERROR_SCALE = 7
|
||||||
LIBIMG_ERROR_INTER = 8
|
LIBIMG_ERROR_INTER = 8
|
||||||
LIBIMG_ERROR_NOT_INPLEMENTED = 9
|
LIBIMG_ERROR_NOT_INPLEMENTED = 9
|
||||||
LIBIMG_ERROR_INVALID_INPUT = 10
|
LIBIMG_ERROR_INVALID_INPUT = 10
|
||||||
|
|
||||||
; encode flags (byte 0x02 of _common option)
|
; encode flags (byte 0x02 of _common option)
|
||||||
LIBIMG_ENCODE_STRICT_SPECIFIC = 0x01
|
;LIBIMG_ENCODE_STRICT_SPECIFIC = 0x01
|
||||||
LIBIMG_ENCODE_STRICT_BIT_DEPTH = 0x02
|
LIBIMG_ENCODE_STRICT_BIT_DEPTH = 0x02
|
||||||
LIBIMG_ENCODE_DELETE_ALPHA = 0x08
|
;LIBIMG_ENCODE_DELETE_ALPHA = 0x08
|
||||||
LIBIMG_ENCODE_FLUSH_ALPHA = 0x10
|
;LIBIMG_ENCODE_FLUSH_ALPHA = 0x10
|
||||||
|
|
||||||
; convert flags
|
; convert flags
|
||||||
; TBD
|
; none so far
|
||||||
|
|
||||||
struct FormatsTableEntry
|
struct FormatsTableEntry
|
||||||
Format_id dd ?
|
Format_id dd ?
|
||||||
Is dd ?
|
Is dd ?
|
||||||
Decode dd ?
|
Decode dd ?
|
||||||
Encode dd ?
|
Encode dd ?
|
||||||
Capabilities dd ?
|
Capabilities dd ?
|
||||||
ends
|
ends
|
||||||
|
|
||||||
struct Image
|
struct Image
|
||||||
Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0] ; ignored so far
|
Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0] ; ignored so far
|
||||||
Width dd ?
|
Width dd ?
|
||||||
Height dd ?
|
Height dd ?
|
||||||
Next dd ?
|
Next dd ?
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user