Advertisement
Blizzardo1

SDL_image.cs

May 9th, 2025
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 58.35 KB | None | 0 0
  1. /// <summary>
  2. /// Animated image support
  3. /// </summary>
  4. /// <remarks>
  5. /// Currently only animated GIFs and WEBP images are supported.
  6. /// </remarks>
  7. typedef struct IMG_Animation { int w; /**< The width of the frames */ int h; /**< The height of the frames */ int count; /**< The number of frames */ SDL_Surface **frames; /**< An array of frames */ int *delays; /**< An array of frame delays, in milliseconds */ } IMG_Animation;
  8.  
  9. /// <summary>
  10. /// Dispose of an IMG_Animation and free its resources.
  11. /// </summary>
  12. /// <param name="anim">IMG_Animationto dispose of.
  13. /// nint refers to a IMG_Animation*
  14. /// <remarks>
  15. /// The providedanimpointer is not valid once this call returns.
  16. /// This function is available since SDL_image 2.6.0.
  17. /// </remarks>
  18. void IMG_FreeAnimation(IMG_Animation *anim);
  19.  
  20. /// <summary>
  21. /// Get last SDL_image error
  22. /// </summary>
  23. #define IMG_GetError    SDL_GetError
  24.  
  25. /// <summary>
  26. /// Initialize SDL_image.
  27. /// </summary>
  28. /// </param>
  29. /// <remarks>
  30. /// This function loads dynamic libraries that SDL_image needs, and prepares them for use. This must be the first function you call in SDL_image, and if it fails you should not continue with the library.
  31. /// Flags should be one or more flags fromIMG_InitFlagsOR'd together. It returns the flags successfully initialized, or 0 on failure.
  32. /// Currently, these flags are:
  33. /// More flags may be added in a future SDL_image release.
  34. /// This function may need to load external shared libraries to support various codecs, which means this function can fail to initialize that support on an otherwise-reasonable system if the library isn't available; this is not just a question of exceptional circumstances like running out of memory at startup!
  35. /// Note that you may call this function more than once to initialize with additional flags. The return value will reflect both new flags that successfully initialized, and also include flags that had previously been initialized as well.
  36. /// As this will return previously-initialized flags, it's legal to call this with zero (no flags set). This is a safe no-op that can be used to query the current initialization state without changing it at all.
  37. /// Since this returns previously-initialized flags as well as new ones, and you can call this with zero, you should not check for a zero return value to determine an error condition. Instead, you should check to make sure all the flags you require are set in the return value. If you have a game with data in a specific format, this might be a fatal error. If you're a generic image displaying app, perhaps you are fine with only having JPG and PNG support and can live without WEBP, even if you request support for everything.
  38. /// Unlike other SDL satellite libraries, calls toIMG_Initdo not stack; a single call toIMG_Quit() will deinitialize everything and does not have to be paired with a matchingIMG_Initcall. For that reason, it's considered best practices to have a singleIMG_InitandIMG_Quitcall in your program. While this isn't required, be aware of the risks of deviating from that behavior.
  39. /// After initializing SDL_image, the app may begin to load images into SDL_Surfaces or SDL_Textures.
  40. /// This function is available since SDL_image 2.0.0.
  41. /// </remarks>
  42. /// <returns>(int) Returns all currently initialized flags.</returns>
  43. int IMG_Init( int flags);
  44.  
  45. /// <summary>
  46. /// Please refer to IMG_InitFlags for details.
  47. /// </summary>
  48.  
  49. /// <summary>
  50. /// Please refer to IMG_InitFlags for details.
  51. /// </summary>
  52.  
  53. /// <summary>
  54. /// Please refer to IMG_InitFlags for details.
  55. /// </summary>
  56.  
  57. /// <summary>
  58. /// Please refer to IMG_InitFlags for details.
  59. /// </summary>
  60.  
  61. /// <summary>
  62. /// Please refer to IMG_InitFlags for details.
  63. /// </summary>
  64.  
  65. /// <summary>
  66. /// Please refer to IMG_InitFlags for details.
  67. /// </summary>
  68.  
  69. /// <summary>
  70. /// Initialization flags
  71. /// </summary>
  72. typedef enum IMG_InitFlags { IMG_INIT_JPG    = 0x00000001 , IMG_INIT_PNG    = 0x00000002 , IMG_INIT_TIF    = 0x00000004 , IMG_INIT_WEBP   = 0x00000008 , IMG_INIT_JXL    = 0x00000010 , IMG_INIT_AVIF   = 0x00000020 } IMG_InitFlags;
  73.  
  74. /// <summary>
  75. /// Detect AVIF image data on a readable/seekable SDL_RWops.
  76. /// </summary>
  77. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  78. /// nint refers to a SDL_RWops *
  79. /// <remarks>
  80. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  81. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  82. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  83. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  84. /// This function is available since SDL_image 2.6.0.
  85. /// </remarks>
  86. /// <returns>(int) Returns non-zero if this is AVIF data, zero otherwise.</returns>
  87. int IMG_isAVIF(SDL_RWops *src);
  88.  
  89. /// <summary>
  90. /// Detect BMP image data on a readable/seekable SDL_RWops.
  91. /// </summary>
  92. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  93. /// nint refers to a SDL_RWops *
  94. /// <remarks>
  95. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  96. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  97. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  98. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  99. /// This function is available since SDL_image 2.0.0.
  100. /// </remarks>
  101. /// <returns>(int) Returns non-zero if this is BMP data, zero otherwise.</returns>
  102. int IMG_isBMP(SDL_RWops *src);
  103.  
  104. /// <summary>
  105. /// Detect CUR image data on a readable/seekable SDL_RWops.
  106. /// </summary>
  107. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  108. /// nint refers to a SDL_RWops *
  109. /// <remarks>
  110. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  111. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  112. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  113. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  114. /// This function is available since SDL_image 2.0.0.
  115. /// </remarks>
  116. /// <returns>(int) Returns non-zero if this is CUR data, zero otherwise.</returns>
  117. int IMG_isCUR(SDL_RWops *src);
  118.  
  119. /// <summary>
  120. /// Detect GIF image data on a readable/seekable SDL_RWops.
  121. /// </summary>
  122. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  123. /// nint refers to a SDL_RWops *
  124. /// <remarks>
  125. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  126. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  127. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  128. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  129. /// This function is available since SDL_image 2.0.0.
  130. /// </remarks>
  131. /// <returns>(int) Returns non-zero if this is GIF data, zero otherwise.</returns>
  132. int IMG_isGIF(SDL_RWops *src);
  133.  
  134. /// <summary>
  135. /// Detect ICO image data on a readable/seekable SDL_RWops.
  136. /// </summary>
  137. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  138. /// nint refers to a SDL_RWops *
  139. /// <remarks>
  140. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  141. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  142. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  143. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  144. /// This function is available since SDL_image 2.0.0.
  145. /// </remarks>
  146. /// <returns>(int) Returns non-zero if this is ICO data, zero otherwise.</returns>
  147. int IMG_isICO(SDL_RWops *src);
  148.  
  149. /// <summary>
  150. /// Detect JPG image data on a readable/seekable SDL_RWops.
  151. /// </summary>
  152. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  153. /// nint refers to a SDL_RWops *
  154. /// <remarks>
  155. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  156. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  157. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  158. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  159. /// This function is available since SDL_image 2.0.0.
  160. /// </remarks>
  161. /// <returns>(int) Returns non-zero if this is JPG data, zero otherwise.</returns>
  162. int IMG_isJPG(SDL_RWops *src);
  163.  
  164. /// <summary>
  165. /// Detect JXL image data on a readable/seekable SDL_RWops.
  166. /// </summary>
  167. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  168. /// nint refers to a SDL_RWops *
  169. /// <remarks>
  170. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  171. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  172. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  173. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  174. /// This function is available since SDL_image 2.6.0.
  175. /// </remarks>
  176. /// <returns>(int) Returns non-zero if this is JXL data, zero otherwise.</returns>
  177. int IMG_isJXL(SDL_RWops *src);
  178.  
  179. /// <summary>
  180. /// Detect LBM image data on a readable/seekable SDL_RWops.
  181. /// </summary>
  182. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  183. /// nint refers to a SDL_RWops *
  184. /// <remarks>
  185. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  186. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  187. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  188. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  189. /// This function is available since SDL_image 2.0.0.
  190. /// </remarks>
  191. /// <returns>(int) Returns non-zero if this is LBM data, zero otherwise.</returns>
  192. int IMG_isLBM(SDL_RWops *src);
  193.  
  194. /// <summary>
  195. /// Detect PCX image data on a readable/seekable SDL_RWops.
  196. /// </summary>
  197. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  198. /// nint refers to a SDL_RWops *
  199. /// <remarks>
  200. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  201. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  202. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  203. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  204. /// This function is available since SDL_image 2.0.0.
  205. /// </remarks>
  206. /// <returns>(int) Returns non-zero if this is PCX data, zero otherwise.</returns>
  207. int IMG_isPCX(SDL_RWops *src);
  208.  
  209. /// <summary>
  210. /// Detect PNG image data on a readable/seekable SDL_RWops.
  211. /// </summary>
  212. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  213. /// nint refers to a SDL_RWops *
  214. /// <remarks>
  215. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  216. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  217. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  218. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  219. /// This function is available since SDL_image 2.0.0.
  220. /// </remarks>
  221. /// <returns>(int) Returns non-zero if this is PNG data, zero otherwise.</returns>
  222. int IMG_isPNG(SDL_RWops *src);
  223.  
  224. /// <summary>
  225. /// Detect PNM image data on a readable/seekable SDL_RWops.
  226. /// </summary>
  227. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  228. /// nint refers to a SDL_RWops *
  229. /// <remarks>
  230. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  231. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  232. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  233. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  234. /// This function is available since SDL_image 2.0.0.
  235. /// </remarks>
  236. /// <returns>(int) Returns non-zero if this is PNM data, zero otherwise.</returns>
  237. int IMG_isPNM(SDL_RWops *src);
  238.  
  239. /// <summary>
  240. /// Detect QOI image data on a readable/seekable SDL_RWops.
  241. /// </summary>
  242. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  243. /// nint refers to a SDL_RWops *
  244. /// <remarks>
  245. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  246. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  247. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  248. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  249. /// This function is available since SDL_image 2.6.0.
  250. /// </remarks>
  251. /// <returns>(int) Returns non-zero if this is QOI data, zero otherwise.</returns>
  252. int IMG_isQOI(SDL_RWops *src);
  253.  
  254. /// <summary>
  255. /// Detect SVG image data on a readable/seekable SDL_RWops.
  256. /// </summary>
  257. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  258. /// nint refers to a SDL_RWops *
  259. /// <remarks>
  260. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  261. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  262. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  263. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  264. /// This function is available since SDL_image 2.0.2.
  265. /// </remarks>
  266. /// <returns>(int) Returns non-zero if this is SVG data, zero otherwise.</returns>
  267. int IMG_isSVG(SDL_RWops *src);
  268.  
  269. /// <summary>
  270. /// Detect TIFF image data on a readable/seekable SDL_RWops.
  271. /// </summary>
  272. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  273. /// nint refers to a SDL_RWops *
  274. /// <remarks>
  275. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  276. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  277. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  278. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  279. /// This function is available since SDL_image 2.0.0.
  280. /// </remarks>
  281. /// <returns>(int) Returns non-zero if this is TIFF data, zero otherwise.</returns>
  282. int IMG_isTIF(SDL_RWops *src);
  283.  
  284. /// <summary>
  285. /// Detect WEBP image data on a readable/seekable SDL_RWops.
  286. /// </summary>
  287. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  288. /// nint refers to a SDL_RWops *
  289. /// <remarks>
  290. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  291. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  292. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  293. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  294. /// This function is available since SDL_image 2.0.0.
  295. /// </remarks>
  296. /// <returns>(int) Returns non-zero if this is WEBP data, zero otherwise.</returns>
  297. int IMG_isWEBP(SDL_RWops *src);
  298.  
  299. /// <summary>
  300. /// Detect XCF image data on a readable/seekable SDL_RWops.
  301. /// </summary>
  302. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  303. /// nint refers to a SDL_RWops *
  304. /// <remarks>
  305. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  306. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  307. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  308. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  309. /// This function is available since SDL_image 2.0.0.
  310. /// </remarks>
  311. /// <returns>(int) Returns non-zero if this is XCF data, zero otherwise.</returns>
  312. int IMG_isXCF(SDL_RWops *src);
  313.  
  314. /// <summary>
  315. /// Detect XPM image data on a readable/seekable SDL_RWops.
  316. /// </summary>
  317. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  318. /// nint refers to a SDL_RWops *
  319. /// <remarks>
  320. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  321. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  322. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  323. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  324. /// This function is available since SDL_image 2.0.0.
  325. /// </remarks>
  326. /// <returns>(int) Returns non-zero if this is XPM data, zero otherwise.</returns>
  327. int IMG_isXPM(SDL_RWops *src);
  328.  
  329. /// <summary>
  330. /// Detect XV image data on a readable/seekable SDL_RWops.
  331. /// </summary>
  332. /// <param name="src">a seekable/readable SDL_RWops to provide image data.
  333. /// nint refers to a SDL_RWops *
  334. /// <remarks>
  335. /// This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_RWops (usually a few bytes).
  336. /// There is no distinction made between "not the filetype in question" and basic i/o errors.
  337. /// This function will always attempt to seek the RWops back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a differentIMG_isTYPEfunction, or load the image without further seeking.
  338. /// You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
  339. /// This function is available since SDL_image 2.0.0.
  340. /// </remarks>
  341. /// <returns>(int) Returns non-zero if this is XV data, zero otherwise.</returns>
  342. int IMG_isXV(SDL_RWops *src);
  343.  
  344. /// <summary>
  345. /// This function gets the version of the dynamically linked SDL_image library.
  346. /// </summary>
  347. /// <remarks>
  348. /// it should NOT be used to fill a version structure, instead you should use the SDL_IMAGE_VERSION() macro.
  349. /// </remarks>
  350. /// <returns>(const SDL_version *) Returns SDL_image version.</returns>
  351. const SDL_version * IMG_Linked_Version( void );
  352.  
  353. /// <summary>
  354. /// Load an image from a filesystem path into a software surface.
  355. /// </summary>
  356. /// <param name="file">a path on the filesystem to load an image from.
  357. /// nint refers to a const char *
  358. /// <remarks>
  359. /// An SDL_Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
  360. /// There are no guarantees about what format the new SDL_Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an SDL_Surface for its specifics, and use SDL_ConvertSurface to then migrate to any supported format.
  361. /// If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
  362. /// There is a separate function to read files from an SDL_RWops, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function isIMG_Load_RW().
  363. /// If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an SDL_Texture for use by the GPU without using a software surface: callIMG_LoadTexture() instead.
  364. /// When done with the returned surface, the app should dispose of it with a call to SDL_FreeSurface().
  365. /// This function is available since SDL_image 2.0.0.
  366. /// </remarks>
  367. /// <returns>(SDL_Surface *) Returns a new SDL surface, or NULL on error.</returns>
  368. SDL_Surface * IMG_Load( const char *file);
  369.  
  370. /// <summary>
  371. /// Load an image from an SDL data source into a software surface.
  372. /// </summary>
  373. /// <param name="src">an SDL_RWops that data will be read from.
  374. /// nint refers to a SDL_RWops *
  375. /// </param>
  376. /// <remarks>
  377. /// An SDL_Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
  378. /// There are no guarantees about what format the new SDL_Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an SDL_Surface for its specifics, and use SDL_ConvertSurface to then migrate to any supported format.
  379. /// If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
  380. /// Iffreesrcis non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from the RWops during this call in any case.
  381. /// There is a separate function to read files from disk without having to deal with SDL_RWops:IMG_Load("filename.jpg")will call this function and manage those details for you, determining the file type from the filename's extension.
  382. /// There is alsoIMG_LoadTyped_RW(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
  383. /// If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an SDL_Texture for use by the GPU without using a software surface: callIMG_LoadTexture_RW() instead.
  384. /// When done with the returned surface, the app should dispose of it with a call to SDL_FreeSurface().
  385. /// This function is available since SDL_image 2.0.0.
  386. /// </remarks>
  387. /// <returns>(SDL_Surface *) Returns a new SDL surface, or NULL on error.</returns>
  388. SDL_Surface * IMG_Load_RW(SDL_RWops *src, int freesrc);
  389.  
  390. /// <summary>
  391. /// Load an animation from a file.
  392. /// </summary>
  393. /// <param name="file">path on the filesystem containing an animated image.
  394. /// nint refers to a const char *
  395. /// <remarks>
  396. /// When done with the returned animation, the app should dispose of it with a call toIMG_FreeAnimation().
  397. /// This function is available since SDL_image 2.6.0.
  398. /// </remarks>
  399. /// <returns>(IMG_Animation *) Returns a new IMG_Animation, or NULL on error.</returns>
  400. IMG_Animation * IMG_LoadAnimation( const char *file);
  401.  
  402. /// <summary>
  403. /// Load an animation from an SDL_RWops.
  404. /// </summary>
  405. /// <param name="src">an SDL_RWops that data will be read from.
  406. /// nint refers to a SDL_RWops *
  407. /// </param>
  408. /// <remarks>
  409. /// Iffreesrcis non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from the RWops during this call in any case.
  410. /// When done with the returned animation, the app should dispose of it with a call toIMG_FreeAnimation().
  411. /// This function is available since SDL_image 2.6.0.
  412. /// </remarks>
  413. /// <returns>(IMG_Animation *) Returns a new IMG_Animation, or NULL on error.</returns>
  414. IMG_Animation * IMG_LoadAnimation_RW(SDL_RWops *src, int freesrc);
  415.  
  416. /// <summary>
  417. /// Load an animation from an SDL datasource
  418. /// </summary>
  419. /// <param name="src">an SDL_RWops that data will be read from.
  420. /// nint refers to a SDL_RWops *
  421. /// </param>
  422. /// <param name="type">a filename extension that represent this data ("GIF", etc).
  423. /// nint refers to a const char *
  424. /// <remarks>
  425. /// Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. Iftypeis NULL, SDL_image will rely solely on its ability to guess the format.
  426. /// Iffreesrcis non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from the RWops during this call in any case.
  427. /// When done with the returned animation, the app should dispose of it with a call toIMG_FreeAnimation().
  428. /// This function is available since SDL_image 2.6.0.
  429. /// </remarks>
  430. /// <returns>(IMG_Animation *) Returns a new IMG_Animation, or NULL on error.</returns>
  431. IMG_Animation * IMG_LoadAnimationTyped_RW(SDL_RWops *src, int freesrc, const char *type);
  432.  
  433. /// <summary>
  434. /// Load a AVIF image directly.
  435. /// </summary>
  436. /// <param name="src">an SDL_RWops to load image data from.
  437. /// nint refers to a SDL_RWops *
  438. /// <remarks>
  439. /// If you know you definitely have a AVIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  440. /// This function is available since SDL_image 2.6.0.
  441. /// </remarks>
  442. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  443. SDL_Surface * IMG_LoadAVIF_RW(SDL_RWops *src);
  444.  
  445. /// <summary>
  446. /// Load a BMP image directly.
  447. /// </summary>
  448. /// <param name="src">an SDL_RWops to load image data from.
  449. /// nint refers to a SDL_RWops *
  450. /// <remarks>
  451. /// If you know you definitely have a BMP image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  452. /// This function is available since SDL_image 2.0.0.
  453. /// </remarks>
  454. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  455. SDL_Surface * IMG_LoadBMP_RW(SDL_RWops *src);
  456.  
  457. /// <summary>
  458. /// Load a CUR image directly.
  459. /// </summary>
  460. /// <param name="src">an SDL_RWops to load image data from.
  461. /// nint refers to a SDL_RWops *
  462. /// <remarks>
  463. /// If you know you definitely have a CUR image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  464. /// This function is available since SDL_image 2.0.0.
  465. /// </remarks>
  466. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  467. SDL_Surface * IMG_LoadCUR_RW(SDL_RWops *src);
  468.  
  469. /// <summary>
  470. /// Load a GIF image directly.
  471. /// </summary>
  472. /// <param name="src">an SDL_RWops to load image data from.
  473. /// nint refers to a SDL_RWops *
  474. /// <remarks>
  475. /// If you know you definitely have a GIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  476. /// This function is available since SDL_image 2.0.0.
  477. /// </remarks>
  478. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  479. SDL_Surface * IMG_LoadGIF_RW(SDL_RWops *src);
  480.  
  481. /// <summary>
  482. /// Load a GIF animation directly.
  483. /// </summary>
  484. /// <param name="src">an SDL_RWops that data will be read from.
  485. /// nint refers to a SDL_RWops *
  486. /// <remarks>
  487. /// If you know you definitely have a GIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  488. /// This function is available since SDL_image 2.6.0.
  489. /// </remarks>
  490. /// <returns>(IMG_Animation *) Returns a new IMG_Animation, or NULL on error.</returns>
  491. IMG_Animation * IMG_LoadGIFAnimation_RW(SDL_RWops *src);
  492.  
  493. /// <summary>
  494. /// Load a ICO image directly.
  495. /// </summary>
  496. /// <param name="src">an SDL_RWops to load image data from.
  497. /// nint refers to a SDL_RWops *
  498. /// <remarks>
  499. /// If you know you definitely have a ICO image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  500. /// This function is available since SDL_image 2.0.0.
  501. /// </remarks>
  502. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  503. SDL_Surface * IMG_LoadICO_RW(SDL_RWops *src);
  504.  
  505. /// <summary>
  506. /// Load a JPG image directly.
  507. /// </summary>
  508. /// <param name="src">an SDL_RWops to load image data from.
  509. /// nint refers to a SDL_RWops *
  510. /// <remarks>
  511. /// If you know you definitely have a JPG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  512. /// This function is available since SDL_image 2.0.0.
  513. /// </remarks>
  514. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  515. SDL_Surface * IMG_LoadJPG_RW(SDL_RWops *src);
  516.  
  517. /// <summary>
  518. /// Load a JXL image directly.
  519. /// </summary>
  520. /// <param name="src">an SDL_RWops to load image data from.
  521. /// nint refers to a SDL_RWops *
  522. /// <remarks>
  523. /// If you know you definitely have a JXL image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  524. /// This function is available since SDL_image 2.6.0.
  525. /// </remarks>
  526. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  527. SDL_Surface * IMG_LoadJXL_RW(SDL_RWops *src);
  528.  
  529. /// <summary>
  530. /// Load a LBM image directly.
  531. /// </summary>
  532. /// <param name="src">an SDL_RWops to load image data from.
  533. /// nint refers to a SDL_RWops *
  534. /// <remarks>
  535. /// If you know you definitely have a LBM image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  536. /// This function is available since SDL_image 2.0.0.
  537. /// </remarks>
  538. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  539. SDL_Surface * IMG_LoadLBM_RW(SDL_RWops *src);
  540.  
  541. /// <summary>
  542. /// Load a PCX image directly.
  543. /// </summary>
  544. /// <param name="src">an SDL_RWops to load image data from.
  545. /// nint refers to a SDL_RWops *
  546. /// <remarks>
  547. /// If you know you definitely have a PCX image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  548. /// This function is available since SDL_image 2.0.0.
  549. /// </remarks>
  550. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  551. SDL_Surface * IMG_LoadPCX_RW(SDL_RWops *src);
  552.  
  553. /// <summary>
  554. /// Load a PNG image directly.
  555. /// </summary>
  556. /// <param name="src">an SDL_RWops to load image data from.
  557. /// nint refers to a SDL_RWops *
  558. /// <remarks>
  559. /// If you know you definitely have a PNG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  560. /// This function is available since SDL_image 2.0.0.
  561. /// </remarks>
  562. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  563. SDL_Surface * IMG_LoadPNG_RW(SDL_RWops *src);
  564.  
  565. /// <summary>
  566. /// Load a PNM image directly.
  567. /// </summary>
  568. /// <param name="src">an SDL_RWops to load image data from.
  569. /// nint refers to a SDL_RWops *
  570. /// <remarks>
  571. /// If you know you definitely have a PNM image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  572. /// This function is available since SDL_image 2.0.0.
  573. /// </remarks>
  574. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  575. SDL_Surface * IMG_LoadPNM_RW(SDL_RWops *src);
  576.  
  577. /// <summary>
  578. /// Load a QOI image directly.
  579. /// </summary>
  580. /// <param name="src">an SDL_RWops to load image data from.
  581. /// nint refers to a SDL_RWops *
  582. /// <remarks>
  583. /// If you know you definitely have a QOI image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  584. /// This function is available since SDL_image 2.6.0.
  585. /// </remarks>
  586. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  587. SDL_Surface * IMG_LoadQOI_RW(SDL_RWops *src);
  588.  
  589. /// <summary>
  590. /// Load an SVG image, scaled to a specific size.
  591. /// </summary>
  592. /// <param name="src">an SDL_RWops to load SVG data from.
  593. /// nint refers to a SDL_RWops *
  594. /// </param>
  595. /// </param>
  596. /// <remarks>
  597. /// Since SVG files are resolution-independent, you specify the size you would like the output image to be and it will be generated at those dimensions.
  598. /// Either width or height may be 0 and the image will be auto-sized to preserve aspect ratio.
  599. /// When done with the returned surface, the app should dispose of it with a call to SDL_FreeSurface().
  600. /// This function is available since SDL_image 2.6.0.
  601. /// </remarks>
  602. /// <returns>(SDL_Surface *) Returns a new SDL surface, or NULL on error.</returns>
  603. SDL_Surface * IMG_LoadSizedSVG_RW(SDL_RWops *src, int width, int height);
  604.  
  605. /// <summary>
  606. /// Load a SVG image directly.
  607. /// </summary>
  608. /// <param name="src">an SDL_RWops to load image data from.
  609. /// nint refers to a SDL_RWops *
  610. /// <remarks>
  611. /// If you know you definitely have a SVG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  612. /// This function is available since SDL_image 2.0.2.
  613. /// </remarks>
  614. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  615. SDL_Surface * IMG_LoadSVG_RW(SDL_RWops *src);
  616.  
  617. /// <summary>
  618. /// Load an image from a filesystem path into a GPU texture.
  619. /// </summary>
  620. /// <param name="renderer">the SDL_Renderer to use to create the GPU texture.
  621. /// nint refers to a SDL_Renderer *
  622. /// <param name="file">a path on the filesystem to load an image from.
  623. /// nint refers to a const char *
  624. /// <remarks>
  625. /// An SDL_Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound SDL_Surface if you don't need to manipulate the image directly after loading it.
  626. /// If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an SDL_Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
  627. /// There is a separate function to read files from an SDL_RWops, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function isIMG_LoadTexture_RW().
  628. /// If you would rather decode an image to an SDL_Surface (a buffer of pixels in CPU memory), callIMG_Load() instead.
  629. /// When done with the returned texture, the app should dispose of it with a call to SDL_DestroyTexture().
  630. /// This function is available since SDL_image 2.0.0.
  631. /// </remarks>
  632. /// <returns>(SDL_Texture *) Returns a new texture, or NULL on error.</returns>
  633. SDL_Texture * IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
  634.  
  635. /// <summary>
  636. /// Load an image from an SDL data source into a GPU texture.
  637. /// </summary>
  638. /// <param name="renderer">the SDL_Renderer to use to create the GPU texture.
  639. /// nint refers to a SDL_Renderer *
  640. /// <param name="src">an SDL_RWops that data will be read from.
  641. /// nint refers to a SDL_RWops *
  642. /// </param>
  643. /// <remarks>
  644. /// An SDL_Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound SDL_Surface if you don't need to manipulate the image directly after loading it.
  645. /// If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an SDL_Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
  646. /// Iffreesrcis non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from the RWops during this call in any case.
  647. /// There is a separate function to read files from disk without having to deal with SDL_RWops:IMG_LoadTexture(renderer, "filename.jpg")will call this function and manage those details for you, determining the file type from the filename's extension.
  648. /// There is alsoIMG_LoadTextureTyped_RW(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
  649. /// If you would rather decode an image to an SDL_Surface (a buffer of pixels in CPU memory), callIMG_Load() instead.
  650. /// When done with the returned texture, the app should dispose of it with a call to SDL_DestroyTexture().
  651. /// This function is available since SDL_image 2.0.0.
  652. /// </remarks>
  653. /// <returns>(SDL_Texture *) Returns a new texture, or NULL on error.</returns>
  654. SDL_Texture * IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc);
  655.  
  656. /// <summary>
  657. /// Load an image from an SDL data source into a GPU texture.
  658. /// </summary>
  659. /// <param name="renderer">the SDL_Renderer to use to create the GPU texture.
  660. /// nint refers to a SDL_Renderer *
  661. /// <param name="src">an SDL_RWops that data will be read from.
  662. /// nint refers to a SDL_RWops *
  663. /// </param>
  664. /// <param name="type">a filename extension that represent this data ("BMP", "GIF", "PNG", etc).
  665. /// nint refers to a const char *
  666. /// <remarks>
  667. /// An SDL_Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound SDL_Surface if you don't need to manipulate the image directly after loading it.
  668. /// If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an SDL_Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
  669. /// Iffreesrcis non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from the RWops during this call in any case.
  670. /// Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. Iftypeis NULL, SDL_image will rely solely on its ability to guess the format.
  671. /// There is a separate function to read files from disk without having to deal with SDL_RWops:IMG_LoadTexture("filename.jpg")will call this function and manage those details for you, determining the file type from the filename's extension.
  672. /// There is alsoIMG_LoadTexture_RW(), which is equivalent to this function except that it will rely on SDL_image to determine what type of data it is loading, much like passing a NULL for type.
  673. /// If you would rather decode an image to an SDL_Surface (a buffer of pixels in CPU memory), callIMG_LoadTyped_RW() instead.
  674. /// When done with the returned texture, the app should dispose of it with a call to SDL_DestroyTexture().
  675. /// This function is available since SDL_image 2.0.0.
  676. /// </remarks>
  677. /// <returns>(SDL_Texture *) Returns a new texture, or NULL on error.</returns>
  678. SDL_Texture * IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type);
  679.  
  680. /// <summary>
  681. /// Load a TGA image directly.
  682. /// </summary>
  683. /// <param name="src">an SDL_RWops to load image data from.
  684. /// nint refers to a SDL_RWops *
  685. /// <remarks>
  686. /// If you know you definitely have a TGA image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  687. /// This function is available since SDL_image 2.0.0.
  688. /// </remarks>
  689. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  690. SDL_Surface * IMG_LoadTGA_RW(SDL_RWops *src);
  691.  
  692. /// <summary>
  693. /// Load a TIFF image directly.
  694. /// </summary>
  695. /// <param name="src">an SDL_RWops to load image data from.
  696. /// nint refers to a SDL_RWops *
  697. /// <remarks>
  698. /// If you know you definitely have a TIFF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  699. /// This function is available since SDL_image 2.0.0.
  700. /// </remarks>
  701. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  702. SDL_Surface * IMG_LoadTIF_RW(SDL_RWops *src);
  703.  
  704. /// <summary>
  705. /// Load an image from an SDL data source into a software surface.
  706. /// </summary>
  707. /// <param name="src">an SDL_RWops that data will be read from.
  708. /// nint refers to a SDL_RWops *
  709. /// </param>
  710. /// <param name="type">a filename extension that represent this data ("BMP", "GIF", "PNG", etc).
  711. /// nint refers to a const char *
  712. /// <remarks>
  713. /// An SDL_Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
  714. /// There are no guarantees about what format the new SDL_Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an SDL_Surface for its specifics, and use SDL_ConvertSurface to then migrate to any supported format.
  715. /// If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
  716. /// Iffreesrcis non-zero, the RWops will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from the RWops during this call in any case.
  717. /// Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. Iftypeis NULL, SDL_image will rely solely on its ability to guess the format.
  718. /// There is a separate function to read files from disk without having to deal with SDL_RWops:IMG_Load("filename.jpg")will call this function and manage those details for you, determining the file type from the filename's extension.
  719. /// There is alsoIMG_Load_RW(), which is equivalent to this function except that it will rely on SDL_image to determine what type of data it is loading, much like passing a NULL for type.
  720. /// If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an SDL_Texture for use by the GPU without using a software surface: callIMG_LoadTextureTyped_RW() instead.
  721. /// When done with the returned surface, the app should dispose of it with a call to SDL_FreeSurface().
  722. /// This function is available since SDL_image 2.0.0.
  723. /// </remarks>
  724. /// <returns>(SDL_Surface *) Returns a new SDL surface, or NULL on error.</returns>
  725. SDL_Surface * IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type);
  726.  
  727. /// <summary>
  728. /// Load a WEBP image directly.
  729. /// </summary>
  730. /// <param name="src">an SDL_RWops to load image data from.
  731. /// nint refers to a SDL_RWops *
  732. /// <remarks>
  733. /// If you know you definitely have a WEBP image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  734. /// This function is available since SDL_image 2.0.0.
  735. /// </remarks>
  736. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  737. SDL_Surface * IMG_LoadWEBP_RW(SDL_RWops *src);
  738.  
  739. /// <summary>
  740. /// Load a WEBP animation directly.
  741. /// </summary>
  742. /// <param name="src">an SDL_RWops that data will be read from.
  743. /// nint refers to a SDL_RWops *
  744. /// <remarks>
  745. /// If you know you definitely have a WEBP image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  746. /// This function is available since SDL_image 2.6.0.
  747. /// </remarks>
  748. /// <returns>(IMG_Animation *) Returns a new IMG_Animation, or NULL on error.</returns>
  749. IMG_Animation * IMG_LoadWEBPAnimation_RW(SDL_RWops *src);
  750.  
  751. /// <summary>
  752. /// Load a XCF image directly.
  753. /// </summary>
  754. /// <param name="src">an SDL_RWops to load image data from.
  755. /// nint refers to a SDL_RWops *
  756. /// <remarks>
  757. /// If you know you definitely have a XCF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  758. /// This function is available since SDL_image 2.0.0.
  759. /// </remarks>
  760. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  761. SDL_Surface * IMG_LoadXCF_RW(SDL_RWops *src);
  762.  
  763. /// <summary>
  764. /// Load a XPM image directly.
  765. /// </summary>
  766. /// <param name="src">an SDL_RWops to load image data from.
  767. /// nint refers to a SDL_RWops *
  768. /// <remarks>
  769. /// If you know you definitely have a XPM image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  770. /// This function is available since SDL_image 2.0.0.
  771. /// </remarks>
  772. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  773. SDL_Surface * IMG_LoadXPM_RW(SDL_RWops *src);
  774.  
  775. /// <summary>
  776. /// Load a XV image directly.
  777. /// </summary>
  778. /// <param name="src">an SDL_RWops to load image data from.
  779. /// nint refers to a SDL_RWops *
  780. /// <remarks>
  781. /// If you know you definitely have a XV image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an SDL_RWops interface available here.
  782. /// This function is available since SDL_image 2.0.0.
  783. /// </remarks>
  784. /// <returns>(SDL_Surface *) Returns SDL surface, or NULL on error.</returns>
  785. SDL_Surface * IMG_LoadXV_RW(SDL_RWops *src);
  786.  
  787. /// <summary>
  788. /// Deinitialize SDL_image.
  789. /// </summary>
  790. /// <remarks>
  791. /// This should be the last function you call in SDL_image, after freeing all other resources. This will unload any shared libraries it is using for various codecs.
  792. /// After this call, a call toIMG_Init(0) will return 0 (no codecs loaded).
  793. /// You can safely callIMG_Init() to reload various codec support after this call.
  794. /// Unlike other SDL satellite libraries, calls toIMG_Initdo not stack; a single call toIMG_Quit() will deinitialize everything and does not have to be paired with a matchingIMG_Initcall. For that reason, it's considered best practices to have a singleIMG_InitandIMG_Quitcall in your program. While this isn't required, be aware of the risks of deviating from that behavior.
  795. /// This function is available since SDL_image 2.0.0.
  796. /// </remarks>
  797. void IMG_Quit( void );
  798.  
  799. /// <summary>
  800. /// Load an XPM image from a memory array.
  801. /// </summary>
  802. /// <param name="xpm">a null-terminated array of strings that comprise XPM data.
  803. /// nint refers to a char **
  804. /// <remarks>
  805. /// The returned surface will be an 8bpp indexed surface, if possible, otherwise it will be 32bpp. If you always want 32-bit data, useIMG_ReadXPMFromArrayToRGB888() instead.
  806. /// When done with the returned surface, the app should dispose of it with a call to SDL_FreeSurface().
  807. /// This function is available since SDL_image 2.0.0.
  808. /// </remarks>
  809. /// <returns>(SDL_Surface *) Returns a new SDL surface, or NULL on error.</returns>
  810. SDL_Surface * IMG_ReadXPMFromArray( char **xpm);
  811.  
  812. /// <summary>
  813. /// Load an XPM image from a memory array.
  814. /// </summary>
  815. /// <param name="xpm">a null-terminated array of strings that comprise XPM data.
  816. /// nint refers to a char **
  817. /// <remarks>
  818. /// The returned surface will always be a 32-bit RGB surface. If you want 8-bit indexed colors (and the XPM data allows it), useIMG_ReadXPMFromArray() instead.
  819. /// When done with the returned surface, the app should dispose of it with a call to SDL_FreeSurface().
  820. /// This function is available since SDL_image 2.6.0.
  821. /// </remarks>
  822. /// <returns>(SDL_Surface *) Returns a new SDL surface, or NULL on error.</returns>
  823. SDL_Surface * IMG_ReadXPMFromArrayToRGB888( char **xpm);
  824.  
  825. /// <summary>
  826. /// Save an SDL_Surface into a JPEG image file.
  827. /// </summary>
  828. /// <param name="surface">the SDL surface to save.
  829. /// nint refers to a SDL_Surface *
  830. /// <param name="file">path on the filesystem to write new file to.
  831. /// nint refers to a const char *
  832. /// </param>
  833. /// <remarks>
  834. /// If the file already exists, it will be overwritten.
  835. /// This function is available since SDL_image 2.0.2.
  836. /// </remarks>
  837. /// <returns>(int) Returns 0 if successful, -1 on error.</returns>
  838. int IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality);
  839.  
  840. /// <summary>
  841. /// Save an SDL_Surface into JPEG image data, via an SDL_RWops.
  842. /// </summary>
  843. /// <param name="surface">the SDL surface to save.
  844. /// nint refers to a SDL_Surface *
  845. /// <param name="dst">the SDL_RWops to save the image data to.
  846. /// nint refers to a SDL_RWops *
  847. /// <remarks>
  848. /// If you just want to save to a filename, you can useIMG_SaveJPG() instead.
  849. /// This function is available since SDL_image 2.0.2.
  850. /// </remarks>
  851. /// <returns>(int) Returns 0 if successful, -1 on error.</returns>
  852. int IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality);
  853.  
  854. /// <summary>
  855. /// Save an SDL_Surface into a PNG image file.
  856. /// </summary>
  857. /// <param name="surface">the SDL surface to save.
  858. /// nint refers to a SDL_Surface *
  859. /// <param name="file">path on the filesystem to write new file to.
  860. /// nint refers to a const char *
  861. /// <remarks>
  862. /// If the file already exists, it will be overwritten.
  863. /// This function is available since SDL_image 2.0.0.
  864. /// </remarks>
  865. /// <returns>(int) Returns 0 if successful, -1 on error.</returns>
  866. int IMG_SavePNG(SDL_Surface *surface, const char *file);
  867.  
  868. /// <summary>
  869. /// Save an SDL_Surface into PNG image data, via an SDL_RWops.
  870. /// </summary>
  871. /// <param name="surface">the SDL surface to save.
  872. /// nint refers to a SDL_Surface *
  873. /// <param name="dst">the SDL_RWops to save the image data to.
  874. /// nint refers to a SDL_RWops *
  875. /// <remarks>
  876. /// If you just want to save to a filename, you can useIMG_SavePNG() instead.
  877. /// This function is available since SDL_image 2.0.0.
  878. /// </remarks>
  879. /// <returns>(int) Returns 0 if successful, -1 on error.</returns>
  880. int IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst);
  881.  
  882. /// <summary>
  883. /// Report SDL_image errors
  884. /// </summary>
  885. #define IMG_SetError    SDL_SetError
  886.  
  887. /// <summary>
  888. /// This is the version number macro for the current SDL_image version.
  889. /// </summary>
  890. /// <remarks>
  891. /// In versions higher than 2.9.0, the minor version overflows into the thousands digit: for example, 2.23.0 is encoded as 4300. This macro will not be available in SDL 3.x or SDL_image 3.x.
  892. /// Deprecated, use SDL_IMAGE_VERSION_ATLEAST or SDL_IMAGE_VERSION instead.
  893. /// </remarks>
  894. #define SDL_IMAGE_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL)
  895.  
  896. /// <summary>
  897. /// Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
  898. /// </summary>
  899. #define SDL_IMAGE_MAJOR_VERSION 2
  900.  
  901. /// <summary>
  902. /// This macro can be used to fill a version structure with the compile-time version of the SDL_image library.
  903. /// </summary>
  904. #define SDL_IMAGE_VERSION(X)                        \ {                                                   \ (X)->major = SDL_IMAGE_MAJOR_VERSION;           \ (X)->minor = SDL_IMAGE_MINOR_VERSION;           \ (X)->patch = SDL_IMAGE_PATCHLEVEL;              \ }
  905.  
  906. /// <summary>
  907. /// This macro will evaluate to true if compiled with SDL_image at least X.Y.Z.
  908. /// </summary>
  909. #define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \ ((SDL_IMAGE_MAJOR_VERSION >= X) && \ (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) && \ (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || SDL_IMAGE_PATCHLEVEL >= Z))
  910.  
Tags: sdl2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement