SDL_image.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. SDL_image: An example image loading library for use with SDL
  3. Copyright (C) 1997-2009 Sam Lantinga
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Sam Lantinga
  16. slouken@libsdl.org
  17. */
  18. /* A simple library to load images of various formats as SDL surfaces */
  19. #ifndef _SDL_IMAGE_H
  20. #define _SDL_IMAGE_H
  21. #include "SDL.h"
  22. #include "SDL_version.h"
  23. #include "begin_code.h"
  24. /* Set up for C function definitions, even when using C++ */
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
  29. */
  30. #define SDL_IMAGE_MAJOR_VERSION 1
  31. #define SDL_IMAGE_MINOR_VERSION 2
  32. #define SDL_IMAGE_PATCHLEVEL 10
  33. /* This macro can be used to fill a version structure with the compile-time
  34. * version of the SDL_image library.
  35. */
  36. #define SDL_IMAGE_VERSION(X) \
  37. { \
  38. (X)->major = SDL_IMAGE_MAJOR_VERSION; \
  39. (X)->minor = SDL_IMAGE_MINOR_VERSION; \
  40. (X)->patch = SDL_IMAGE_PATCHLEVEL; \
  41. }
  42. /* This function gets the version of the dynamically linked SDL_image library.
  43. it should NOT be used to fill a version structure, instead you should
  44. use the SDL_IMAGE_VERSION() macro.
  45. */
  46. extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
  47. typedef enum
  48. {
  49. IMG_INIT_JPG = 0x00000001,
  50. IMG_INIT_PNG = 0x00000002,
  51. IMG_INIT_TIF = 0x00000004
  52. } IMG_InitFlags;
  53. /* Loads dynamic libraries and prepares them for use. Flags should be
  54. one or more flags from IMG_InitFlags OR'd together.
  55. It returns the flags successfully initialized, or 0 on failure.
  56. */
  57. extern DECLSPEC int SDLCALL IMG_Init(int flags);
  58. /* Unloads libraries loaded with IMG_Init */
  59. extern DECLSPEC void SDLCALL IMG_Quit(void);
  60. /* Load an image from an SDL data source.
  61. The 'type' may be one of: "BMP", "GIF", "PNG", etc.
  62. If the image format supports a transparent pixel, SDL will set the
  63. colorkey for the surface. You can enable RLE acceleration on the
  64. surface afterwards by calling:
  65. SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
  66. */
  67. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
  68. /* Convenience functions */
  69. extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
  70. extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
  71. /* Invert the alpha of a surface for use with OpenGL
  72. This function is now a no-op, and only provided for backwards compatibility.
  73. */
  74. extern DECLSPEC int SDLCALL IMG_InvertAlpha(int on);
  75. /* Functions to detect a file type, given a seekable source */
  76. extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
  77. extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
  78. extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
  79. extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
  80. extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
  81. extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
  82. extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
  83. extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
  84. extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
  85. extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
  86. extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
  87. extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
  88. extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
  89. /* Individual loading functions */
  90. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
  91. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src);
  92. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
  93. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
  94. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
  95. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
  96. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
  97. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
  98. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
  99. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
  100. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
  101. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
  102. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
  103. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
  104. extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
  105. /* We'll use SDL for reporting errors */
  106. #define IMG_SetError SDL_SetError
  107. #define IMG_GetError SDL_GetError
  108. /* Ends C function definitions when using C++ */
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #include "close_code.h"
  113. #endif /* _SDL_IMAGE_H */