/project/jni/sdl_gfx/include/SDL_gfxPrimitives.h

https://github.com/aichunyu/FFPlayer · C Header · 208 lines · 108 code · 62 blank · 38 comment · 0 complexity · af105ba70d7ba461003a75cfd1a6003f MD5 · raw file

  1. /*
  2. SDL_gfxPrimitives: graphics primitives for SDL
  3. LGPL (c) A. Schiffler
  4. */
  5. #ifndef _SDL_gfxPrimitives_h
  6. #define _SDL_gfxPrimitives_h
  7. #include <math.h>
  8. #ifndef M_PI
  9. #define M_PI 3.1415926535897932384626433832795
  10. #endif
  11. #include "SDL.h"
  12. /* Set up for C function definitions, even when using C++ */
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /* ----- Versioning */
  17. #define SDL_GFXPRIMITIVES_MAJOR 2
  18. #define SDL_GFXPRIMITIVES_MINOR 0
  19. #define SDL_GFXPRIMITIVES_MICRO 21
  20. /* ----- W32 DLL interface */
  21. #ifdef WIN32
  22. # ifdef DLL_EXPORT
  23. # define SDL_GFXPRIMITIVES_SCOPE __declspec(dllexport)
  24. # else
  25. # ifdef LIBSDL_GFX_DLL_IMPORT
  26. # define SDL_GFXPRIMITIVES_SCOPE __declspec(dllimport)
  27. # endif
  28. # endif
  29. #endif
  30. #ifndef SDL_GFXPRIMITIVES_SCOPE
  31. # define SDL_GFXPRIMITIVES_SCOPE extern
  32. #endif
  33. /* ----- Prototypes */
  34. /* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */
  35. /* Pixel */
  36. SDL_GFXPRIMITIVES_SCOPE int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color);
  37. SDL_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  38. /* Horizontal line */
  39. SDL_GFXPRIMITIVES_SCOPE int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color);
  40. SDL_GFXPRIMITIVES_SCOPE int hlineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  41. /* Vertical line */
  42. SDL_GFXPRIMITIVES_SCOPE int vlineColor(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color);
  43. SDL_GFXPRIMITIVES_SCOPE int vlineRGBA(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  44. /* Rectangle */
  45. SDL_GFXPRIMITIVES_SCOPE int rectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
  46. SDL_GFXPRIMITIVES_SCOPE int rectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
  47. Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  48. /* Filled rectangle (Box) */
  49. SDL_GFXPRIMITIVES_SCOPE int boxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
  50. SDL_GFXPRIMITIVES_SCOPE int boxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
  51. Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  52. /* Line */
  53. SDL_GFXPRIMITIVES_SCOPE int lineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
  54. SDL_GFXPRIMITIVES_SCOPE int lineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
  55. Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  56. /* AA Line */
  57. SDL_GFXPRIMITIVES_SCOPE int aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
  58. SDL_GFXPRIMITIVES_SCOPE int aalineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
  59. Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  60. /* Circle */
  61. SDL_GFXPRIMITIVES_SCOPE int circleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
  62. SDL_GFXPRIMITIVES_SCOPE int circleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  63. /* Arc */
  64. SDL_GFXPRIMITIVES_SCOPE int arcColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color);
  65. SDL_GFXPRIMITIVES_SCOPE int arcRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end,
  66. Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  67. /* AA Circle */
  68. SDL_GFXPRIMITIVES_SCOPE int aacircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
  69. SDL_GFXPRIMITIVES_SCOPE int aacircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
  70. Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  71. /* Filled Circle */
  72. SDL_GFXPRIMITIVES_SCOPE int filledCircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color);
  73. SDL_GFXPRIMITIVES_SCOPE int filledCircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
  74. Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  75. /* Ellipse */
  76. SDL_GFXPRIMITIVES_SCOPE int ellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
  77. SDL_GFXPRIMITIVES_SCOPE int ellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
  78. Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  79. /* AA Ellipse */
  80. SDL_GFXPRIMITIVES_SCOPE int aaellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
  81. SDL_GFXPRIMITIVES_SCOPE int aaellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
  82. Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  83. /* Filled Ellipse */
  84. SDL_GFXPRIMITIVES_SCOPE int filledEllipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
  85. SDL_GFXPRIMITIVES_SCOPE int filledEllipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
  86. Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  87. /* Pie */
  88. SDL_GFXPRIMITIVES_SCOPE int pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
  89. Sint16 start, Sint16 end, Uint32 color);
  90. SDL_GFXPRIMITIVES_SCOPE int pieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
  91. Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  92. /* Filled Pie */
  93. SDL_GFXPRIMITIVES_SCOPE int filledPieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
  94. Sint16 start, Sint16 end, Uint32 color);
  95. SDL_GFXPRIMITIVES_SCOPE int filledPieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
  96. Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  97. /* Trigon */
  98. SDL_GFXPRIMITIVES_SCOPE int trigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
  99. SDL_GFXPRIMITIVES_SCOPE int trigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
  100. Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  101. /* AA-Trigon */
  102. SDL_GFXPRIMITIVES_SCOPE int aatrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
  103. SDL_GFXPRIMITIVES_SCOPE int aatrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
  104. Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  105. /* Filled Trigon */
  106. SDL_GFXPRIMITIVES_SCOPE int filledTrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
  107. SDL_GFXPRIMITIVES_SCOPE int filledTrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
  108. Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  109. /* Polygon */
  110. SDL_GFXPRIMITIVES_SCOPE int polygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
  111. SDL_GFXPRIMITIVES_SCOPE int polygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
  112. int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  113. /* AA-Polygon */
  114. SDL_GFXPRIMITIVES_SCOPE int aapolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
  115. SDL_GFXPRIMITIVES_SCOPE int aapolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
  116. int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  117. /* Filled Polygon */
  118. SDL_GFXPRIMITIVES_SCOPE int filledPolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
  119. SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBA(SDL_Surface * dst, const Sint16 * vx,
  120. const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  121. SDL_GFXPRIMITIVES_SCOPE int texturedPolygon(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy);
  122. /* (Note: These MT versions are required for multi-threaded operation.) */
  123. SDL_GFXPRIMITIVES_SCOPE int filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated);
  124. SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBAMT(SDL_Surface * dst, const Sint16 * vx,
  125. const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
  126. int **polyInts, int *polyAllocated);
  127. SDL_GFXPRIMITIVES_SCOPE int texturedPolygonMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy, int **polyInts, int *polyAllocated);
  128. /* Bezier */
  129. SDL_GFXPRIMITIVES_SCOPE int bezierColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color);
  130. SDL_GFXPRIMITIVES_SCOPE int bezierRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
  131. int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  132. /* Characters/Strings */
  133. SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch);
  134. SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation(Uint32 rotation);
  135. SDL_GFXPRIMITIVES_SCOPE int characterColor(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint32 color);
  136. SDL_GFXPRIMITIVES_SCOPE int characterRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  137. SDL_GFXPRIMITIVES_SCOPE int stringColor(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint32 color);
  138. SDL_GFXPRIMITIVES_SCOPE int stringRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  139. /* Ends C function definitions when using C++ */
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143. #endif /* _SDL_gfxPrimitives_h */