Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
717 mikedld 1
;;================================================================================================;;
999 diamond 2
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ////////////////////////////////;;
717 mikedld 3
;;================================================================================================;;
4
;;                                                                                                ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
6
;;                                                                                                ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
999 diamond 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.                                         ;;
717 mikedld 10
;;                                                                                                ;;
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  ;;
999 diamond 13
;; Lesser General Public License for more details.                                                ;;
717 mikedld 14
;;                                                                                                ;;
999 diamond 15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
16
;; If not, see .                                                    ;;
717 mikedld 17
;;                                                                                                ;;
18
;;================================================================================================;;
19
 
2684 dunkaist 20
; list of format id's
21
LIBIMG_FORMAT_ID_BMP	= 1
22
LIBIMG_FORMAT_ID_ICO	= 2
23
LIBIMG_FORMAT_ID_CUR	= 3
24
LIBIMG_FORMAT_ID_GIF	= 4
25
LIBIMG_FORMAT_ID_PNG	= 5
26
LIBIMG_FORMAT_ID_JPEG	= 6
27
LIBIMG_FORMAT_ID_TGA	= 7
28
LIBIMG_FORMAT_ID_PCX	= 8
29
LIBIMG_FORMAT_ID_XCF	= 9
30
LIBIMG_FORMAT_ID_TIFF	= 10
31
LIBIMG_FORMAT_ID_PNM	= 11
32
LIBIMG_FORMAT_ID_WBMP	= 12
33
LIBIMG_FORMAT_ID_Z80	= 13
717 mikedld 34
 
2684 dunkaist 35
; error codes
36
LIBIMG_ERROR_OUT_OF_MEMORY = 1
37
LIBIMG_ERROR_FORMAT        = 2
38
LIBIMG_ERROR_CONDITIONS    = 3
39
LIBIMG_ERROR_BIT_DEPTH     = 4
40
LIBIMG_ERROR_ENCODER       = 5
41
 
42
; encode flags (byte 0x02 of _common option)
43
LIBIMG_ENCODE_STRICT_SPECIFIC  = 0x01
44
LIBIMG_ENCODE_STRICT_BIT_DEPTH = 0x02
45
LIBIMG_ENCODE_DELETE_ALPHA     = 0x08
46
LIBIMG_ENCODE_FLUSH_ALPHA      = 0x10
47
 
717 mikedld 48
struct FormatsTableEntry
2684 dunkaist 49
  Format_id	dd ?
50
  Is		dd ?
51
  Decode	dd ?
52
  Encode	dd ?
53
  Capabilities	dd ?
717 mikedld 54
ends
55
 
56
struct Image
57
  Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0]
58
  Width    dd ?
59
  Height   dd ?
1593 dunkaist 60
  Next     dd ?
717 mikedld 61
  Previous dd ?
999 diamond 62
  Type     dd ? ; one of Image.bppN
1593 dunkaist 63
  Data     dd ?
1921 dunkaist 64
  Palette  dd ? ; used iff Type eq Image.bpp8 or Image.bpp1
717 mikedld 65
  Extended dd ?
1079 diamond 66
  Flags    dd ? ; bitfield
67
  Delay    dd ? ; used iff Image.IsAnimated is set in Flags
717 mikedld 68
ends
69
 
1079 diamond 70
; values for Image.Type
71
; must be consecutive to allow fast switch on Image.Type in support functions
72
Image.bpp8  = 1
999 diamond 73
Image.bpp24 = 2
74
Image.bpp32 = 3
1079 diamond 75
Image.bpp15 = 4
76
Image.bpp16 = 5
1593 dunkaist 77
Image.bpp1  = 6
2388 dunkaist 78
Image.bpp4  = 7
999 diamond 79
 
1079 diamond 80
; bits in Image.Flags
81
Image.IsAnimated = 1
82
 
1102 diamond 83
struct ImageDecodeOptions
84
  UsedSize        dd ? ; if >=8, the field BackgroundColor is valid, and so on
85
  BackgroundColor dd ? ; used for transparent images as background
86
ends
87
 
1593 dunkaist 88
FLIP_VERTICAL   = 0x01
717 mikedld 89
FLIP_HORIZONTAL = 0x02
1593 dunkaist 90
FLIP_BOTH   = FLIP_VERTICAL or FLIP_HORIZONTAL
783 mikedld 91
 
92
ROTATE_90_CW   = 0x01
93
ROTATE_180     = 0x02
94
ROTATE_270_CW  = 0x03
95
ROTATE_90_CCW  = ROTATE_270_CW
96
ROTATE_270_CCW = ROTATE_90_CW