DataFormats.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <?xml-stylesheet type="text/xsl" href="../Xsl/doc2html.xsl"?>
  3. <doc>
  4. <title>Supported Data Formats</title>
  5. <chapter>
  6. <title>Supported Data Formats</title>
  7. <par>Image data format is the internal memory representation of every image.
  8. Data formats are described by <ref>TImageFormat</ref> enumeration
  9. member of <ref>TImageData</ref> structure.
  10. Additional information about each of the data formats is stored in
  11. <ref>TImageFormatInfo</ref> structure.</par>
  12. <table>
  13. <title>Functions related to data formats (low level interface)</title>
  14. <row>
  15. <header>Function name</header>
  16. <header>Usage</header>
  17. </row>
  18. <row>
  19. <cell><ref>GetImageFormatInfo</ref></cell>
  20. <cell>Returns additional information about the given data format</cell>
  21. </row>
  22. <row>
  23. <cell><ref>GetPixelsSize</ref></cell>
  24. <cell>Returns number of bytes occupied by Width x Height area of pixels in the given data format
  25. (works for all data formats)</cell>
  26. </row>
  27. <row>
  28. <cell><ref>GetFormatName</ref></cell>
  29. <cell>Returns symbolic name of the given data format</cell>
  30. </row>
  31. <row>
  32. <cell><ref>ConvertImage</ref></cell>
  33. <cell>Converts images between different data formats </cell>
  34. </row>
  35. <row>
  36. <cell><ref>NewImage</ref></cell>
  37. <cell>Creates new image with the given data format</cell>
  38. </row>
  39. </table>
  40. <lcap>Data Format Categories</lcap>
  41. <par>Image data formats can be divided to these main categories: </par>
  42. <blist>
  43. <li><link url="#argb">ARGB Formats</link><br/>
  44. Each pixel consists of several color channels and
  45. optional alpha transparency channel.
  46. </li>
  47. <li><link url="#index">Indexed Formats</link><br/>
  48. Each pixel is index to the array of colors called the palette.
  49. </li>
  50. <li><link url="#gray">Grayscale Formats</link><br/>
  51. Pixels consist of intensity channel and optional alpha transparency channel.
  52. </li>
  53. <li><link url="#float">Floating-point ARGB Formats</link><br/>
  54. These formats are similar to ARGB formats but color values are stored
  55. as floating-point numbers.
  56. </li>
  57. <li><link url="#special">Special Formats</link><br/>
  58. Each special format requires special and unique conversion
  59. procedures. Compressed formats like DXTC belong to this category.
  60. </li>
  61. </blist>
  62. <mcap>Meaning of Data Format Symbolic Names</mcap>
  63. <par>
  64. Each data format has its symbolic name.
  65. These names are formed in the way which tells something about
  66. its internal structure. Symbolic names look like this:<br /><br />
  67. <center><icode>if[(channel1)(channel1sizebits)]..[(channeln)(channelnsizebits)][modifier1]..[modifiern]</icode></center>
  68. <br />
  69. For example <icode>ifA8R8G8B8</icode> shows that each image pixel
  70. contains four 8 bit sized channels.
  71. <icode>ifR32F</icode> format contains one 32 bit channel and <keyword>F</keyword>
  72. modifier indicates that this is floating-point format.
  73. All channels in the symbolic names are listed from left to right,
  74. most significant bit (MSB) to least significant bit (LSB).
  75. For example, <icode>ifA8R8G8B8</icode> is ordered from the MSB channel
  76. <keyword>A</keyword> (alpha), to the LSB channel <keyword>B</keyword> (blue).
  77. When traversing image data on little endian machines,
  78. the data is stored in memory from LSB to MSB, which means that the channel order in memory is
  79. from LSB (blue) to MSB (alpha).<br/>
  80. <note>Special data format names do not follow this naming convention.
  81. Their symbolic names refer for example to compression technology used
  82. (<icode>ifDXT5</icode> is data format of image compressed with DXT5).
  83. </note>
  84. </par>
  85. <table>
  86. <row>
  87. <th>Symbolic Name Fragment</th>
  88. <th>Info</th>
  89. </row>
  90. <row>
  91. <td><keyword>X</keyword></td>
  92. <td>Unused memory space</td>
  93. </row>
  94. <row>
  95. <td><keyword>R</keyword></td>
  96. <td>Red color channel</td>
  97. </row>
  98. <row>
  99. <td><keyword>G</keyword></td>
  100. <td>Green color channel</td>
  101. </row>
  102. <row>
  103. <td><keyword>B</keyword></td>
  104. <td>Blue color channel</td>
  105. </row>
  106. <row>
  107. <td><keyword>A</keyword></td>
  108. <td>Alpha transparency channel</td>
  109. </row>
  110. <row>
  111. <td><keyword>Index</keyword></td>
  112. <td>Index to palette</td>
  113. </row>
  114. <row>
  115. <td><keyword>Gray</keyword></td>
  116. <td>Grayscale intensity channel</td>
  117. </row>
  118. <row>
  119. <td><keyword>F</keyword></td>
  120. <td>Indicates that this format stores channel values as
  121. floating point numbers</td>
  122. </row>
  123. </table>
  124. <anchor name="argb"><mcap>ARGB Formats</mcap></anchor>
  125. <par>The following table lists all ARGB formats supported in the current
  126. version of Imaging library. Channel values are stored as unsigned
  127. integers.</par>
  128. <table>
  129. <row>
  130. <th>Symbolic Name</th>
  131. <th>Info</th>
  132. </row>
  133. <row>
  134. <td><icode>ifX5R1G1B1</icode></td>
  135. <td>8 bit format with one bit for each color channel. 5 bits are unused.</td>
  136. </row>
  137. <row>
  138. <td><icode>ifR3G3B2</icode></td>
  139. <td>8 bit format with 3 bits for read and green and 2 bits for blue channel.</td>
  140. </row>
  141. <row>
  142. <td><icode>ifR5G6B5</icode></td>
  143. <td>16 bit format with 5 bits for read and blue and 6 bits for green channel.</td>
  144. </row>
  145. <row>
  146. <td><icode>ifA1R5G5B5</icode></td>
  147. <td>16 bit format with 5 bits for each color and one bit for alpha.</td>
  148. </row>
  149. <row>
  150. <td><icode>ifA4R4G4B4</icode></td>
  151. <td>16 bit format with 4 bits for each color and alpha.</td>
  152. </row>
  153. <row>
  154. <td><icode>ifX1R5G5B5</icode></td>
  155. <td>16 bit format with 5 bits for each color and one unused bit.</td>
  156. </row>
  157. <row>
  158. <td><icode>ifX4R4G4B4</icode></td>
  159. <td>16 bit format with 4 bits for each color and 4 unused bits.</td>
  160. </row>
  161. <row>
  162. <td><icode>ifR8G8B8</icode></td>
  163. <td>24 bit format with 8 bits for each color.</td>
  164. </row>
  165. <row>
  166. <td><icode>ifA8R8G8B8</icode></td>
  167. <td>32 bit format with 8 bits for each color and alpha.</td>
  168. </row>
  169. <row>
  170. <td><icode>ifX8R8G8B8</icode></td>
  171. <td>32 bit format with 8 bits for each color and 8 unused bits.</td>
  172. </row>
  173. <row>
  174. <td><icode>ifR16G16B16</icode></td>
  175. <td>48 bit format with 16 bits for each color.</td>
  176. </row>
  177. <row>
  178. <td><icode>ifA16R16G16B16</icode></td>
  179. <td>64 bit format with 16 bits for each color and alpha.</td>
  180. </row>
  181. <row>
  182. <td><icode>ifB16G16R16</icode></td>
  183. <td>48 bit BGR format with 16 bits for each color.</td>
  184. </row>
  185. <row>
  186. <td><icode>ifA16B16G16R16</icode></td>
  187. <td>64 bit BGR format with 16 bits for each color and alpha.</td>
  188. </row>
  189. </table>
  190. <anchor name="index"><mcap>Indexed Formats</mcap></anchor>
  191. <par>The following table lists all indexed formats supported in the current
  192. version of Imaging library. Indexes are stored as unsigned
  193. integers. Palette is <ref>PPalette32</ref> member of <ref>TImageData</ref>
  194. structure. It is a pointer to array of 32 bit ARGB values in
  195. <icode>ifA8R8G8B8</icode> format.
  196. </par>
  197. <table>
  198. <row>
  199. <th>Symbolic Name</th>
  200. <th>Info</th>
  201. </row>
  202. <row>
  203. <td><icode>ifIndex8</icode></td>
  204. <td>8 bit format with 8 bits for index.</td>
  205. </row>
  206. </table>
  207. <anchor name="gray"><mcap>Grayscale Formats</mcap></anchor>
  208. <par>The following table lists all grayscale formats supported in the current
  209. version of Imaging library.
  210. Channels values are stored as unsigned integers.</par>
  211. <table>
  212. <row>
  213. <th>Symbolic Name</th>
  214. <th>Info</th>
  215. </row>
  216. <row>
  217. <td><icode>ifGray8</icode></td>
  218. <td>8 bit format with 8 bits for grayscale intensity.</td>
  219. </row>
  220. <row>
  221. <td><icode>ifA8Gray8</icode></td>
  222. <td>16 bit format with 8 bits for alpha transparency and
  223. 8 bits for grayscale intensity.</td>
  224. </row>
  225. <row>
  226. <td><icode>ifGray16</icode></td>
  227. <td>16 bit format with 16 bits for grayscale intensity.</td>
  228. </row>
  229. <row>
  230. <td><icode>ifGray32</icode></td>
  231. <td>32 bit format with 32 bits for grayscale intensity.</td>
  232. </row>
  233. <row>
  234. <td><icode>ifGray64</icode></td>
  235. <td>64 bit format with 64 bits for grayscale intensity.</td>
  236. </row>
  237. <row>
  238. <td><icode>ifA16Gray16</icode></td>
  239. <td>32 bit format with 16 bits for alpha transparency and
  240. 16 bits for grayscale intensity.</td>
  241. </row>
  242. </table>
  243. <anchor name="float"><mcap>Floating-point ARGB Formats</mcap></anchor>
  244. <par>The following table lists all floating-point formats supported in the current
  245. version of Imaging library.
  246. Channels values are stored as signed floating-point numbers.</par>
  247. <table>
  248. <row>
  249. <th>Symbolic Name</th>
  250. <th>Info</th>
  251. </row>
  252. <row>
  253. <td><icode>ifR32F</icode></td>
  254. <td>32 bit format with one red 32 bit IEEE-754 channel.</td>
  255. </row>
  256. <row>
  257. <td><icode>ifA32R32G32B32F</icode></td>
  258. <td>128 bit format with 32 bit IEEE-754 channel for each color and alpha.</td>
  259. </row>
  260. <row>
  261. <td><icode>ifA32B32G32R32F</icode></td>
  262. <td>128 bit BGR format with 32 bit IEEE-754 channel for each color and alpha.</td>
  263. </row>
  264. <row>
  265. <td><icode>ifR16F</icode></td>
  266. <td>16 bit format with one red 16 bit half-float (s1e5m10) channel.</td>
  267. </row>
  268. <row>
  269. <td><icode>ifA16R16G16B16F</icode></td>
  270. <td>64 bit format with 16 bit half-float (s1e5m10) channel for each color and alpha.</td>
  271. </row>
  272. <row>
  273. <td><icode>ifA16B16G16R16F</icode></td>
  274. <td>64 bit BGR format with 16 bit half-float (s1e5m10) channel for each color and alpha.</td>
  275. </row>
  276. </table>
  277. <anchor name="special"><mcap>Special Formats</mcap></anchor>
  278. <par>The following table lists all special formats supported in the current
  279. version of Imaging library.
  280. </par>
  281. <table>
  282. <row>
  283. <th>Symbolic Name</th>
  284. <th>Info</th>
  285. </row>
  286. <row>
  287. <td><icode>ifDXT1</icode></td>
  288. <td>Image in this format is compressed with DXT1 compression
  289. (15/16 bit interpolated color, zero or one bit alpha).</td>
  290. </row>
  291. <row>
  292. <td><icode>ifDXT3</icode></td>
  293. <td>Image in this format is compressed with DXT3 compression
  294. (16 bit interpolated color, 4 bit explicit alpha).</td>
  295. </row>
  296. <row>
  297. <td><icode>ifDXT5</icode></td>
  298. <td>Image in this format is compressed with DXT5 compression
  299. (16 bit interpolated color, 8 bit interpolated alpha).</td>
  300. </row>
  301. <row>
  302. <td><icode>ifBTC</icode></td>
  303. <td>Image in this format is compressed with BTC compression
  304. (block truncation coding, grayscale, 2bits per pixel).</td>
  305. </row>
  306. <row>
  307. <td><icode>ifATI1N</icode></td>
  308. <td>Image in this format is compressed using 3Dc+ compression
  309. (one channel, 4bits per pixel).</td>
  310. </row>
  311. <row>
  312. <td><icode>ifATI2N</icode></td>
  313. <td>Image in this format is compressed using original 3Dc compression
  314. (two channels, 8bits per pixel).</td>
  315. </row>
  316. </table>
  317. <note>There maybe some legal issues when using DXTC/S3TC compression
  318. (3Dc probably too as it is "subset" of DXT5) as S3 holds patent to this.</note>
  319. </chapter>
  320. </doc>