ImagingTypes.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /*
  2. $Id$
  3. Vampyre Imaging Library
  4. by Marek Mauder
  5. http://imaginglib.sourceforge.net
  6. The contents of this file are used with permission, subject to the Mozilla
  7. Public License Version 1.1 (the "License"); you may not use this file except
  8. in compliance with the License. You may obtain a copy of the License at
  9. http://www.mozilla.org/MPL/MPL-1.1.html
  10. Software distributed under the License is distributed on an "AS IS" basis,
  11. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  12. the specific language governing rights and limitations under the License.
  13. Alternatively, the contents of this file may be used under the terms of the
  14. GNU Lesser General Public License (the "LGPL License"), in which case the
  15. provisions of the LGPL License are applicable instead of those above.
  16. If you wish to allow use of your version of this file only under the terms
  17. of the LGPL License and not to allow others to use your version of this file
  18. under the MPL, indicate your decision by deleting the provisions above and
  19. replace them with the notice and other provisions required by the LGPL
  20. License. If you do not delete the provisions above, a recipient may use
  21. your version of this file under either the MPL or the LGPL License.
  22. For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
  23. */
  24. #ifndef IMAGINGTYPES_H
  25. #define IMAGINGTYPES_H
  26. #ifdef __cplusplus
  27. namespace Imaging
  28. {
  29. extern "C"
  30. {
  31. #endif
  32. #pragma pack(push, 1)
  33. #if defined(__WIN32__) || defined(_WIN32)
  34. #define ImagingAPI __cdecl
  35. #elif defined (linux) || defined (__linux__)
  36. #define ImagingAPI
  37. #endif
  38. #define ImagingMajor 0
  39. #define ImagingMinor 24
  40. #define ImagingPatch 0
  41. #define ImagingJpegQuality 10
  42. #define ImagingJpegProgressive 11
  43. #define ImagingBitmapRLE 12
  44. #define ImagingTargaRLE 13
  45. #define ImagingDDSLoadedCubeMap 14
  46. #define ImagingDDSLoadedVolume 15
  47. #define ImagingDDSLoadedMipMapCount 16
  48. #define ImagingDDSLoadedDepth 17
  49. #define ImagingDDSSaveCubeMap 18
  50. #define ImagingDDSSaveVolume 19
  51. #define ImagingDDSSaveMipMapCount 20
  52. #define ImagingDDSSaveDepth 21
  53. #define ImagingPNGPreFilter 25
  54. #define ImagingPNGCompressLevel 26
  55. #define ImagingMNGLossyCompression 28
  56. #define ImagingMNGLossyAlpha 29
  57. #define ImagingMNGPreFilter 30
  58. #define ImagingMNGCompressLevel 31
  59. #define ImagingMNGQuality 32
  60. #define ImagingMNGProgressive 33
  61. #define ImagingJNGLossyAlpha 40
  62. #define ImagingJNGAlphaPreFilter 41
  63. #define ImagingJNGAlphaCompressLevel 42
  64. #define ImagingJNGQuality 43
  65. #define ImagingJNGProgressive 44
  66. #define ImagingJpeg2000Quality 55;
  67. #define ImagingJpeg2000CodeStreamOnly 56;
  68. #define ImagingJpeg2000LosslessCompression 57;
  69. #define ImagingTiffCompression 65;
  70. #define ImagingColorReductionMask 128
  71. #define ImagingLoadOverrideFormat 129
  72. #define ImagingSaveOverrideFormat 130
  73. #define ImagingMipMapFilter 131
  74. #define InvalidOption -0x7FFFFFFF
  75. #define ChannelBlue 0
  76. #define ChannelGreen 1
  77. #define ChannelRed 2
  78. #define ChannelAlpha 3
  79. #define False 0
  80. #define True 1
  81. typedef unsigned char Byte;
  82. typedef Byte Boolean;
  83. typedef unsigned short Word;
  84. typedef unsigned long LongWord;
  85. typedef void * Pointer;
  86. typedef enum TImageFormat
  87. {
  88. ifUnknown = 0,
  89. ifDefault = 1,
  90. /* indexed formats */
  91. ifIndex8 = 10,
  92. /* grayscale formats */
  93. ifGray8 = 40,
  94. ifA8Gray8 = 41,
  95. ifGray16 = 42,
  96. ifGray32 = 43,
  97. ifGray64 = 44,
  98. ifA16Gray16 = 45,
  99. /* ARGB formats */
  100. ifR1G1B1 = 80,
  101. ifR3G3B2 = 81,
  102. ifR5G6B5 = 82,
  103. ifA1R5G5B5 = 83,
  104. ifA4R4G4B4 = 84,
  105. ifX1R5G5B5 = 85,
  106. ifX4R4G4B4 = 86,
  107. ifR8G8B8 = 87,
  108. ifA8R8G8B8 = 88,
  109. ifX8R8G8B8 = 89,
  110. ifR16G16B16 = 90,
  111. ifA16R16G16B16 = 91,
  112. ifB16G16R16 = 92,
  113. ifA16B16G16R16 = 93,
  114. /* floating-point formats */
  115. ifR32F = 170,
  116. ifA32R32G32B32F = 171,
  117. ifA32B32G32R32F = 172,
  118. ifR16F = 173,
  119. ifA16R16G16B16F = 174,
  120. ifA16B16G16R16F = 175,
  121. /* special formats */
  122. ifDXT1 = 220,
  123. ifDXT3 = 221,
  124. ifDXT5 = 222,
  125. ifBTC = 223,
  126. /* dummy */
  127. ifForce32 = 0x7FFFFFFF
  128. } TImageFormat;
  129. typedef unsigned long TColor32;
  130. typedef struct TColor64
  131. {
  132. TColor32 Low;
  133. TColor32 High;
  134. } TColor64;
  135. typedef struct TColor24Rec
  136. {
  137. union
  138. {
  139. struct
  140. {
  141. Byte B;
  142. Byte G;
  143. Byte R;
  144. };
  145. Byte Channels[3];
  146. };
  147. } TColor24Rec;
  148. typedef struct TColor32Rec
  149. {
  150. union
  151. {
  152. struct
  153. {
  154. Byte B;
  155. Byte G;
  156. Byte R;
  157. Byte A;
  158. };
  159. TColor32 Color;
  160. Byte Channels[4];
  161. };
  162. } TColor32Rec;
  163. typedef struct TColor48Rec
  164. {
  165. union
  166. {
  167. struct
  168. {
  169. Word B;
  170. Word G;
  171. Word R;
  172. };
  173. Word Channels[3];
  174. };
  175. } TColor48Rec;
  176. typedef struct TColor64Rec
  177. {
  178. union
  179. {
  180. struct
  181. {
  182. Word B;
  183. Word G;
  184. Word R;
  185. Word A;
  186. };
  187. TColor64 Color;
  188. Word Channels[4];
  189. };
  190. } TColor64Rec;
  191. typedef struct TColorFPRec
  192. {
  193. union
  194. {
  195. struct
  196. {
  197. float B;
  198. float G;
  199. float R;
  200. float A;
  201. };
  202. float Channels[4];
  203. };
  204. } TColorFPRec;
  205. typedef TColor32Rec * PPalette32;
  206. typedef struct TImageData
  207. {
  208. int Width;
  209. int Height;
  210. TImageFormat Format;
  211. int Size;
  212. void * Bits;
  213. PPalette32 Palette;
  214. } TImageData;
  215. typedef TImageData * PImageData;
  216. typedef struct TPixelFormat
  217. {
  218. Byte ABitCount, RBitCount, GBitCount, BBitCount;
  219. LongWord ABitMask, RBitMask, GBitMask, BBitMask;
  220. Byte AShift, RShift, GShift, BShift;
  221. Byte ARecDiv, RRecDiv, GRecDiv, BRecDiv;
  222. } TPixelFormat;
  223. typedef TPixelFormat * PPixelFormat;
  224. typedef struct TImageFormatInfo
  225. {
  226. TImageFormat Format;
  227. char Name[16];
  228. Byte BytesPerPixel;
  229. int PaletteEntries;
  230. Boolean HasGrayChannel;
  231. Boolean HasAlphaChannel;
  232. Boolean IsFloatingPoint;
  233. Boolean UsePixelFormat;
  234. Boolean IsRBSwapped;
  235. Boolean IsIndexed;
  236. Boolean IsSpecial;
  237. PPixelFormat PixelFormat;
  238. Pointer GetPixelsSize;
  239. Pointer CheckDimensions;
  240. Pointer GetPixel32;
  241. Pointer GetPixelFP;
  242. Pointer SetPixel32;
  243. Pointer SetPixelFP;
  244. } TImageFormatInfo;
  245. typedef TImageFormatInfo * PImageFormatInfo;
  246. typedef unsigned long TImageDataList;
  247. typedef TImageDataList * PImageDataList;
  248. typedef Pointer TImagingHandle;
  249. typedef enum TResizeFilter
  250. {
  251. rfNearest = 0,
  252. rfBilinear = 1,
  253. rfBicubic = 2
  254. } TResizeFilter;
  255. typedef enum TSeekMode
  256. {
  257. smFromBeginning = 0,
  258. smFromCurrent = 1,
  259. smFromEnd = 2
  260. } TSeekMode;
  261. typedef TImagingHandle (ImagingAPI * TOpenReadProc) (char * Source);
  262. typedef TImagingHandle (ImagingAPI * TOpenWriteProc) (char * Source);
  263. typedef void (ImagingAPI * TCloseProc) (TImagingHandle Handle);
  264. typedef Boolean (ImagingAPI * TEofProc) (TImagingHandle Handle);
  265. typedef int (ImagingAPI * TSeekProc) (TImagingHandle Handle, int Offset, TSeekMode Mode);
  266. typedef int (ImagingAPI * TTellProc) (TImagingHandle Handle);
  267. typedef int (ImagingAPI * TReadProc) (TImagingHandle Handle, Pointer Buffer, int Count);
  268. typedef int (ImagingAPI * TWriteProc) (TImagingHandle Handle, Pointer Buffer, int Count);
  269. #ifdef __cplusplus
  270. }
  271. }
  272. #endif
  273. #pragma pack(pop)
  274. #endif
  275. /*
  276. Changes/Bug Fixes:
  277. -- 0.21 -----------------------------------------------------
  278. - Added ifForce32 to TImageFormat to ensure that this enum has size of 4 bytes.
  279. */