SDL_surface.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #ifndef _SDL_surface_h
  2. #define _SDL_surface_h
  3. #include "SDL_stdinc.h"
  4. #include "SDL_pixels.h"
  5. #include "SDL_rect.h"
  6. #include "SDL_blendmode.h"
  7. #include "SDL_rwops.h"
  8. #include "begin_code.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #define SDL_SWSURFACE 0
  13. #define SDL_PREALLOC 0x00000001
  14. #define SDL_RLEACCEL 0x00000002
  15. #define SDL_DONTFREE 0x00000004
  16. #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
  17. typedef struct SDL_Surface
  18. {
  19. Uint32 flags;
  20. SDL_PixelFormat *format;
  21. int w, h;
  22. int pitch;
  23. void *pixels;
  24. void *userdata;
  25. int locked;
  26. void *lock_data;
  27. SDL_Rect clip_rect;
  28. struct SDL_BlitMap *map;
  29. int refcount;
  30. } SDL_Surface;
  31. typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
  32. struct SDL_Surface * dst, SDL_Rect * dstrect);
  33. typedef SDL_Surface * SDLCALL tSDL_CreateRGBSurface
  34. (Uint32 flags, int width, int height, int depth,
  35. Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
  36. typedef SDL_Surface * SDLCALL tSDL_CreateRGBSurfaceFrom(void *pixels,
  37. int width,
  38. int height,
  39. int depth,
  40. int pitch,
  41. Uint32 Rmask,
  42. Uint32 Gmask,
  43. Uint32 Bmask,
  44. Uint32 Amask);
  45. typedef void SDLCALL tSDL_FreeSurface(SDL_Surface * surface);
  46. typedef int SDLCALL tSDL_SetSurfacePalette(SDL_Surface * surface,
  47. SDL_Palette * palette);
  48. typedef int SDLCALL tSDL_LockSurface(SDL_Surface * surface);
  49. typedef void SDLCALL tSDL_UnlockSurface(SDL_Surface * surface);
  50. typedef SDL_Surface * SDLCALL tSDL_LoadBMP_RW(SDL_RWops * src,
  51. int freesrc);
  52. #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
  53. typedef int SDLCALL tSDL_SaveBMP_RW
  54. (SDL_Surface * surface, SDL_RWops * dst, int freedst);
  55. #define SDL_SaveBMP(surface, file) \
  56. SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
  57. typedef int SDLCALL tSDL_SetSurfaceRLE(SDL_Surface * surface,
  58. int flag);
  59. typedef int SDLCALL tSDL_SetColorKey(SDL_Surface * surface,
  60. int flag, Uint32 key);
  61. typedef int SDLCALL tSDL_GetColorKey(SDL_Surface * surface,
  62. Uint32 * key);
  63. typedef int SDLCALL tSDL_SetSurfaceColorMod(SDL_Surface * surface,
  64. Uint8 r, Uint8 g, Uint8 b);
  65. typedef int SDLCALL tSDL_GetSurfaceColorMod(SDL_Surface * surface,
  66. Uint8 * r, Uint8 * g,
  67. Uint8 * b);
  68. typedef int SDLCALL tSDL_SetSurfaceAlphaMod(SDL_Surface * surface,
  69. Uint8 alpha);
  70. typedef int SDLCALL tSDL_GetSurfaceAlphaMod(SDL_Surface * surface,
  71. Uint8 * alpha);
  72. typedef int SDLCALL tSDL_SetSurfaceBlendMode(SDL_Surface * surface,
  73. SDL_BlendMode blendMode);
  74. typedef int SDLCALL tSDL_GetSurfaceBlendMode(SDL_Surface * surface,
  75. SDL_BlendMode *blendMode);
  76. typedef SDL_bool SDLCALL tSDL_SetClipRect(SDL_Surface * surface,
  77. const SDL_Rect * rect);
  78. typedef void SDLCALL tSDL_GetClipRect(SDL_Surface * surface,
  79. SDL_Rect * rect);
  80. typedef SDL_Surface * SDLCALL tSDL_ConvertSurface
  81. (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
  82. typedef SDL_Surface * SDLCALL tSDL_ConvertSurfaceFormat
  83. (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
  84. typedef int SDLCALL tSDL_ConvertPixels(int width, int height,
  85. Uint32 src_format,
  86. const void * src, int src_pitch,
  87. Uint32 dst_format,
  88. void * dst, int dst_pitch);
  89. typedef int SDLCALL tSDL_FillRect
  90. (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
  91. typedef int SDLCALL tSDL_FillRects
  92. (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
  93. #define SDL_BlitSurface SDL_UpperBlit
  94. typedef int SDLCALL tSDL_UpperBlit
  95. (SDL_Surface * src, const SDL_Rect * srcrect,
  96. SDL_Surface * dst, SDL_Rect * dstrect);
  97. typedef int SDLCALL tSDL_LowerBlit
  98. (SDL_Surface * src, SDL_Rect * srcrect,
  99. SDL_Surface * dst, SDL_Rect * dstrect);
  100. typedef int SDLCALL tSDL_SoftStretch(SDL_Surface * src,
  101. const SDL_Rect * srcrect,
  102. SDL_Surface * dst,
  103. const SDL_Rect * dstrect);
  104. #define SDL_BlitScaled SDL_UpperBlitScaled
  105. typedef int SDLCALL tSDL_UpperBlitScaled
  106. (SDL_Surface * src, const SDL_Rect * srcrect,
  107. SDL_Surface * dst, SDL_Rect * dstrect);
  108. typedef int SDLCALL tSDL_LowerBlitScaled
  109. (SDL_Surface * src, SDL_Rect * srcrect,
  110. SDL_Surface * dst, SDL_Rect * dstrect);
  111. extern tSDL_CreateRGBSurface *SDL_CreateRGBSurface;
  112. extern tSDL_CreateRGBSurfaceFrom *SDL_CreateRGBSurfaceFrom;
  113. extern tSDL_FreeSurface *SDL_FreeSurface;
  114. extern tSDL_SetSurfacePalette *SDL_SetSurfacePalette;
  115. extern tSDL_LockSurface *SDL_LockSurface;
  116. extern tSDL_UnlockSurface *SDL_UnlockSurface;
  117. extern tSDL_LoadBMP_RW *SDL_LoadBMP_RW;
  118. extern tSDL_SaveBMP_RW *SDL_SaveBMP_RW;
  119. extern tSDL_SetSurfaceRLE *SDL_SetSurfaceRLE;
  120. extern tSDL_SetColorKey *SDL_SetColorKey;
  121. extern tSDL_GetColorKey *SDL_GetColorKey;
  122. extern tSDL_SetSurfaceColorMod *SDL_SetSurfaceColorMod;
  123. extern tSDL_GetSurfaceColorMod *SDL_GetSurfaceColorMod;
  124. extern tSDL_SetSurfaceAlphaMod *SDL_SetSurfaceAlphaMod;
  125. extern tSDL_GetSurfaceAlphaMod *SDL_GetSurfaceAlphaMod;
  126. extern tSDL_SetSurfaceBlendMode *SDL_SetSurfaceBlendMode;
  127. extern tSDL_GetSurfaceBlendMode *SDL_GetSurfaceBlendMode;
  128. extern tSDL_SetClipRect *SDL_SetClipRect;
  129. extern tSDL_GetClipRect *SDL_GetClipRect;
  130. extern tSDL_ConvertSurface *SDL_ConvertSurface;
  131. extern tSDL_ConvertSurfaceFormat *SDL_ConvertSurfaceFormat;
  132. extern tSDL_ConvertPixels *SDL_ConvertPixels;
  133. extern tSDL_FillRect *SDL_FillRect;
  134. extern tSDL_FillRects *SDL_FillRects;
  135. extern tSDL_UpperBlit *SDL_UpperBlit;
  136. extern tSDL_LowerBlit *SDL_LowerBlit;
  137. extern tSDL_SoftStretch *SDL_SoftStretch;
  138. extern tSDL_UpperBlitScaled *SDL_UpperBlitScaled;
  139. extern tSDL_LowerBlitScaled *SDL_LowerBlitScaled;
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143. #include "close_code.h"
  144. #endif