forked from KolibriOS/kolibrios
libimg:
add new image types (Image.bpp2i, Image.bpp4i); update to_rgb, flip, rotate functions decode .bpp2i and .bpp4i tiff images disable memory limit for decoded images git-svn-id: svn://kolibrios.org@3503 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5e88b2cdeb
commit
ccaf3a054b
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
;;================================================================================================;;
|
||||
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2012 ///////;;
|
||||
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2013 ///////;;
|
||||
;;================================================================================================;;
|
||||
;; ;;
|
||||
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||
@ -101,9 +101,9 @@ Image.bpp15 = 4
|
||||
Image.bpp16 = 5
|
||||
Image.bpp1 = 6
|
||||
Image.bpp8g = 7 ; grayscale
|
||||
Image.bpp8a = 8 ; grayscale with alpha channel; application layer only!!! kernel doesn't handle this image type, libimg can only create and destroy such images
|
||||
;Image.bpp2 = 9
|
||||
;Image.bpp4 = 10
|
||||
Image.bpp2i = 8
|
||||
Image.bpp4i = 9
|
||||
Image.bpp8a = 10 ; grayscale with alpha channel; application layer only!!! kernel doesn't handle this image type, libimg can only create and destroy such images
|
||||
|
||||
; bits in Image.Flags
|
||||
Image.IsAnimated = 1
|
||||
|
@ -125,7 +125,7 @@ endl
|
||||
rep stosb
|
||||
test ebx, ebx
|
||||
jnz @b
|
||||
stdcall pcx._.scanline_unpack, [width], [cur_scanline], [num_planes]
|
||||
stdcall pcx._.scanline_unpack, [width], [bp_plane], [cur_scanline], [num_planes]
|
||||
dec [height]
|
||||
jnz .24bit.scanline
|
||||
jmp .quit
|
||||
@ -244,7 +244,7 @@ proc pcx._.get_byte
|
||||
endp
|
||||
|
||||
|
||||
proc pcx._.scanline_unpack _width, _scanline, _num_planes
|
||||
proc pcx._.scanline_unpack _width, _bp_plane, _scanline, _num_planes
|
||||
push esi
|
||||
|
||||
mov esi, [_scanline]
|
||||
@ -262,8 +262,8 @@ proc pcx._.scanline_unpack _width, _scanline, _num_planes
|
||||
add edi, [_num_planes]
|
||||
dec ecx
|
||||
jnz @b
|
||||
bt dword[_width], 0
|
||||
adc esi, 0
|
||||
add esi, [_bp_plane]
|
||||
sub esi, [_width]
|
||||
dec ebx
|
||||
jns .plane
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
;;================================================================================================;;
|
||||
;;//// tiff.asm //// (c) dunkaist, 2011-2012 /////////////////////////////////////////////////////;;
|
||||
;;//// tiff.asm //// (c) dunkaist, 2011-2013 /////////////////////////////////////////////////////;;
|
||||
;;================================================================================================;;
|
||||
;; ;;
|
||||
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||
@ -207,10 +207,10 @@ endl
|
||||
je .bpp8g
|
||||
cmp ecx, Image.bpp8a
|
||||
je .bpp8a
|
||||
; cmp ecx, Image.bpp2
|
||||
; je .bpp2
|
||||
; cmp ecx, Image.bpp4
|
||||
; je .bpp4
|
||||
cmp ecx, Image.bpp2i
|
||||
je .bpp2i
|
||||
cmp ecx, Image.bpp4i
|
||||
je .bpp4i
|
||||
jmp .quit
|
||||
;error report!!
|
||||
|
||||
@ -220,38 +220,24 @@ endl
|
||||
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.BLACK_IS_ZERO
|
||||
jne .bpp1.white_is_zero
|
||||
.bpp1.black_is_zero:
|
||||
mov [edi], dword 0x00000000
|
||||
mov [edi + 4], dword 0x00ffffff
|
||||
mov [edi], dword 0xff000000
|
||||
mov [edi + 4], dword 0xffffffff
|
||||
jmp .common
|
||||
.bpp1.white_is_zero:
|
||||
mov [edi], dword 0x00ffffff
|
||||
mov [edi + 4], dword 0x00000000
|
||||
mov [edi], dword 0xffffffff
|
||||
mov [edi + 4], dword 0xff000000
|
||||
jmp .common
|
||||
|
||||
.bpp2:
|
||||
.bpp2i:
|
||||
stdcall tiff._.get_palette, 1 SHL 2, [_endianness]
|
||||
jmp .common
|
||||
|
||||
.bpp4:
|
||||
.bpp4i:
|
||||
stdcall tiff._.get_palette, 1 SHL 4, [_endianness]
|
||||
jmp .common
|
||||
|
||||
.bpp8i:
|
||||
mov esi, [ebx + tiff_extra.palette]
|
||||
mov ah, 2
|
||||
.bpp8.channel:
|
||||
mov edi, eax
|
||||
and edi, 0x0000ff00
|
||||
shr edi, 8
|
||||
add edi, [edx + Image.Palette]
|
||||
mov ecx, 256
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
lodsb
|
||||
add edi, 3
|
||||
dec ecx
|
||||
jnz @b
|
||||
dec ah
|
||||
jns .bpp8.channel
|
||||
stdcall tiff._.get_palette, 1 SHL 8, [_endianness]
|
||||
jmp .common
|
||||
.bpp8g:
|
||||
jmp .common
|
||||
@ -634,9 +620,6 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
xor eax, eax
|
||||
lodsw_
|
||||
mov [ebx + tiff_extra.planar_configuration], eax
|
||||
;debug_print 'planar_configuration: '
|
||||
;debug_print_dec eax
|
||||
;newline
|
||||
lodsw
|
||||
@@:
|
||||
jmp .quit
|
||||
@ -676,7 +659,7 @@ proc tiff._.define_image_type
|
||||
xor eax, eax
|
||||
|
||||
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.RGB
|
||||
jne .not_full_color
|
||||
jne .palette_bilevel_grayscale
|
||||
mov eax, -3
|
||||
add eax, [ebx + tiff_extra.samples_per_pixel]
|
||||
mov [ebx + tiff_extra.extra_samples_number], eax
|
||||
@ -691,17 +674,17 @@ proc tiff._.define_image_type
|
||||
; mov [ebx + tiff_extra.extra_samples_number], 0
|
||||
jmp .quit
|
||||
@@:
|
||||
.not_full_color: ; grayscale, indexed, bilevel
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 1
|
||||
jg .not_bilevel
|
||||
mov eax, Image.bpp1
|
||||
jmp .quit
|
||||
.not_bilevel: ; grayscale, indexed
|
||||
.palette_bilevel_grayscale:
|
||||
cmp [ebx + tiff_extra.palette], 0
|
||||
je .without_palette
|
||||
je .bilevel_grayscale
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 2
|
||||
jg @f
|
||||
mov eax, Image.bpp2i
|
||||
jmp .quit
|
||||
@@:
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 4
|
||||
jne @f
|
||||
; mov eax, Image.bpp4
|
||||
jg @f
|
||||
mov eax, Image.bpp4i
|
||||
jmp .quit
|
||||
@@:
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 8
|
||||
@ -710,12 +693,16 @@ proc tiff._.define_image_type
|
||||
jmp .quit
|
||||
@@:
|
||||
jmp .quit
|
||||
.without_palette: ; grayscale
|
||||
mov eax, -1
|
||||
add eax, [ebx + tiff_extra.samples_per_pixel]
|
||||
mov [ebx + tiff_extra.extra_samples_number], eax
|
||||
dec eax
|
||||
jns @f
|
||||
.bilevel_grayscale:
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 1
|
||||
jg .grayscale
|
||||
mov eax, Image.bpp1
|
||||
jmp .quit
|
||||
.grayscale:
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 8
|
||||
jne .quit
|
||||
cmp [ebx + tiff_extra.samples_per_pixel], 1
|
||||
jne @f
|
||||
mov eax, Image.bpp8g
|
||||
jmp .quit
|
||||
@@:
|
||||
@ -1260,6 +1247,28 @@ endl
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc tiff._.get_palette _num_colors, _endianness
|
||||
mov esi, [ebx + tiff_extra.palette]
|
||||
push ebx
|
||||
mov ebx, 2
|
||||
.bpp2.channel:
|
||||
mov edi, ebx
|
||||
add edi, [edx + Image.Palette]
|
||||
mov ecx, [_num_colors]
|
||||
@@:
|
||||
lodsw_
|
||||
shr eax, 8
|
||||
stosb
|
||||
add edi, 3
|
||||
dec ecx
|
||||
jnz @b
|
||||
dec ebx
|
||||
jns .bpp2.channel
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
;;================================================================================================;;
|
||||
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||
;;================================================================================================;;
|
||||
|
Loading…
Reference in New Issue
Block a user