SDL_rotozoom.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
  3. Copyright (C) 2001-2012 Andreas Schiffler
  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
  17. distribution.
  18. Andreas Schiffler -- aschiffler at ferzkopp dot net
  19. */
  20. #ifndef _SDL_rotozoom_h
  21. #define _SDL_rotozoom_h
  22. #include <math.h>
  23. /* Set up for C function definitions, even when using C++ */
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #ifndef M_PI
  28. #define M_PI 3.141592654
  29. #endif
  30. #include "SDL.h"
  31. /* ---- Defines */
  32. /*!
  33. \brief Disable anti-aliasing (no smoothing).
  34. */
  35. #define SMOOTHING_OFF 0
  36. /*!
  37. \brief Enable anti-aliasing (smoothing).
  38. */
  39. #define SMOOTHING_ON 1
  40. /* ---- Function Prototypes */
  41. #ifdef _MSC_VER
  42. # if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
  43. # define SDL_ROTOZOOM_SCOPE __declspec(dllexport)
  44. # else
  45. # ifdef LIBSDL_GFX_DLL_IMPORT
  46. # define SDL_ROTOZOOM_SCOPE __declspec(dllimport)
  47. # endif
  48. # endif
  49. #endif
  50. #ifndef SDL_ROTOZOOM_SCOPE
  51. # define SDL_ROTOZOOM_SCOPE extern
  52. #endif
  53. /*
  54. Rotozoom functions
  55. */
  56. SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface *src, double angle, double zoom, int smooth);
  57. SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY
  58. (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth);
  59. SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
  60. int *dstheight);
  61. SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY
  62. (int width, int height, double angle, double zoomx, double zoomy,
  63. int *dstwidth, int *dstheight);
  64. /*
  65. Zooming functions
  66. */
  67. SDL_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface *src, double zoomx, double zoomy, int smooth);
  68. SDL_ROTOZOOM_SCOPE void
  69. zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
  70. /*
  71. Shrinking functions
  72. */
  73. SDL_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface *src, int factorx, int factory);
  74. /*
  75. Specialized rotation functions
  76. */
  77. SDL_ROTOZOOM_SCOPE SDL_Surface *rotateSurface90Degrees(SDL_Surface *src, int numClockwiseTurns);
  78. /* Ends C function definitions when using C++ */
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* _SDL_rotozoom_h */