Subversion Repositories Kolibri OS

Rev

Rev 2733 | 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.bpp8
  3.         test    eax, eax
  4.         jz      .quit
  5.         mov     [retvalue], eax
  6.         mov     ebx, eax
  7.  
  8.         mov     edi, [ebx+Image.Palette]
  9.         mov     eax, 0xff000000
  10.     @@:
  11.         stosd
  12.         add     eax, 0x00010101
  13.         jnc     @b
  14.  
  15.         mov     edi, [ebx+Image.Data]
  16.         mov     ecx, [ebx+Image.Width]
  17.         imul    ecx, [ebx+Image.Height]
  18.  
  19.         cmp     [data_type], PNM_ASCII
  20.         je      .pgm.ascii
  21.  
  22.   .pgm.raw:
  23.         cmp     [maxval], 0xff
  24.         jne     .pgm.raw.scale
  25.         rep     movsb
  26.         jmp     .quit
  27.  
  28.   .pgm.raw.scale:
  29.         mov     edx, [maxval]
  30.         mov     eax, 0
  31.     @@:
  32.         lodsb
  33.         mov     ebx, eax
  34.         shl     eax, 8
  35.         sub     eax, ebx
  36.         div     dl
  37.         stosb
  38.         dec     ecx
  39.         jnz     @b
  40.         jmp     .quit
  41.  
  42.   .pgm.ascii:
  43.         xor     eax, eax
  44.         cmp     [maxval], 0xff
  45.         jne     .pgm.ascii.scale
  46.   .pgm.ascii.next_char:
  47.         lodsb
  48.         cmp     al, ' '
  49.         jna     .pgm.ascii.next_char
  50.         call    pnm._.get_number
  51.         mov     eax, ebx
  52.         stosb
  53.         dec     ecx
  54.         jnz     .pgm.ascii.next_char
  55.         jmp     .quit
  56.  
  57.   .pgm.ascii.scale:
  58.         mov     edx, [maxval]
  59.   .pgm.ascii.scale.next_char:
  60.         lodsb
  61.         cmp     al, ' '
  62.         jna     .pgm.ascii.scale.next_char
  63.         call    pnm._.get_number
  64.         mov     eax, ebx
  65.         shl     eax, 8
  66.         sub     eax, ebx
  67.         div     dl
  68.         stosb
  69.         dec     ecx
  70.         jnz     .pgm.ascii.scale.next_char
  71.         jmp     .quit
  72.  
  73.