2
0

ImagingNET.pas 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468
  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. { This is import wrapper for Delphi.NET. You need VampyreImaging.dll
  25. located somewhere Windows can find it. You can use functions directly
  26. imported from DLL or much more dotNET-like Imaging class members.
  27. Note that this wrapper was not tested extensively so there may be various bugs.}
  28. unit ImagingNET;
  29. {$MINENUMSIZE 4}
  30. interface
  31. uses
  32. System.Runtime.InteropServices, System.Security, System.Text, SysUtils;
  33. const
  34. ImagingVersionMajor = 0;
  35. ImagingVersionMinor = 24;
  36. ImagingVersionPatch = 0;
  37. ImagingJpegQuality = 10;
  38. ImagingJpegProgressive = 11;
  39. ImagingBitmapRLE = 12;
  40. ImagingTargaRLE = 13;
  41. ImagingDDSLoadedCubeMap = 14;
  42. ImagingDDSLoadedVolume = 15;
  43. ImagingDDSLoadedMipMapCount = 16;
  44. ImagingDDSLoadedDepth = 17;
  45. ImagingDDSSaveCubeMap = 18;
  46. ImagingDDSSaveVolume = 19;
  47. ImagingDDSSaveMipMapCount = 20;
  48. ImagingDDSSaveDepth = 21;
  49. ImagingPNGPreFilter = 25;
  50. ImagingPNGCompressLevel = 26;
  51. ImagingMNGLossyCompression = 28;
  52. ImagingMNGLossyAlpha = 29;
  53. ImagingMNGPreFilter = 30;
  54. ImagingMNGCompressLevel = 31;
  55. ImagingMNGQuality = 32;
  56. ImagingMNGProgressive = 33;
  57. ImagingJNGLossyAlpha = 40;
  58. ImagingJNGAlphaPreFilter = 41;
  59. ImagingJNGAlphaCompressLevel = 42;
  60. ImagingJNGQuality = 43;
  61. ImagingJNGProgressive = 44;
  62. ImagingPGMSaveBinary = 50;
  63. ImagingPPMSaveBinary = 51;
  64. ImagingJpeg2000Quality = 55;
  65. ImagingJpeg2000CodeStreamOnly = 56;
  66. ImagingJpeg2000LosslessCompression = 57;
  67. ImagingTiffCompression = 65;
  68. ImagingColorReductionMask = 128;
  69. ImagingLoadOverrideFormat = 129;
  70. ImagingSaveOverrideFormat = 130;
  71. ImagingMipMapFilter = 131;
  72. InvalidOption = -$7FFFFFFF;
  73. ChannelBlue = 0;
  74. ChannelGreen = 1;
  75. ChannelRed = 2;
  76. ChannelAlpha = 3;
  77. type
  78. TImageFormat = (
  79. ifUnknown = 0,
  80. ifDefault = 1,
  81. // indexed formats using palette
  82. ifIndex8 = 10,
  83. // grayscale formats
  84. ifGray8 = 40,
  85. ifA8Gray8 = 41,
  86. ifGray16 = 42,
  87. ifGray32 = 43,
  88. ifGray64 = 44,
  89. ifA16Gray16 = 45,
  90. // ARGB formats
  91. ifX5R1G1B1 = 80,
  92. ifR3G3B2 = 81,
  93. ifR5G6B5 = 82,
  94. ifA1R5G5B5 = 83,
  95. ifA4R4G4B4 = 84,
  96. ifX1R5G5B5 = 85,
  97. ifX4R4G4B4 = 86,
  98. ifR8G8B8 = 87,
  99. ifA8R8G8B8 = 88,
  100. ifX8R8G8B8 = 89,
  101. ifR16G16B16 = 90,
  102. ifA16R16G16B16 = 91,
  103. ifB16G16R16 = 92,
  104. ifA16B16G16R16 = 93,
  105. // floating point formats
  106. ifR32F = 170,
  107. ifA32R32G32B32F = 171,
  108. ifA32B32G32R32F = 172,
  109. ifR16F = 173,
  110. ifA16R16G16B16F = 174,
  111. ifA16B16G16R16F = 175,
  112. // special formats
  113. ifDXT1 = 220,
  114. ifDXT3 = 221,
  115. ifDXT5 = 222,
  116. ifBTC = 223);
  117. TColor32 = UInt32;
  118. TColor64 = UInt64;
  119. TPalette32 = IntPtr;
  120. TImageDataList = UInt32;
  121. [StructLayout(LayoutKind.Sequential)]
  122. TImageData = packed record
  123. Width: LongInt;
  124. Height: LongInt;
  125. Format: TImageFormat;
  126. Size: LongInt;
  127. Bits: IntPtr;
  128. Palette: TPalette32;
  129. end;
  130. [StructLayout(LayoutKind.Sequential)]
  131. TImageFormatInfo = packed record
  132. Format: TImageFormat;
  133. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
  134. Name: string;
  135. BytesPerPixel: Byte;
  136. PaletteEntries: LongInt;
  137. HasGrayChannel: Boolean;
  138. HasAlphaChannel: Boolean;
  139. IsFloatingPoint: Boolean;
  140. UsePixelFormat: Boolean;
  141. IsRBSwapped: Boolean;
  142. IsIndexed: Boolean;
  143. IsSpecial: Boolean;
  144. PixelFormat: IntPtr;
  145. GetPixelsSize: IntPtr;
  146. CheckDimensions: IntPtr;
  147. GetPixel32: IntPtr;
  148. GetPixelFP: IntPtr;
  149. SetPixel32: IntPtr;
  150. SetPixelFP: IntPtr;
  151. end;
  152. TResizeFilter = (
  153. rfNearest = 0,
  154. rfBilinear = 1,
  155. rfBicubic = 2);
  156. TColor24Rec = record;
  157. TColor32Rec = record;
  158. TColor48Rec = record;
  159. TColor64Rec = record;
  160. TColorFPRec = record;
  161. TColor24Rec = packed record
  162. public
  163. B, G, R: Byte;
  164. function SetColor(Color: TColor32): TColor24Rec; overload;
  165. function SetColor(R, G, B: Byte): TColor24Rec; overload;
  166. function SetColor(ColorRec: TColor24Rec): TColor24Rec; overload;
  167. function SetColor(ColorRec: TColor32Rec): TColor24Rec; overload;
  168. function SetColor(ColorRec: TColor48Rec): TColor24Rec; overload;
  169. function SetColor(ColorRec: TColor64Rec): TColor24Rec; overload;
  170. function SetColor(ColorRec: TColorFPRec): TColor24Rec; overload;
  171. function GetColor: TColor32;
  172. class operator Equal(const Left, Right: TColor24Rec): Boolean;
  173. class operator NotEqual(const Left, Right: TColor24Rec): Boolean;
  174. end;
  175. TColor32Rec = packed record
  176. public
  177. B, G, R, A: Byte;
  178. function SetColor(Color: TColor32): TColor32Rec; overload;
  179. function SetColor(A, R, G, B: Byte): TColor32Rec; overload;
  180. function SetColor(ColorRec: TColor24Rec): TColor32Rec; overload;
  181. function SetColor(ColorRec: TColor32Rec): TColor32Rec; overload;
  182. function SetColor(ColorRec: TColor48Rec): TColor32Rec; overload;
  183. function SetColor(ColorRec: TColor64Rec): TColor32Rec; overload;
  184. function SetColor(ColorRec: TColorFPRec): TColor32Rec; overload;
  185. function GetColor: TColor32;
  186. class operator Equal(const Left, Right: TColor32Rec): Boolean;
  187. class operator NotEqual(const Left, Right: TColor32Rec): Boolean;
  188. end;
  189. TColor48Rec = packed record
  190. public
  191. B, G, R: Word;
  192. function SetColor(Color: TColor64): TColor48Rec; overload;
  193. function SetColor(R, G, B: Word): TColor48Rec; overload;
  194. function SetColor(ColorRec: TColor24Rec): TColor48Rec; overload;
  195. function SetColor(ColorRec: TColor32Rec): TColor48Rec; overload;
  196. function SetColor(ColorRec: TColor48Rec): TColor48Rec; overload;
  197. function SetColor(ColorRec: TColor64Rec): TColor48Rec; overload;
  198. function SetColor(ColorRec: TColorFPRec): TColor48Rec; overload;
  199. function GetColor: TColor64;
  200. class operator Equal(const Left, Right: TColor48Rec): Boolean;
  201. class operator NotEqual(const Left, Right: TColor48Rec): Boolean;
  202. end;
  203. TColor64Rec = packed record
  204. public
  205. B, G, R, A: Word;
  206. function SetColor(Color: TColor64): TColor64Rec; overload;
  207. function SetColor(A, R, G, B: Word): TColor64Rec; overload;
  208. function SetColor(ColorRec: TColor24Rec): TColor64Rec; overload;
  209. function SetColor(ColorRec: TColor32Rec): TColor64Rec; overload;
  210. function SetColor(ColorRec: TColor48Rec): TColor64Rec; overload;
  211. function SetColor(ColorRec: TColor64Rec): TColor64Rec; overload;
  212. function SetColor(ColorRec: TColorFPRec): TColor64Rec; overload;
  213. function GetColor: TColor64;
  214. class operator Equal(const Left, Right: TColor64Rec): Boolean;
  215. class operator NotEqual(const Left, Right: TColor64Rec): Boolean;
  216. end;
  217. TColorFPRec = packed record
  218. public
  219. B, G, R, A: Single;
  220. function SetColor(Color: TColor64): TColorFPRec; overload;
  221. function SetColor(A, R, G, B: Single): TColorFPRec; overload;
  222. function SetColor(ColorRec: TColor24Rec): TColorFPRec; overload;
  223. function SetColor(ColorRec: TColor32Rec): TColorFPRec; overload;
  224. function SetColor(ColorRec: TColor48Rec): TColorFPRec; overload;
  225. function SetColor(ColorRec: TColor64Rec): TColorFPRec; overload;
  226. function SetColor(ColorRec: TColorFPRec): TColorFPRec; overload;
  227. function GetColor: TColor64;
  228. class operator Equal(const Left, Right: TColorFPRec): Boolean;
  229. class operator NotEqual(const Left, Right: TColorFPRec): Boolean;
  230. end;
  231. TDynImageDataArray = array of TImageData;
  232. const
  233. LibraryName = 'VampyreImaging.dll';
  234. { Low Level Imported Functions }
  235. { General Functions }
  236. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  237. procedure ImGetVersion(var Major, Minor, Patch: LongInt); external;
  238. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  239. procedure ImInitImage(var Image: TImageData); external;
  240. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  241. function ImNewImage(Width, Height: LongInt; Format: TImageFormat;
  242. var Image: TImageData): Boolean; external;
  243. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  244. function ImTestImage(const Image: TImageData): Boolean; external;
  245. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  246. function ImFreeImage(var Image: TImageData): Boolean; external;
  247. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  248. function ImDetermineFileFormat(const FileName: string; Ext: StringBuilder): Boolean; external;
  249. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  250. function ImDetermineMemoryFormat(Data: array of Byte; Size: LongInt; Ext: StringBuilder): Boolean; external;
  251. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  252. function ImIsFileFormatSupported(const FileName: string): Boolean; external;
  253. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  254. function ImEnumFileFormats(var Index: LongInt; Name, DefaultExt, Masks: StringBuilder;
  255. var CanSave, IsMultiImageFormat: Boolean): Boolean; external;
  256. { Image List Functions }
  257. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  258. function ImInitImageList(Size: LongInt; var ImageList: TImageDataList): Boolean; external;
  259. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  260. function ImGetImageListSize(ImageList: TImageDataList): LongInt; external;
  261. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  262. function ImGetImageListElement(ImageList: TImageDataList; Index: LongInt;
  263. var OutImage: TImageData): Boolean; external;
  264. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  265. function ImSetImageListSize(ImageList: TImageDataList; NewSize: LongInt): Boolean; external;
  266. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  267. function ImSetImageListElement(ImageList: TImageDataList; Index: LongInt;
  268. var InImage: TImageData): Boolean; external;
  269. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  270. function ImTestImagesInList(ImageList: TImageDataList): Boolean; external;
  271. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  272. function ImFreeImageList(var ImageList: TImageDataList): Boolean; external;
  273. { Loading Functions }
  274. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  275. function ImLoadImageFromFile(const FileName: string; var Image: TImageData): Boolean; external;
  276. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  277. function ImLoadImageFromMemory(const Data: array of Byte; Size: LongInt;
  278. var Image: TImageData): Boolean; external;
  279. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  280. function ImLoadMultiImageFromFile(const FileName: string; var ImageList: TImageDataList): Boolean; external;
  281. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  282. function ImLoadMultiImageFromMemory(const Data: array of Byte; Size: LongInt;
  283. var ImageList: TImageDataList): Boolean; external;
  284. { Saving Functions }
  285. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  286. function ImSaveImageToFile(const FileName: string; const Image: TImageData): Boolean; external;
  287. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  288. function ImSaveImageToMemory(const Ext: string; const Data: array of Byte; var Size: LongInt;
  289. const Image: TImageData): Boolean; external;
  290. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  291. function ImSaveMultiImageToFile(const FileName: string; ImageList: TImageDataList): Boolean; external;
  292. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  293. function ImSaveMultiImageToMemory(const Ext: string; const Data: array of Byte; var Size: LongInt;
  294. ImageList: TImageDataList): Boolean; external;
  295. { Manipulation Functions }
  296. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  297. function ImCloneImage(const Image: TImageData; var Clone: TImageData): Boolean; external;
  298. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  299. function ImConvertImage(var Image: TImageData; DestFormat: TImageFormat): Boolean; external;
  300. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  301. function ImFlipImage(var Image: TImageData): Boolean; external;
  302. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  303. function ImMirrorImage(var Image: TImageData): Boolean; external;
  304. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  305. function ImResizeImage(var Image: TImageData; NewWidth, NewHeight: LongInt; Filter: TResizeFilter): Boolean; external;
  306. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  307. function ImSwapChannels(var Image: TImageData; SrcChannel, DstChannel: LongInt): Boolean; external;
  308. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  309. function ImReduceColors(var Image: TImageData; MaxColors: LongInt): Boolean; external;
  310. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  311. function ImGenerateMipMaps(const Image: TImageData; Levels: LongInt;
  312. var MipMaps: TImageDataList): Boolean; external;
  313. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  314. function ImMapImageToPalette(var Image: TImageData; Pal: TPalette32;
  315. Entries: LongInt): Boolean; external;
  316. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  317. function ImSplitImage(var Image: TImageData; var Chunks: TImageDataList;
  318. ChunkWidth, ChunkHeight: LongInt; var XChunks, YChunks: LongInt;
  319. PreserveSize: Boolean; Fill: IntPtr): Boolean; external;
  320. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  321. function ImMakePaletteForImages(var Images: TImageDataList; Pal: TPalette32;
  322. MaxColors: LongInt; ConvertImages: Boolean): Boolean; external;
  323. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  324. function ImRotateImage(var Image: TImageData; Angle: LongInt): Boolean; external;
  325. { Drawing/Pixel functions }
  326. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  327. function ImCopyRect(const SrcImage: TImageData; SrcX, SrcY, Width, Height: LongInt;
  328. var DstImage: TImageData; DstX, DstY: LongInt): Boolean; external;
  329. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  330. function ImFillRect(var Image: TImageData; X, Y, Width, Height: LongInt;
  331. Fill: IntPtr): Boolean; external;
  332. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  333. function ImReplaceColor(var Image: TImageData; X, Y, Width, Height: LongInt;
  334. OldPixel, NewPixel: IntPtr): Boolean; external;
  335. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  336. function ImStretchRect(const SrcImage: TImageData; SrcX, SrcY, SrcWidth,
  337. SrcHeight: LongInt; var DstImage: TImageData; DstX, DstY, DstWidth,
  338. DstHeight: LongInt; Filter: TResizeFilter): Boolean; external;
  339. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  340. procedure ImGetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: IntPtr); external;
  341. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  342. procedure ImSetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: IntPtr); external;
  343. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  344. function ImGetPixel32(const Image: TImageData; X, Y: LongInt): TColor32Rec; external;
  345. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  346. procedure ImSetPixel32(const Image: TImageData; X, Y: LongInt; const Color: TColor32Rec); external;
  347. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  348. function ImGetPixelFP(const Image: TImageData; X, Y: LongInt): TColorFPRec; external;
  349. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  350. procedure ImSetPixelFP(const Image: TImageData; X, Y: LongInt; const Color: TColorFPRec); external;
  351. { Palette Functions }
  352. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  353. function ImNewPalette(Entries: LongInt; var Pal: TPalette32): Boolean; external;
  354. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  355. function ImFreePalette(var Pal: TPalette32): Boolean; external;
  356. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  357. function ImCopyPalette(SrcPal, DstPal: TPalette32; SrcIdx, DstIdx, Count: LongInt): Boolean; external;
  358. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  359. function ImFindColor(Pal: TPalette32; Entries: LongInt; Color: TColor32): LongInt; external;
  360. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  361. function ImFillGrayscalePalette(Pal: TPalette32; Entries: LongInt): Boolean; external;
  362. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  363. function ImFillCustomPalette(Pal: TPalette32; Entries: LongInt; RBits, GBits,
  364. BBits: Byte; Alpha: Byte): Boolean; external;
  365. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  366. function ImSwapChannelsOfPalette(Pal: TPalette32; Entries, SrcChannel,
  367. DstChannel: LongInt): Boolean; external;
  368. { Options Functions }
  369. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  370. function ImSetOption(OptionId, Value: LongInt): Boolean; external;
  371. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  372. function ImGetOption(OptionId: LongInt): LongInt; external;
  373. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  374. function ImPushOptions: Boolean; external;
  375. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  376. function ImPopOptions: Boolean; external;
  377. { Image Format Functions }
  378. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  379. function ImGetPixelBytes(Format: TImageFormat): LongInt; external;
  380. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  381. function ImGetImageFormatInfo(Format: TImageFormat; var Info: TImageFormatInfo): Boolean; external;
  382. [SuppressUnmanagedCodeSecurity, DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
  383. function ImGetPixelsSize(Format: TImageFormat; Width, Height: LongInt): LongInt; external;
  384. type
  385. { Record with information about one of imag file formats supported by Imaging.}
  386. TFileFormatInfo = record
  387. Name: string;
  388. DefaultExt: string;
  389. Masks: string;
  390. CanSave: Boolean;
  391. IsMultiImageFormat: Boolean;
  392. end;
  393. { Class which encapsulates all Imaging functions without Im prefix and
  394. with dotNET friendly parameter types. There are also some dotNET only
  395. members.}
  396. Imaging = class(TObject)
  397. public
  398. class var FileFormats: array of TFileFormatInfo;
  399. class procedure BuildFileFormatList;
  400. class function EnumFileFormats(var Index: LongInt; var Name, DefaultExt, Masks: string; var CanSave, IsMultiImageFormat: Boolean): Boolean; static;
  401. class function ListToArray(List: TImageDataList; var Arr: TDynImageDataArray): Boolean; static;
  402. class function ArrayToList(const Arr: TDynImageDataArray; var List: TImageDataList): Boolean; static;
  403. public
  404. { General Functions }
  405. class procedure GetVersion(var Major, Minor, Patch: LongInt); static;
  406. class procedure InitImage(var Image: TImageData); static;
  407. class function NewImage(Width, Height: LongInt; Format: TImageFormat; var Image: TImageData): Boolean; static;
  408. class function TestImage(const Image: TImageData): Boolean; static;
  409. class function FreeImage(var Image: TImageData): Boolean; static;
  410. class function FreeImagesInArray(var Images: TDynImageDataArray): Boolean; static;
  411. class function TestImagesInArray(const Images: TDynImageDataArray): Boolean; static;
  412. class function DetermineFileFormat(const FileName: string): string; static;
  413. class function DetermineMemoryFormat(const Data: array of Byte): string; static;
  414. class function IsFileFormatSupported(const FileName: string): Boolean; static;
  415. class function GetFileFormatCount: LongInt; static;
  416. class function GetFileFormatInfo(Index: LongInt): TFileFormatInfo; static;
  417. class function GetImageFileFormatsFilter(OpenFileFilter: Boolean): string; static;
  418. { Loading Functions }
  419. class function LoadImageFromFile(const FileName: string; var Image: TImageData): Boolean; static;
  420. class function LoadImageFromMemory(const Data: array of Byte; var Image: TImageData): Boolean; static;
  421. class function LoadMultiImageFromFile(const FileName: string; var Images: TDynImageDataArray): Boolean; static;
  422. class function LoadMultiImageFromMemory(const Data: array of Byte; var Images: TDynImageDataArray): Boolean; static;
  423. { Saving Functions }
  424. class function SaveImageToFile(const FileName: string; const Image: TImageData): Boolean; static;
  425. class function SaveImageToMemory(const Ext: string; Data: array of Byte; var Size: LongInt; const Image: TImageData): Boolean; static;
  426. class function SaveMultiImageToFile(const FileName: string; const Images: TDynImageDataArray): Boolean; static;
  427. class function SaveMultiImageToMemory(const Ext: string; Data: array of Byte; var Size: LongInt; const Images: TDynImageDataArray): Boolean; static;
  428. { Manipulation Functions }
  429. class function CloneImage(const Image: TImageData; var Clone: TImageData): Boolean; static;
  430. class function ConvertImage(var Image: TImageData; DestFormat: TImageFormat): Boolean; static;
  431. class function FlipImage(var Image: TImageData): Boolean; static;
  432. class function MirrorImage(var Image: TImageData): Boolean; static;
  433. class function ResizeImage(var Image: TImageData; NewWidth, NewHeight: LongInt; Filter: TResizeFilter): Boolean; static;
  434. class function SwapChannels(var Image: TImageData; SrcChannel, DstChannel: LongInt): Boolean; static;
  435. class function ReduceColors(var Image: TImageData; MaxColors: LongInt): Boolean; static;
  436. class function GenerateMipMaps(const Image: TImageData; Levels: LongInt; var MipMaps: TDynImageDataArray): Boolean; static;
  437. class function MapImageToPalette(var Image: TImageData; Pal: TPalette32; Entries: LongInt): Boolean; static;
  438. class function SplitImage(var Image: TImageData; var Chunks: TDynImageDataArray; ChunkWidth, ChunkHeight: LongInt; var XChunks, YChunks: LongInt; PreserveSize: Boolean; Fill: TObject): Boolean; static;
  439. class function MakePaletteForImages(var Images: TDynImageDataArray; Pal: TPalette32; MaxColors: LongInt; ConvertImages: Boolean): Boolean; static;
  440. class function RotateImage(var Image: TImageData; Angle: LongInt): Boolean; static;
  441. { Drawing/Pixel functions }
  442. class function CopyRect(const SrcImage: TImageData; SrcX, SrcY, Width, Height: LongInt; var DstImage: TImageData; DstX, DstY: LongInt): Boolean; static;
  443. class function FillRect(var Image: TImageData; X, Y, Width, Height: LongInt; Fill: TObject): Boolean; static;
  444. class function ReplaceColor(var Image: TImageData; X, Y, Width, Height: LongInt; OldPixel, NewPixel: TObject): Boolean; static;
  445. class function StretchRect(const SrcImage: TImageData; SrcX, SrcY, SrcWidth, SrcHeight: LongInt; var DstImage: TImageData; DstX, DstY, DstWidth, DstHeight: LongInt; Filter: TResizeFilter): Boolean; static;
  446. class procedure GetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: TObject); static;
  447. class procedure SetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: TObject); static;
  448. class function GetPixel32(const Image: TImageData; X, Y: LongInt): TColor32Rec; static;
  449. class procedure SetPixel32(const Image: TImageData; X, Y: LongInt; const Color: TColor32Rec); static;
  450. class function GetPixelFP(const Image: TImageData; X, Y: LongInt): TColorFPRec; static;
  451. class procedure SetPixelFP(const Image: TImageData; X, Y: LongInt; const Color: TColorFPRec); static;
  452. { Palette Functions }
  453. class function NewPalette(Entries: LongInt; var Pal: TPalette32): Boolean; static;
  454. class function FreePalette(var Pal: TPalette32): Boolean; static;
  455. class function CopyPalette(SrcPal, DstPal: TPalette32; SrcIdx, DstIdx, Count: LongInt): Boolean; static;
  456. class function FindColor(Pal: TPalette32; Entries: LongInt; Color: TColor32): LongInt; static;
  457. class function FillGrayscalePalette(Pal: TPalette32; Entries: LongInt): Boolean; static;
  458. class function FillCustomPalette(Pal: TPalette32; Entries: LongInt; RBits, GBits, BBits: Byte; Alpha: Byte): Boolean; static;
  459. class function SwapChannelsOfPalette(Pal: TPalette32; Entries, SrcChannel, DstChannel: LongInt): Boolean; static;
  460. { dotNET only}
  461. class function GetPaletteColor(Pal: TPalette32; Index: LongInt): TColor32; static;
  462. class procedure SetPaletteColor(Pal: TPalette32; Index: LongInt; Color: TColor32); static;
  463. { Options Functions }
  464. class function SetOption(OptionId, Value: LongInt): Boolean; static;
  465. class function GetOption(OptionId: LongInt): LongInt; static;
  466. class function PushOptions: Boolean; static;
  467. class function PopOptions: Boolean; static;
  468. { Image Format Functions }
  469. class function GetPixelBytes(Format: TImageFormat): LongInt; static;
  470. class function GetImageFormatInfo(Format: TImageFormat; var Info: TImageFormatInfo): Boolean; static;
  471. class function GetPixelsSize(Format: TImageFormat; Width, Height: LongInt): LongInt; static;
  472. end;
  473. implementation
  474. { Imaging private methods }
  475. class function Imaging.ListToArray(List: TImageDataList; var Arr: TDynImageDataArray): Boolean;
  476. var
  477. Img: TImageData;
  478. I, Size: LongInt;
  479. begin
  480. Result := True;
  481. Size := ImGetImageListSize(List);
  482. FreeImagesInArray(Arr);
  483. SetLength(Arr, Size);
  484. for I := 0 to Size - 1 do
  485. begin
  486. Result := Result and ImGetImageListElement(List, I, Img);
  487. Arr[I] := Img;
  488. if not Result then Break;
  489. end;
  490. end;
  491. class function Imaging.ArrayToList(const Arr: TDynImageDataArray; var List: TImageDataList): Boolean;
  492. var
  493. Img: TImageData;
  494. I, Size: LongInt;
  495. begin
  496. Size := Length(Arr);
  497. Result := ImInitImageList(Size, List);
  498. for I := 0 to Size - 1 do
  499. begin
  500. Img := Arr[I];
  501. Result := Result and ImSetImageListElement(List, I, Img);
  502. if not Result then Break;
  503. end;
  504. end;
  505. { Imaging public methods }
  506. class procedure Imaging.GetVersion(var Major, Minor, Patch: LongInt);
  507. begin
  508. ImGetVersion(Major, Minor, Patch);
  509. end;
  510. class procedure Imaging.InitImage(var Image: TImageData);
  511. begin
  512. ImInitImage(Image);
  513. end;
  514. class function Imaging.IsFileFormatSupported(const FileName: string): Boolean;
  515. begin
  516. Result := IsFileFormatSupported(FileName);
  517. end;
  518. class function Imaging.NewImage(Width, Height: LongInt; Format: TImageFormat; var Image: TImageData): Boolean;
  519. begin
  520. Result := ImNewImage(Width, Height, Format, Image);
  521. end;
  522. class function Imaging.TestImage(const Image: TImageData): Boolean;
  523. begin
  524. Result := ImTestImage(Image);
  525. end;
  526. class function Imaging.FreeImage(var Image: TImageData): Boolean;
  527. begin
  528. Result := ImFreeImage(Image);
  529. end;
  530. class function Imaging.FreeImagesInArray(var Images: TDynImageDataArray): Boolean;
  531. var
  532. I: LongInt;
  533. begin
  534. Result := True;
  535. for I := 0 to Length(Images) - 1 do
  536. Result := Result and ImFreeImage(Images[I]);
  537. end;
  538. class function Imaging.TestImagesInArray(const Images: TDynImageDataArray): Boolean;
  539. var
  540. I: LongInt;
  541. begin
  542. Result := True;
  543. for I := 0 to Length(Images) - 1 do
  544. begin
  545. Result := Result and ImTestImage(Images[I]);
  546. if not Result then Break;
  547. end;
  548. end;
  549. const
  550. ExtLen = 16;
  551. class function Imaging.DetermineFileFormat(const FileName: string): string;
  552. var
  553. Builder: StringBuilder;
  554. begin
  555. Builder := StringBuilder.Create(ExtLen);
  556. if ImDetermineFileFormat(FileName, Builder) then
  557. Result := Builder.ToString
  558. else
  559. Result := '';
  560. end;
  561. class function Imaging.DetermineMemoryFormat(const Data: array of Byte): string;
  562. var
  563. Builder: StringBuilder;
  564. begin
  565. Builder := StringBuilder.Create(ExtLen);
  566. if ImDetermineMemoryFormat(Data, Length(Data), Builder) then
  567. Result := Builder.ToString
  568. else
  569. Result := '';
  570. end;
  571. class function Imaging.EnumFileFormats(var Index: Integer; var Name, DefaultExt,
  572. Masks: string; var CanSave, IsMultiImageFormat: Boolean): Boolean;
  573. var
  574. AName, AExt, AMasks: StringBuilder;
  575. begin
  576. AName := StringBuilder.Create(128);
  577. AExt := StringBuilder.Create(ExtLen);
  578. AMasks := StringBuilder.Create(256);
  579. Result := ImEnumFileFormats(Index, AName, AExt, AMasks, CanSave, IsMultiImageFormat);
  580. // TODO: Result always is True, even if DLL function explicitly returns False. WTF?
  581. // So this check is added to ensure enumerating will end some time.
  582. Result := Result and (AName.Length > 0);
  583. Name := AName.ToString;
  584. DefaultExt := AExt.ToString;
  585. Masks := AMasks.ToString;
  586. end;
  587. class function Imaging.LoadImageFromFile(const FileName: string; var Image: TImageData): Boolean;
  588. begin
  589. Result := ImLoadImageFromFile(FileName, Image);
  590. end;
  591. class function Imaging.LoadImageFromMemory(const Data: array of Byte; var Image: TImageData): Boolean;
  592. begin
  593. Result := ImLoadImageFromMemory(Data, Length(Data), Image);
  594. end;
  595. class function Imaging.LoadMultiImageFromFile(const FileName: string; var Images: TDynImageDataArray): Boolean;
  596. var
  597. List: TImageDataList;
  598. begin
  599. Result := ImLoadMultiImageFromFile(FileName, List);
  600. if Result then
  601. begin
  602. FreeImagesInArray(Images);
  603. Result := ListToArray(List, Images);
  604. ImFreeImageList(List);
  605. end;
  606. end;
  607. class function Imaging.LoadMultiImageFromMemory(const Data: array of Byte; var Images: TDynImageDataArray): Boolean;
  608. var
  609. List: TImageDataList;
  610. begin
  611. Result := ImLoadMultiImageFromMemory(Data, Length(Data), List);
  612. if Result then
  613. begin
  614. FreeImagesInArray(Images);
  615. Result := ListToArray(List, Images);
  616. ImFreeImageList(List);
  617. end;
  618. end;
  619. class function Imaging.SaveImageToFile(const FileName: string; const Image: TImageData): Boolean;
  620. begin
  621. Result := ImSaveImageToFile(FileName, Image);
  622. end;
  623. class function Imaging.SaveImageToMemory(const Ext: string; Data: array of Byte; var Size: LongInt; const Image: TImageData): Boolean;
  624. begin
  625. Size := Length(Data);
  626. Result := ImSaveImageToMemory(Ext, Data, Size, Image);
  627. end;
  628. class function Imaging.SaveMultiImageToFile(const FileName: string; const Images: TDynImageDataArray): Boolean;
  629. var
  630. List: TImageDataList;
  631. begin
  632. Result := ArrayToList(Images, List);
  633. if Result then
  634. begin
  635. Result := ImSaveMultiImageToFile(FileName, List);
  636. ImFreeImageList(List);
  637. end;
  638. end;
  639. class function Imaging.SaveMultiImageToMemory(const Ext: string; Data: array of Byte; var Size: LongInt; const Images: TDynImageDataArray): Boolean;
  640. var
  641. List: TImageDataList;
  642. begin
  643. Result := ArrayToList(Images, List);
  644. if Result then
  645. begin
  646. Size := Length(Data);
  647. Result := ImSaveMultiImageToMemory(Ext, Data, Size, List);
  648. ImFreeImageList(List);
  649. end;
  650. end;
  651. class procedure Imaging.BuildFileFormatList;
  652. var
  653. I: LongInt;
  654. begin
  655. I := 0;
  656. SetLength(FileFormats, 1);
  657. while Imaging.EnumFileFormats(I, FileFormats[I].Name, FileFormats[I].DefaultExt,
  658. FileFormats[I].Masks, FileFormats[I].CanSave, FileFormats[I].IsMultiImageFormat) do
  659. begin
  660. SetLength(FileFormats, I + 1);
  661. end;
  662. SetLength(FileFormats, I);
  663. end;
  664. class function Imaging.CloneImage(const Image: TImageData; var Clone: TImageData): Boolean;
  665. begin
  666. Result := ImCloneImage(Image, Clone);
  667. end;
  668. class function Imaging.ConvertImage(var Image: TImageData; DestFormat: TImageFormat): Boolean;
  669. begin
  670. Result := ImConvertImage(Image, DestFormat);
  671. end;
  672. class function Imaging.FlipImage(var Image: TImageData): Boolean;
  673. begin
  674. Result := ImFlipImage(Image);
  675. end;
  676. class function Imaging.MirrorImage(var Image: TImageData): Boolean;
  677. begin
  678. Result := ImMirrorImage(Image);
  679. end;
  680. class function Imaging.ResizeImage(var Image: TImageData; NewWidth, NewHeight: LongInt; Filter: TResizeFilter): Boolean;
  681. begin
  682. Result := ImResizeImage(Image, NewWidth, NewHeight, Filter);
  683. end;
  684. class function Imaging.SwapChannels(var Image: TImageData; SrcChannel, DstChannel: LongInt): Boolean;
  685. begin
  686. Result := ImSwapChannels(Image, SrcChannel, DstChannel);
  687. end;
  688. class function Imaging.ReduceColors(var Image: TImageData; MaxColors: LongInt): Boolean;
  689. begin
  690. Result := ImReduceColors(Image, MaxColors);
  691. end;
  692. class function Imaging.GenerateMipMaps(const Image: TImageData; Levels: LongInt; var MipMaps: TDynImageDataArray): Boolean;
  693. var
  694. List: TImageDataList;
  695. begin
  696. Result := ImGenerateMipMaps(Image, Levels, List);
  697. if Result then
  698. begin
  699. FreeImagesInArray(MipMaps);
  700. Result := ListToArray(List, MipMaps);
  701. ImFreeImageList(List);
  702. end;
  703. end;
  704. class function Imaging.MapImageToPalette(var Image: TImageData; Pal: TPalette32; Entries: LongInt): Boolean;
  705. begin
  706. Result := ImMapImageToPalette(Image, Pal, Entries);
  707. end;
  708. class function Imaging.SplitImage(var Image: TImageData; var Chunks: TDynImageDataArray; ChunkWidth, ChunkHeight: LongInt; var XChunks, YChunks: LongInt; PreserveSize: Boolean; Fill: TObject): Boolean;
  709. var
  710. Ptr: IntPtr;
  711. List: TImageDataList;
  712. begin
  713. Ptr := Marshal.AllocHGlobal(Marshal.SizeOf(Fill));
  714. Marshal.StructureToPtr(Fill, Ptr, False);
  715. Result := ImSplitImage(Image, List, ChunkWidth, ChunkHeight, XChunks, YChunks,
  716. PreserveSize, Ptr);
  717. if Result then
  718. begin
  719. FreeImagesInArray(Chunks);
  720. Result := ListToArray(List, Chunks);
  721. ImFreeImageList(List);
  722. end;
  723. Marshal.FreeHGlobal(Ptr);
  724. end;
  725. class function Imaging.MakePaletteForImages(var Images: TDynImageDataArray; Pal: TPalette32; MaxColors: LongInt; ConvertImages: Boolean): Boolean;
  726. var
  727. List: TImageDataList;
  728. begin
  729. Result := ArrayToList(Images, List);
  730. if Result then
  731. begin
  732. Result := ImMakePaletteForImages(List, Pal, MaxColors, ConvertImages);
  733. Result := Result and ListToArray(List, Images);
  734. ImFreeImageList(List);
  735. end;
  736. end;
  737. class function Imaging.RotateImage(var Image: TImageData; Angle: LongInt): Boolean;
  738. begin
  739. Result := ImRotateImage(Image, Angle);
  740. end;
  741. class function Imaging.CopyRect(const SrcImage: TImageData; SrcX, SrcY, Width, Height: LongInt; var DstImage: TImageData; DstX, DstY: LongInt): Boolean;
  742. begin
  743. Result := ImCopyRect(SrcImage, SrcX, SrcY, Width, Height, DstImage, DstX, DstY);
  744. end;
  745. class function Imaging.FillRect(var Image: TImageData; X, Y, Width, Height: LongInt; Fill: TObject): Boolean;
  746. var
  747. Ptr: IntPtr;
  748. begin
  749. Ptr := Marshal.AllocHGlobal(Marshal.SizeOf(Fill));
  750. Marshal.StructureToPtr(Fill, Ptr, False);
  751. Result := ImFillRect(Image, X, Y, Width, Height, Ptr);
  752. Marshal.FreeHGlobal(Ptr);
  753. end;
  754. class function Imaging.ReplaceColor(var Image: TImageData; X, Y, Width,
  755. Height: LongInt; OldPixel, NewPixel: TObject): Boolean;
  756. var
  757. OldPtr, NewPtr: IntPtr;
  758. begin
  759. OldPtr := Marshal.AllocHGlobal(Marshal.SizeOf(OldPixel));
  760. Marshal.StructureToPtr(OldPixel, OldPtr, False);
  761. NewPtr := Marshal.AllocHGlobal(Marshal.SizeOf(NewPixel));
  762. Marshal.StructureToPtr(NewPixel, NewPtr, False);
  763. Result := ReplaceColor(Image, X, Y, Width, Height, OldPtr, NewPtr);
  764. Marshal.FreeHGlobal(OldPtr);
  765. Marshal.FreeHGlobal(NewPtr);
  766. end;
  767. class function Imaging.StretchRect(const SrcImage: TImageData; SrcX, SrcY,
  768. SrcWidth, SrcHeight: Integer; var DstImage: TImageData; DstX, DstY, DstWidth,
  769. DstHeight: Integer; Filter: TResizeFilter): Boolean;
  770. begin
  771. Result := ImStretchRect(SrcImage, SrcX, SrcY, SrcWidth, SrcHeight,
  772. DstImage, DstX, DstY, DstWidth, DstHeight, Filter);
  773. end;
  774. class procedure Imaging.GetPixelDirect(const Image: TImageData; X, Y: Integer;
  775. Pixel: TObject);
  776. var
  777. Ptr: IntPtr;
  778. begin
  779. Ptr := Marshal.AllocHGlobal(Marshal.SizeOf(Pixel));
  780. ImGetPixelDirect(Image, X, Y, Ptr);
  781. Marshal.PtrToStructure(Ptr, Pixel);
  782. Marshal.FreeHGlobal(Ptr);
  783. end;
  784. class function Imaging.GetPixel32(const Image: TImageData; X,
  785. Y: Integer): TColor32Rec;
  786. begin
  787. Result := ImGetPixel32(Image, X, Y);
  788. end;
  789. class procedure Imaging.SetPixel32(const Image: TImageData; X, Y: Integer;
  790. const Color: TColor32Rec);
  791. begin
  792. ImSetPixel32(Image, X, Y, Color);
  793. end;
  794. class function Imaging.GetPixelFP(const Image: TImageData; X,
  795. Y: Integer): TColorFPRec;
  796. begin
  797. Result := ImGetPixelFP(Image, X, Y);
  798. end;
  799. class procedure Imaging.SetPixelDirect(const Image: TImageData; X, Y: Integer;
  800. Pixel: TObject);
  801. var
  802. Ptr: IntPtr;
  803. begin
  804. Ptr := Marshal.AllocHGlobal(Marshal.SizeOf(Pixel));
  805. Marshal.StructureToPtr(Pixel, Ptr, False);
  806. ImSetPixelDirect(Image, X, Y, Ptr);
  807. Marshal.FreeHGlobal(Ptr);
  808. end;
  809. class procedure Imaging.SetPixelFP(const Image: TImageData; X, Y: Integer;
  810. const Color: TColorFPRec);
  811. begin
  812. ImSetPixelFP(Image, X, Y, Color);
  813. end;
  814. class function Imaging.NewPalette(Entries: LongInt; var Pal: TPalette32): Boolean;
  815. begin
  816. Result := ImNewPalette(Entries, Pal);
  817. end;
  818. class function Imaging.FreePalette(var Pal: TPalette32): Boolean;
  819. begin
  820. Result := ImFreePalette(Pal);
  821. end;
  822. class function Imaging.CopyPalette(SrcPal, DstPal: TPalette32; SrcIdx, DstIdx, Count: LongInt): Boolean;
  823. begin
  824. Result := ImCopyPalette(SrcPal, DstPal, SrcIdx, DstIdx, Count);
  825. end;
  826. class function Imaging.FindColor(Pal: TPalette32; Entries: LongInt; Color: TColor32): LongInt;
  827. begin
  828. Result := ImFindColor(Pal, Entries, Color);
  829. end;
  830. class function Imaging.FillGrayscalePalette(Pal: TPalette32; Entries: LongInt): Boolean;
  831. begin
  832. Result := ImFillGrayscalePalette(Pal, Entries);
  833. end;
  834. class function Imaging.FillCustomPalette(Pal: TPalette32; Entries: LongInt; RBits, GBits, BBits: Byte; Alpha: Byte): Boolean;
  835. begin
  836. Result := ImFillCustomPalette(Pal, Entries, RBits, GBits, BBits, Alpha);
  837. end;
  838. class function Imaging.SwapChannelsOfPalette(Pal: TPalette32; Entries, SrcChannel, DstChannel: LongInt): Boolean;
  839. begin
  840. Result := ImSwapChannelsOfPalette(Pal, Entries, SrcChannel, DstChannel);
  841. end;
  842. class function Imaging.GetPaletteColor(Pal: TPalette32; Index: LongInt): TColor32;
  843. begin
  844. Result := Marshal.ReadInt32(Pal, Index * SizeOf(TColor32));
  845. end;
  846. class procedure Imaging.SetPaletteColor(Pal: TPalette32; Index: LongInt; Color: TColor32);
  847. begin
  848. Marshal.WriteInt32(Pal, Index * SizeOf(TColor32), Color);
  849. end;
  850. class function Imaging.SetOption(OptionId, Value: LongInt): Boolean;
  851. begin
  852. Result := ImSetOption(OptionId, Value);
  853. end;
  854. class function Imaging.GetOption(OptionId: LongInt): LongInt;
  855. begin
  856. Result := ImGetOption(OptionId);
  857. end;
  858. class function Imaging.PushOptions: Boolean;
  859. begin
  860. Result := ImPushOptions;
  861. end;
  862. class function Imaging.PopOptions: Boolean;
  863. begin
  864. Result := ImPopOptions;
  865. end;
  866. class function Imaging.GetPixelBytes(Format: TImageFormat): LongInt;
  867. begin
  868. Result := ImGetPixelBytes(Format);
  869. end;
  870. class function Imaging.GetFileFormatCount: LongInt;
  871. begin
  872. Result := Length(FileFormats);
  873. end;
  874. class function Imaging.GetFileFormatInfo(Index: LongInt): TFileFormatInfo;
  875. begin
  876. if (Index >= Low(FileFormats)) and (Index <= High(FileFormats)) then
  877. Result := FileFormats[Index];
  878. end;
  879. class function Imaging.GetImageFileFormatsFilter(
  880. OpenFileFilter: Boolean): string;
  881. const
  882. SAllFilter = 'All Images';
  883. var
  884. I, Count: LongInt;
  885. Descriptions: string;
  886. Filters, CurFilter: string;
  887. begin
  888. Descriptions := '';
  889. Filters := '';
  890. Count := 0;
  891. for I := 0 to Length(FileFormats) - 1 do
  892. begin
  893. if not OpenFileFilter and not FileFormats[I].CanSave then
  894. Continue;
  895. CurFilter := FileFormats[I].Masks;
  896. FmtStr(Descriptions, '%s%s (%s)|%2:s', [Descriptions, FileFormats[I].Name, CurFilter]);
  897. FmtStr(Filters, '%s;%s', [Filters, CurFilter]);
  898. if I < Length(FileFormats) - 1 then
  899. Descriptions := Descriptions + '|';
  900. Inc(Count);
  901. end;
  902. if (Count > 1) and OpenFileFilter then
  903. FmtStr(Descriptions, '%s (%s)|%1:s|%s', [SAllFilter, Filters, Descriptions]);
  904. Result := Descriptions;
  905. end;
  906. class function Imaging.GetImageFormatInfo(Format: TImageFormat; var Info: TImageFormatInfo): Boolean;
  907. begin
  908. Result := ImGetImageFormatInfo(Format, Info);
  909. end;
  910. class function Imaging.GetPixelsSize(Format: TImageFormat; Width, Height: LongInt): LongInt;
  911. begin
  912. Result := ImGetPixelsSize(Format, Width, Height);
  913. end;
  914. { Color Records implementations }
  915. { TColor24Rec }
  916. function TColor24Rec.SetColor(Color: TColor32): TColor24Rec;
  917. begin
  918. R := (Color shr 16) and $FF;
  919. G := (Color shr 8) and $FF;
  920. B := Color and $FF;
  921. Result := Self;
  922. end;
  923. function TColor24Rec.GetColor: TColor32;
  924. begin
  925. Result := ($FF shl 24) or (R shl 16) or (G shl 8) or B;
  926. end;
  927. function TColor24Rec.SetColor(R, G, B: Byte): TColor24Rec;
  928. begin
  929. Self.R := R;
  930. Self.G := G;
  931. Self.B := B;
  932. Result := Self;
  933. end;
  934. function TColor24Rec.SetColor(ColorRec: TColorFPRec): TColor24Rec;
  935. begin
  936. Self.R := Math.Max(0, Math.Min(255, Trunc(ColorRec.R * 255)));
  937. Self.G := Math.Max(0, Math.Min(255, Trunc(ColorRec.G * 255)));
  938. Self.B := Math.Max(0, Math.Min(255, Trunc(ColorRec.B * 255)));
  939. Result := Self;
  940. end;
  941. function TColor24Rec.SetColor(ColorRec: TColor64Rec): TColor24Rec;
  942. begin
  943. Self.R := ColorRec.R shr 8;
  944. Self.G := ColorRec.G shr 8;
  945. Self.B := ColorRec.B shr 8;
  946. Result := Self;
  947. end;
  948. function TColor24Rec.SetColor(ColorRec: TColor48Rec): TColor24Rec;
  949. begin
  950. Self.R := ColorRec.R shr 8;
  951. Self.G := ColorRec.G shr 8;
  952. Self.B := ColorRec.B shr 8;
  953. Result := Self;
  954. end;
  955. function TColor24Rec.SetColor(ColorRec: TColor32Rec): TColor24Rec;
  956. begin
  957. Self.R := ColorRec.R;
  958. Self.G := ColorRec.G;
  959. Self.B := ColorRec.B;
  960. Result := Self;
  961. end;
  962. function TColor24Rec.SetColor(ColorRec: TColor24Rec): TColor24Rec;
  963. begin
  964. Self.R := ColorRec.R;
  965. Self.G := ColorRec.G;
  966. Self.B := ColorRec.B;
  967. Result := Self;
  968. end;
  969. class operator TColor24Rec.Equal(const Left, Right: TColor24Rec): Boolean;
  970. begin
  971. Result := (Left.R = Right.R) and (Left.G = Right.G) and (Left.B = Right.B);
  972. end;
  973. class operator TColor24Rec.NotEqual(const Left, Right: TColor24Rec): Boolean;
  974. begin
  975. Result := not TColor24Rec.Equals(Left, Right);
  976. end;
  977. { TColor32Rec }
  978. function TColor32Rec.SetColor(Color: TColor32): TColor32Rec;
  979. begin
  980. A := Color shr 24;
  981. R := (Color shr 16) and $FF;
  982. G := (Color shr 8) and $FF;
  983. B := Color and $FF;
  984. Result := Self;
  985. end;
  986. function TColor32Rec.GetColor: TColor32;
  987. begin
  988. Result := (A shl 24) or (R shl 16) or (G shl 8) or B;
  989. end;
  990. function TColor32Rec.SetColor(A, R, G, B: Byte): TColor32Rec;
  991. begin
  992. Self.A := A;
  993. Self.R := R;
  994. Self.G := G;
  995. Self.B := B;
  996. Result := Self;
  997. end;
  998. function TColor32Rec.SetColor(ColorRec: TColorFPRec): TColor32Rec;
  999. begin
  1000. Self.A := Math.Max(0, Math.Min($FF, Trunc(ColorRec.A * $FF)));
  1001. Self.R := Math.Max(0, Math.Min($FF, Trunc(ColorRec.R * $FF)));
  1002. Self.G := Math.Max(0, Math.Min($FF, Trunc(ColorRec.G * $FF)));
  1003. Self.B := Math.Max(0, Math.Min($FF, Trunc(ColorRec.B * $FF)));
  1004. Result := Self;
  1005. end;
  1006. function TColor32Rec.SetColor(ColorRec: TColor64Rec): TColor32Rec;
  1007. begin
  1008. Self.A := ColorRec.A shr 8;
  1009. Self.R := ColorRec.R shr 8;
  1010. Self.G := ColorRec.G shr 8;
  1011. Self.B := ColorRec.B shr 8;
  1012. Result := Self;
  1013. end;
  1014. function TColor32Rec.SetColor(ColorRec: TColor48Rec): TColor32Rec;
  1015. begin
  1016. Self.A := $FF;
  1017. Self.R := ColorRec.R shr 8;
  1018. Self.G := ColorRec.G shr 8;
  1019. Self.B := ColorRec.B shr 8;
  1020. Result := Self;
  1021. end;
  1022. function TColor32Rec.SetColor(ColorRec: TColor32Rec): TColor32Rec;
  1023. begin
  1024. Self.A := ColorRec.A;
  1025. Self.R := ColorRec.R;
  1026. Self.G := ColorRec.G;
  1027. Self.B := ColorRec.B;
  1028. Result := Self;
  1029. end;
  1030. function TColor32Rec.SetColor(ColorRec: TColor24Rec): TColor32Rec;
  1031. begin
  1032. Self.A := $FF;
  1033. Self.R := ColorRec.R;
  1034. Self.G := ColorRec.G;
  1035. Self.B := ColorRec.B;
  1036. Result := Self;
  1037. end;
  1038. class operator TColor32Rec.Equal(const Left, Right: TColor32Rec): Boolean;
  1039. begin
  1040. Result := (Left.A = Right.A) and (Left.R = Right.R) and (Left.G = Right.G) and
  1041. (Left.B = Right.B);
  1042. end;
  1043. class operator TColor32Rec.NotEqual(const Left, Right: TColor32Rec): Boolean;
  1044. begin
  1045. Result := not TColor32Rec.Equals(Left, Right);
  1046. end;
  1047. { TColor48Rec }
  1048. function TColor48Rec.SetColor(Color: TColor64): TColor48Rec;
  1049. begin
  1050. R := (Color shr 32) and $FFFF;
  1051. G := (Color shr 16) and $FFFF;
  1052. B := Color and $FFFF;
  1053. Result := Self;
  1054. end;
  1055. function TColor48Rec.GetColor: TColor64;
  1056. begin
  1057. Result := (UInt64($FFFF) shl 48) or (UInt64(R) shl 32) or (G shl 16) or B;
  1058. end;
  1059. function TColor48Rec.SetColor(R, G, B: Word): TColor48Rec;
  1060. begin
  1061. Self.R := R;
  1062. Self.G := G;
  1063. Self.B := B;
  1064. Result := Self;
  1065. end;
  1066. function TColor48Rec.SetColor(ColorRec: TColorFPRec): TColor48Rec;
  1067. begin
  1068. Self.R := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.R * $FFFF)));
  1069. Self.G := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.G * $FFFF)));
  1070. Self.B := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.B * $FFFF)));
  1071. Result := Self;
  1072. end;
  1073. function TColor48Rec.SetColor(ColorRec: TColor64Rec): TColor48Rec;
  1074. begin
  1075. Self.R := ColorRec.R;
  1076. Self.G := ColorRec.G;
  1077. Self.B := ColorRec.B;
  1078. Result := Self;
  1079. end;
  1080. function TColor48Rec.SetColor(ColorRec: TColor48Rec): TColor48Rec;
  1081. begin
  1082. Self.R := ColorRec.R;
  1083. Self.G := ColorRec.G;
  1084. Self.B := ColorRec.B;
  1085. Result := Self;
  1086. end;
  1087. function TColor48Rec.SetColor(ColorRec: TColor32Rec): TColor48Rec;
  1088. begin
  1089. Self.R := ColorRec.R shl 8;
  1090. Self.G := ColorRec.G shl 8;
  1091. Self.B := ColorRec.B shl 8;
  1092. Result := Self;
  1093. end;
  1094. function TColor48Rec.SetColor(ColorRec: TColor24Rec): TColor48Rec;
  1095. begin
  1096. Self.R := ColorRec.R shl 8;
  1097. Self.G := ColorRec.G shl 8;
  1098. Self.B := ColorRec.B shl 8;
  1099. Result := Self;
  1100. end;
  1101. class operator TColor48Rec.Equal(const Left, Right: TColor48Rec): Boolean;
  1102. begin
  1103. Result := (Left.R = Right.R) and (Left.G = Right.G) and (Left.B = Right.B);
  1104. end;
  1105. class operator TColor48Rec.NotEqual(const Left, Right: TColor48Rec): Boolean;
  1106. begin
  1107. Result := not TColor48Rec.Equals(Left, Right);
  1108. end;
  1109. { TColor64Rec }
  1110. function TColor64Rec.SetColor(Color: TColor64): TColor64Rec;
  1111. begin
  1112. A := Color shr 48;
  1113. R := (Color shr 32) and $FFFF;
  1114. G := (Color shr 16) and $FFFF;
  1115. B := Color and $FFFF;
  1116. Result := Self;
  1117. end;
  1118. function TColor64Rec.GetColor: TColor64;
  1119. begin
  1120. Result := (UInt64(A) shl 48) or (UInt64(R) shl 32) or (G shl 16) or B;
  1121. end;
  1122. function TColor64Rec.SetColor(A, R, G, B: Word): TColor64Rec;
  1123. begin
  1124. Self.A := A;
  1125. Self.R := R;
  1126. Self.G := G;
  1127. Self.B := B;
  1128. Result := Self;
  1129. end;
  1130. function TColor64Rec.SetColor(ColorRec: TColorFPRec): TColor64Rec;
  1131. begin
  1132. Self.A := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.A * $FFFF)));
  1133. Self.R := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.R * $FFFF)));
  1134. Self.G := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.G * $FFFF)));
  1135. Self.B := Math.Max(0, Math.Min($FFFF, Trunc(ColorRec.B * $FFFF)));
  1136. Result := Self;
  1137. end;
  1138. function TColor64Rec.SetColor(ColorRec: TColor64Rec): TColor64Rec;
  1139. begin
  1140. Self.A := ColorRec.A;
  1141. Self.R := ColorRec.R;
  1142. Self.G := ColorRec.G;
  1143. Self.B := ColorRec.B;
  1144. Result := Self;
  1145. end;
  1146. function TColor64Rec.SetColor(ColorRec: TColor48Rec): TColor64Rec;
  1147. begin
  1148. Self.A := $FFFF;
  1149. Self.R := ColorRec.R;
  1150. Self.G := ColorRec.G;
  1151. Self.B := ColorRec.B;
  1152. Result := Self;
  1153. end;
  1154. function TColor64Rec.SetColor(ColorRec: TColor32Rec): TColor64Rec;
  1155. begin
  1156. Self.A := ColorRec.A shl 8;
  1157. Self.R := ColorRec.R shl 8;
  1158. Self.G := ColorRec.G shl 8;
  1159. Self.B := ColorRec.B shl 8;
  1160. Result := Self;
  1161. end;
  1162. function TColor64Rec.SetColor(ColorRec: TColor24Rec): TColor64Rec;
  1163. begin
  1164. Self.A := $FFFF;
  1165. Self.R := ColorRec.R shl 8;
  1166. Self.G := ColorRec.G shl 8;
  1167. Self.B := ColorRec.B shl 8;
  1168. Result := Self;
  1169. end;
  1170. class operator TColor64Rec.Equal(const Left, Right: TColor64Rec): Boolean;
  1171. begin
  1172. Result := (Left.A = Right.A) and (Left.R = Right.R) and (Left.G = Right.G) and
  1173. (Left.B = Right.B);
  1174. end;
  1175. class operator TColor64Rec.NotEqual(const Left, Right: TColor64Rec): Boolean;
  1176. begin
  1177. Result := not TColor64Rec.Equals(Left, Right);
  1178. end;
  1179. { TColorFRec }
  1180. function TColorFPRec.SetColor(Color: TColor64): TColorFPRec;
  1181. var
  1182. C64: TColor64Rec;
  1183. begin
  1184. C64.SetColor(Color);
  1185. Self.SetColor(C64);
  1186. Result := Self;
  1187. end;
  1188. function TColorFPRec.GetColor: TColor64;
  1189. var
  1190. C64: TColor64Rec;
  1191. begin
  1192. C64.SetColor(Self);
  1193. Result := C64.GetColor;
  1194. end;
  1195. function TColorFPRec.SetColor(A, R, G, B: Single): TColorFPRec;
  1196. begin
  1197. Self.A := A;
  1198. Self.R := R;
  1199. Self.G := G;
  1200. Self.B := B;
  1201. Result := Self;
  1202. end;
  1203. function TColorFPRec.SetColor(ColorRec: TColorFPRec): TColorFPRec;
  1204. begin
  1205. Self.A := ColorRec.A;
  1206. Self.R := ColorRec.R;
  1207. Self.G := ColorRec.G;
  1208. Self.B := ColorRec.B;
  1209. Result := Self;
  1210. end;
  1211. function TColorFPRec.SetColor(ColorRec: TColor64Rec): TColorFPRec;
  1212. begin
  1213. Self.A := ColorRec.A / $FFFF;
  1214. Self.R := ColorRec.R / $FFFF;
  1215. Self.G := ColorRec.G / $FFFF;
  1216. Self.B := ColorRec.B / $FFFF;
  1217. Result := Self;
  1218. end;
  1219. function TColorFPRec.SetColor(ColorRec: TColor48Rec): TColorFPRec;
  1220. begin
  1221. Self.A := 1.0;
  1222. Self.R := ColorRec.R / $FFFF;
  1223. Self.G := ColorRec.G / $FFFF;
  1224. Self.B := ColorRec.B / $FFFF;
  1225. Result := Self;
  1226. end;
  1227. function TColorFPRec.SetColor(ColorRec: TColor32Rec): TColorFPRec;
  1228. begin
  1229. Self.A := ColorRec.A / $FF;
  1230. Self.R := ColorRec.R / $FF;
  1231. Self.G := ColorRec.G / $FF;
  1232. Self.B := ColorRec.B / $FF;
  1233. Result := Self;
  1234. end;
  1235. function TColorFPRec.SetColor(ColorRec: TColor24Rec): TColorFPRec;
  1236. begin
  1237. Self.A := 1.0;
  1238. Self.R := ColorRec.R / $FF;
  1239. Self.G := ColorRec.G / $FF;
  1240. Self.B := ColorRec.B / $FF;
  1241. Result := Self;
  1242. end;
  1243. class operator TColorFPRec.Equal(const Left, Right: TColorFPRec): Boolean;
  1244. begin
  1245. Result := (Left.A = Right.A) and (Left.R = Right.R) and (Left.G = Right.G) and
  1246. (Left.B = Right.B);
  1247. end;
  1248. class operator TColorFPRec.NotEqual(const Left, Right: TColorFPRec): Boolean;
  1249. begin
  1250. Result := not TColorFPRec.Equals(Left, Right);
  1251. end;
  1252. initialization
  1253. Imaging.BuildFileFormatList;
  1254. {
  1255. Changes/Bug Fixes:
  1256. -- TODOS ----------------------------------------------------
  1257. - add typecast operators to color records rather than SetColor methods
  1258. - add create System.Drawing.Bitmap from TImageData function
  1259. -- 0.23 -----------------------------------------------------
  1260. - Updated to DLL new version.
  1261. -- 0.21 -----------------------------------------------------
  1262. - Changed out PChar parameter types of imported functions to StringBuilders
  1263. for easier conversions to System.String in Imaging class methods.
  1264. - Added GetImageFileFormatFilter method to Imaging class.
  1265. - Updated to DLL new version, some changes in Imaging class methods
  1266. that return strings.
  1267. -- 0.19 -----------------------------------------------------
  1268. - updated to DLL new version
  1269. -- 0.17 -----------------------------------------------------
  1270. - added new low level functions and their equivalents in Imaging class,
  1271. some old function headers updated
  1272. -- 0.15 -----------------------------------------------------
  1273. - changed headers of some functions because of changes in DLL
  1274. mainly related to TImageDataList parameters. Few other
  1275. "update" changes.
  1276. -- 0.13 -----------------------------------------------------
  1277. - Imaging class added
  1278. - various color records implemented
  1279. - several .NET only functions added
  1280. - unit created
  1281. }
  1282. end.