Subversion Repositories Kolibri OS

Rev

Rev 1921 | Rev 2684 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1921 Rev 2388
1
;;================================================================================================;;
1
;;================================================================================================;;
2
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ////////////////////////////////;;
2
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ////////////////////////////////;;
3
;;================================================================================================;;
3
;;================================================================================================;;
4
;;                                                                                                ;;
4
;;                                                                                                ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
6
;;                                                                                                ;;
6
;;                                                                                                ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
8
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
8
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
9
;; of the License, or (at your option) any later version.                                         ;;
9
;; of the License, or (at your option) any later version.                                         ;;
10
;;                                                                                                ;;
10
;;                                                                                                ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
13
;; Lesser General Public License for more details.                                                ;;
13
;; Lesser General Public License for more details.                                                ;;
14
;;                                                                                                ;;
14
;;                                                                                                ;;
15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
16
;; If not, see .                                                    ;;
16
;; If not, see .                                                    ;;
17
;;                                                                                                ;;
17
;;                                                                                                ;;
18
;;================================================================================================;;
18
;;================================================================================================;;
19
 
19
 
20
 
20
 
21
struct FormatsTableEntry
21
struct FormatsTableEntry
22
  Is     dd ?
22
  Is     dd ?
23
  Decode dd ?
23
  Decode dd ?
24
  Encode dd ?
24
  Encode dd ?
25
ends
25
ends
26
 
26
 
27
struct Image
27
struct Image
28
  Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0]
28
  Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0]
29
  Width    dd ?
29
  Width    dd ?
30
  Height   dd ?
30
  Height   dd ?
31
  Next     dd ?
31
  Next     dd ?
32
  Previous dd ?
32
  Previous dd ?
33
  Type     dd ? ; one of Image.bppN
33
  Type     dd ? ; one of Image.bppN
34
  Data     dd ?
34
  Data     dd ?
35
  Palette  dd ? ; used iff Type eq Image.bpp8 or Image.bpp1
35
  Palette  dd ? ; used iff Type eq Image.bpp8 or Image.bpp1
36
  Extended dd ?
36
  Extended dd ?
37
  Flags    dd ? ; bitfield
37
  Flags    dd ? ; bitfield
38
  Delay    dd ? ; used iff Image.IsAnimated is set in Flags
38
  Delay    dd ? ; used iff Image.IsAnimated is set in Flags
39
ends
39
ends
40
 
40
 
41
; values for Image.Type
41
; values for Image.Type
42
; must be consecutive to allow fast switch on Image.Type in support functions
42
; must be consecutive to allow fast switch on Image.Type in support functions
43
Image.bpp8  = 1
43
Image.bpp8  = 1
44
Image.bpp24 = 2
44
Image.bpp24 = 2
45
Image.bpp32 = 3
45
Image.bpp32 = 3
46
Image.bpp15 = 4
46
Image.bpp15 = 4
47
Image.bpp16 = 5
47
Image.bpp16 = 5
48
Image.bpp1  = 6
48
Image.bpp1  = 6
-
 
49
Image.bpp4  = 7
49
 
50
 
50
; bits in Image.Flags
51
; bits in Image.Flags
51
Image.IsAnimated = 1
52
Image.IsAnimated = 1
52
 
53
 
53
struct ImageDecodeOptions
54
struct ImageDecodeOptions
54
  UsedSize        dd ? ; if >=8, the field BackgroundColor is valid, and so on
55
  UsedSize        dd ? ; if >=8, the field BackgroundColor is valid, and so on
55
  BackgroundColor dd ? ; used for transparent images as background
56
  BackgroundColor dd ? ; used for transparent images as background
56
ends
57
ends
57
 
58
 
58
FLIP_VERTICAL   = 0x01
59
FLIP_VERTICAL   = 0x01
59
FLIP_HORIZONTAL = 0x02
60
FLIP_HORIZONTAL = 0x02
60
FLIP_BOTH   = FLIP_VERTICAL or FLIP_HORIZONTAL
61
FLIP_BOTH   = FLIP_VERTICAL or FLIP_HORIZONTAL
61
 
62
 
62
ROTATE_90_CW   = 0x01
63
ROTATE_90_CW   = 0x01
63
ROTATE_180     = 0x02
64
ROTATE_180     = 0x02
64
ROTATE_270_CW  = 0x03
65
ROTATE_270_CW  = 0x03
65
ROTATE_90_CCW  = ROTATE_270_CW
66
ROTATE_90_CCW  = ROTATE_270_CW
66
ROTATE_270_CCW = ROTATE_90_CW
67
ROTATE_270_CCW = ROTATE_90_CW