SDL_surface_c.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifndef SDL_surface_c_h_
  20. #define SDL_surface_c_h_
  21. // Useful functions and variables from SDL_surface.c
  22. #include "../SDL_list.h"
  23. // Surface internal flags
  24. typedef Uint32 SDL_SurfaceDataFlags;
  25. #define SDL_INTERNAL_SURFACE_DONTFREE 0x00000001u /**< Surface is referenced internally */
  26. #define SDL_INTERNAL_SURFACE_STACK 0x00000002u /**< Surface is allocated on the stack */
  27. #define SDL_INTERNAL_SURFACE_RLEACCEL 0x00000004u /**< Surface is RLE encoded */
  28. // Surface internal data definition
  29. struct SDL_SurfaceData
  30. {
  31. /** flags for this surface */
  32. SDL_SurfaceDataFlags flags;
  33. /** properties for this surface */
  34. SDL_PropertiesID props;
  35. /** detailed format for this surface */
  36. const SDL_PixelFormatDetails *format;
  37. /** Pixel colorspace */
  38. SDL_Colorspace colorspace;
  39. /** palette for indexed surfaces */
  40. SDL_Palette *palette;
  41. /** Alternate representation of images */
  42. int num_images;
  43. SDL_Surface **images;
  44. /** information needed for surfaces requiring locks */
  45. int locked;
  46. /** clipping information */
  47. SDL_Rect clip_rect;
  48. /** info for fast blit mapping to other surfaces */
  49. SDL_BlitMap map;
  50. };
  51. typedef struct SDL_InternalSurface
  52. {
  53. SDL_Surface surface;
  54. SDL_SurfaceData internal;
  55. } SDL_InternalSurface;
  56. // Surface functions
  57. extern bool SDL_SurfaceValid(SDL_Surface *surface);
  58. extern void SDL_UpdateSurfaceLockFlag(SDL_Surface *surface);
  59. extern float SDL_GetDefaultSDRWhitePoint(SDL_Colorspace colorspace);
  60. extern float SDL_GetSurfaceSDRWhitePoint(SDL_Surface *surface, SDL_Colorspace colorspace);
  61. extern float SDL_GetDefaultHDRHeadroom(SDL_Colorspace colorspace);
  62. extern float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, SDL_Colorspace colorspace);
  63. extern SDL_Surface *SDL_GetSurfaceImage(SDL_Surface *surface, float display_scale);
  64. extern bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
  65. #endif // SDL_surface_c_h_