Subversion Repositories Kolibri OS

Rev

Rev 2388 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. .pgm:
  2.         stdcall img.create, [width], [height], Image.bpp8g
  3.         test    eax, eax
  4.         jz      .quit
  5.         mov     [retvalue], eax
  6.         mov     ebx, eax
  7.  
  8.         mov     edi, [ebx+Image.Data]
  9.         mov     ecx, [ebx+Image.Width]
  10.         imul    ecx, [ebx+Image.Height]
  11.  
  12.         cmp     [data_type], PNM_ASCII
  13.         je      .pgm.ascii
  14.  
  15.   .pgm.raw:
  16.         cmp     [maxval], 0xff
  17.         jne     .pgm.raw.scale
  18.         rep     movsb
  19.         jmp     .quit
  20.  
  21.   .pgm.raw.scale:
  22.         mov     edx, [maxval]
  23.         mov     eax, 0
  24.     @@:
  25.         lodsb
  26.         mov     ebx, eax
  27.         shl     eax, 8
  28.         sub     eax, ebx
  29.         div     dl
  30.         stosb
  31.         dec     ecx
  32.         jnz     @b
  33.         jmp     .quit
  34.  
  35.   .pgm.ascii:
  36.         xor     eax, eax
  37.         cmp     [maxval], 0xff
  38.         jne     .pgm.ascii.scale
  39.   .pgm.ascii.next_char:
  40.         lodsb
  41.         cmp     al, ' '
  42.         jna     .pgm.ascii.next_char
  43.         call    pnm._.get_number
  44.         mov     eax, ebx
  45.         stosb
  46.         dec     ecx
  47.         jnz     .pgm.ascii.next_char
  48.         jmp     .quit
  49.  
  50.   .pgm.ascii.scale:
  51.         mov     edx, [maxval]
  52.   .pgm.ascii.scale.next_char:
  53.         lodsb
  54.         cmp     al, ' '
  55.         jna     .pgm.ascii.scale.next_char
  56.         call    pnm._.get_number
  57.         mov     eax, ebx
  58.         shl     eax, 8
  59.         sub     eax, ebx
  60.         div     dl
  61.         stosb
  62.         dec     ecx
  63.         jnz     .pgm.ascii.scale.next_char
  64.         jmp     .quit
  65.  
  66.