Subversion Repositories Kolibri OS

Rev

Rev 6733 | Rev 7105 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6733 Rev 6807
Line 47... Line 47...
47
include 'wbmp/wbmp.asm'
47
include 'wbmp/wbmp.asm'
48
include 'xbm/xbm.asm'
48
include 'xbm/xbm.asm'
Line 49... Line 49...
49
 
49
 
50
include 'scale.asm'
50
include 'scale.asm'
51
include 'convert.asm'
-
 
Line 52... Line 51...
52
;include 'transform.asm'
51
include 'convert.asm'
53
 
52
 
54
;;================================================================================================;;
53
;;================================================================================================;;
55
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
54
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
Line 184... Line 183...
184
endp
183
endp
Line 185... Line 184...
185
 
184
 
186
;;================================================================================================;;
185
;;================================================================================================;;
187
proc img.to_rgb _img ;////////////////////////////////////////////////////////////////////////////;;
186
proc img.to_rgb _img ;////////////////////////////////////////////////////////////////////////////;;
188
;;------------------------------------------------------------------------------------------------;;
187
;;------------------------------------------------------------------------------------------------;;
-
 
188
;? decodes image data into RGB triplets and returns pointer to memory area of following structure:;;
-
 
189
;? width  dd ?                                                                                    ;;
-
 
190
;? height dd ?                                                                                    ;;
189
;? decodes image data into RGB triplets and returns pointer to memory area containing them        ;;
191
;? rgb triplets                                                                                   ;;
190
;;------------------------------------------------------------------------------------------------;;
192
;;------------------------------------------------------------------------------------------------;;
191
;> [_img] = pointer to source image                                                               ;;
193
;> [_img] = pointer to source image                                                               ;;
192
;;------------------------------------------------------------------------------------------------;;
194
;;------------------------------------------------------------------------------------------------;;
193
;< eax = 0 / pointer to rgb_data (array of [rgb] triplets)                                        ;;
195
;< eax = 0 / pointer to rgb_data (array of [rgb] triplets)                                        ;;
Line 694... Line 696...
694
proc img.encode _img, _common, _specific ;////////////////////////////////////////////////////////;;
696
proc img.encode _img, _common, _specific ;////////////////////////////////////////////////////////;;
695
;;------------------------------------------------------------------------------------------------;;
697
;;------------------------------------------------------------------------------------------------;;
696
;? encode image to some format                                                                    ;;
698
;? encode image to some format                                                                    ;;
697
;;------------------------------------------------------------------------------------------------;;
699
;;------------------------------------------------------------------------------------------------;;
698
;> [_img]      = pointer to input image                                                           ;;
700
;> [_img]      = pointer to input image                                                           ;;
699
;> [_common]   = some most important options                                                      ;;
701
;> [_common]   = some most important/common options                                               ;;
700
;     0x00 :  byte : format id (defined in libimg.inc)                                            ;;
702
;     0x00 :  byte : format id (defined in libimg.inc)                                            ;;
701
;     0x01 :  byte : fast encoding (0) / best compression ratio (255)                             ;;
703
;     0x01 :  byte : fast encoding (0) / best compression ratio (255)                             ;;
702
;                    0 : store uncompressed data (if supported both by the format and libimg)     ;;
704
;                    0 : store uncompressed data (if supported both by the format and libimg)     ;;
703
;                    1 - 255 : use compression, if supported                                      ;;
705
;                    1 - 255 : use compression, if supported                                      ;;
704
;                    this option may be ignored if any format specific options are defined        ;;
706
;                    this option may be ignored if any format specific options are defined        ;;
705
;                    i.e. the 0 here will be ignored if some compression algorithm is specified   ;;
707
;                    i.e. 0 here will be ignored if particular compression algorithm is specified ;;
706
;     0x02 :  byte : flags (bitfield)                                                             ;;
708
;     0x02 :  byte : flags (bitfield)                                                             ;;
707
;                   0x01 : return an error if format specific conditions cannot be met            ;;
709
;                   0x01 : return an error if format specific conditions cannot be met            ;;
708
;                   0x02 : preserve current bit depth. means 8bpp/16bpp/24bpp and so on           ;;
710
;                   0x02 : preserve current bit depth. means 8bpp/16bpp/24bpp and so on           ;;
709
;                   0x04 : delete alpha channel, if any                                           ;;
711
;                   0x04 : delete alpha channel, if any                                           ;;
710
;                   0x08 : flush alpha channel with 0xff, if any; add it if none                  ;;
712
;                   0x08 : flush alpha channel with 0xff, if any; add it if none                  ;;
Line 2299... Line 2301...
2299
    pop edx ecx
2301
    pop edx ecx
2300
    jmp .exchange_dims
2302
    jmp .exchange_dims
Line 2301... Line 2303...
2301
 
2303
 
-
 
2304
 
-
 
2305
  .flip:
-
 
2306
    stdcall img.flip.layer, [_img], FLIP_VERTICAL
2302
 
2307
    test eax, eax
Line 2303... Line 2308...
2303
  .flip:
2308
    jz  .error
2304
    jmp .exit
2309
    jmp .exit
2305
 
2310
 
Line 2441... Line 2446...
2441
  .bpp24 dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp8g)
2446
  .bpp24 dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp8g)
2442
  .bpp32 dd (1 SHL Image.bpp24)
2447
  .bpp32 dd (1 SHL Image.bpp24)
2443
  .bpp15 dd (1 SHL Image.bpp24)
2448
  .bpp15 dd (1 SHL Image.bpp24)
2444
  .bpp16 dd (1 SHL Image.bpp24)
2449
  .bpp16 dd (1 SHL Image.bpp24)
2445
  .bpp1  dd (1 SHL Image.bpp24)
2450
  .bpp1  dd (1 SHL Image.bpp24)
2446
  .bpp8g dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp1 )
2451
  .bpp8g dd (1 SHL Image.bpp24) OR (1 SHL Image.bpp1 ) OR (1 SHL Image.bpp8g)
2447
  .bpp8a dd (1 SHL Image.bpp24)
2452
  .bpp8a dd (1 SHL Image.bpp24)
Line 2448... Line 2453...
2448
 
2453
 
2449
;;================================================================================================;;
2454
;;================================================================================================;;
2450
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
2455
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
Line 2654... Line 2659...
2654
endp
2659
endp
Line 2655... Line 2660...
2655
 
2660
 
2656
;;================================================================================================;;
2661
;;================================================================================================;;
2657
img._.get_scanline_len: ;/////////////////////////////////////////////////////////////////////////;;
2662
img._.get_scanline_len: ;/////////////////////////////////////////////////////////////////////////;;
2658
;;------------------------------------------------------------------------------------------------;;
2663
;;------------------------------------------------------------------------------------------------;;
2659
;? --- TBD ---                                                                                    ;;
2664
;? Get scanline length of image in bytes                                                          ;;
-
 
2665
;;------------------------------------------------------------------------------------------------;;
2660
;;------------------------------------------------------------------------------------------------;;
2666
;> eax = width of image in pixels                                                                 ;;
2661
;> --- TBD ---                                                                                    ;;
2667
;> ebx = image                                                                                    ;;
2662
;;------------------------------------------------------------------------------------------------;;
2668
;;------------------------------------------------------------------------------------------------;;
2663
;< --- TBD ---                                                                                    ;;
2669
;< eax = scanline length in bytes                                                                 ;;
2664
;;================================================================================================;;
2670
;;================================================================================================;;
2665
    cmp [ebx + Image.Type], Image.bpp1
2671
    cmp [ebx + Image.Type], Image.bpp1
2666
    jz  .bpp1.1
2672
    jz  .bpp1.1
2667
    cmp [ebx + Image.Type], Image.bpp2i
2673
    cmp [ebx + Image.Type], Image.bpp2i
Line 2769... Line 2775...
2769
    img.flip.layer   , 'img_flip_layer'   , \
2775
    img.flip.layer     , 'img_flip_layer'     , \
2770
    img.rotate       , 'img_rotate'       , \
2776
    img.rotate         , 'img_rotate'         , \
2771
    img.rotate.layer , 'img_rotate_layer' , \
2777
    img.rotate.layer   , 'img_rotate_layer'   , \
2772
    img.draw         , 'img_draw'         , \
2778
    img.draw           , 'img_draw'           , \
2773
    img.scale        , 'img_scale'        , \
2779
    img.scale          , 'img_scale'          , \
-
 
2780
    img.get_scaled_size, 'img_get_scaled_size', \
2774
    img.convert      , 'img_convert'      , \
2781
    img.convert        , 'img_convert'        , \
2775
    img.formats_table, 'img_formats_table'
2782
    img.formats_table  , 'img_formats_table'
Line 2776... Line 2783...
2776
 
2783
 
2777
; import from deflate unpacker
2784
; import from deflate unpacker