mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 23:56:49 +03:00
0808796ed5
1. tiff (baseline) support 2. pnm (portable anymap) bilevel, grayscale (8bpp), pixmap (24bpp) support 3. xcf: optional layer merging/blending with sse (default is mmx) 4'. new formatting for my old code. more readable for now git-svn-id: svn://kolibrios.org@2388 a494cfbc-eb01-0410-851d-a64ba20cac60
55 lines
812 B
NASM
55 lines
812 B
NASM
.pbm:
|
|
stdcall img.create, [width], [height], Image.bpp1
|
|
test eax, eax
|
|
jz .quit
|
|
mov [retvalue], eax
|
|
mov ebx, eax
|
|
|
|
mov edi, [ebx+Image.Palette]
|
|
mov [edi], dword 0x00ffffff
|
|
mov [edi + 4], dword 0x00000000
|
|
|
|
cmp [data_type], PNM_ASCII
|
|
je .pbm.ascii
|
|
|
|
.pbm.raw:
|
|
mov ecx, [ebx+Image.Width]
|
|
add ecx, 7
|
|
shr ecx, 3
|
|
imul ecx, [ebx+Image.Height]
|
|
mov edi, [ebx+Image.Data]
|
|
rep movsb
|
|
jmp .quit
|
|
|
|
.pbm.ascii:
|
|
mov edi, [ebx+Image.Data]
|
|
.pbm.next_line:
|
|
mov edx, [width]
|
|
mov ecx, 7
|
|
xor eax, eax
|
|
.pbm.next_char:
|
|
lodsb
|
|
cmp al, ' '
|
|
jna .pbm.next_char
|
|
.pbm.get_number:
|
|
cmp al, '1'
|
|
sete bl
|
|
shl bl, cl
|
|
or ah, bl
|
|
dec ecx
|
|
jns @f
|
|
shr eax, 8
|
|
stosb
|
|
mov ecx, 7
|
|
@@:
|
|
dec edx
|
|
jnz .pbm.next_char
|
|
test byte[width], 0x07
|
|
jz @f
|
|
shr eax, 8
|
|
stosb
|
|
@@:
|
|
dec [height]
|
|
jnz .pbm.next_line
|
|
jmp .quit
|