PageRenderTime 64ms CodeModel.GetById 11ms app.highlight 49ms RepoModel.GetById 2ms app.codeStats 0ms

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