- Main Page
- Data Structures
- Files

- File List
- Globals

# SDL_gfxPrimitives.h

Go to the documentation of this file.

    00001 /*
    00002
    00003 SDL_gfxPrimitives: graphics primitives for SDL
    00004
    00005 LGPL (c) A. Schiffler
    00006
    00007 */
    00008
    00009 #ifndef _SDL_gfxPrimitives_h
    00010 #define _SDL_gfxPrimitives_h
    00011
    00012 #include <math.h>
    00013 #ifndef M_PI
    00014 #define M_PI    3.1415926535897932384626433832795
    00015 #endif
    00016
    00017 #include "SDL.h"
    00018
    00019 /* Set up for C function definitions, even when using C++ */
    00020 #ifdef __cplusplus
    00021 extern "C" {
    00022 #endif
    00023
    00024         /* ----- Versioning */
    00025
    00026 #define SDL_GFXPRIMITIVES_MAJOR 2
    00027 #define SDL_GFXPRIMITIVES_MINOR 0
    00028 #define SDL_GFXPRIMITIVES_MICRO 23
    00029
    00030
    00031         /* ---- Function Prototypes */
    00032
    00033 #ifdef _MSC_VER
    00034 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
    00035 #    define SDL_GFXPRIMITIVES_SCOPE __declspec(dllexport)
    00036 #  else
    00037 #    ifdef LIBSDL_GFX_DLL_IMPORT
    00038 #      define SDL_GFXPRIMITIVES_SCOPE __declspec(dllimport)
    00039 #    endif
    00040 #  endif
    00041 #endif
    00042 #ifndef SDL_GFXPRIMITIVES_SCOPE
    00043 #  define SDL_GFXPRIMITIVES_SCOPE extern
    00044 #endif
    00045
    00046         /* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */
    00047
    00048         /* Pixel */
    00049
    00050         SDL_GFXPRIMITIVES_SCOPE int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color);
    00051         SDL_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00052
    00053         /* Horizontal line */
    00054
    00055         SDL_GFXPRIMITIVES_SCOPE int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color);
    00056         SDL_GFXPRIMITIVES_SCOPE int hlineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00057
    00058         /* Vertical line */
    00059
    00060         SDL_GFXPRIMITIVES_SCOPE int vlineColor(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color);
    00061         SDL_GFXPRIMITIVES_SCOPE int vlineRGBA(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00062
    00063         /* Rectangle */
    00064
    00065         SDL_GFXPRIMITIVES_SCOPE int rectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00066         SDL_GFXPRIMITIVES_SCOPE int rectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
    00067                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00068
    00069         /* Rounded-Corner Rectangle */
    00070
    00071         SDL_GFXPRIMITIVES_SCOPE int roundedRectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
    00072         SDL_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
    00073                 Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00074
    00075         /* Filled rectangle (Box) */
    00076
    00077         SDL_GFXPRIMITIVES_SCOPE int boxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00078         SDL_GFXPRIMITIVES_SCOPE int boxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
    00079                 Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00080
    00081         /* Rounded-Corner Filled rectangle (Box) */
    00082
    00083         SDL_GFXPRIMITIVES_SCOPE int roundedBoxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
    00084         SDL_GFXPRIMITIVES_SCOPE int roundedBoxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
    00085                 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00086
    00087         /* Line */
    00088
    00089         SDL_GFXPRIMITIVES_SCOPE int lineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00090         SDL_GFXPRIMITIVES_SCOPE int lineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
    00091                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00092
    00093         /* AA Line */
    00094
    00095         SDL_GFXPRIMITIVES_SCOPE int aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00096         SDL_GFXPRIMITIVES_SCOPE int aalineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
    00097                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00098
    00099         /* Thick Line */
    00100         SDL_GFXPRIMITIVES_SCOPE int thickLineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
    00101                 Uint8 width, Uint32 color);
    00102         SDL_GFXPRIMITIVES_SCOPE int thickLineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
    00103                 Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00104
    00105         /* Circle */
    00106
    00107         SDL_GFXPRIMITIVES_SCOPE int circleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
    00108         SDL_GFXPRIMITIVES_SCOPE int circleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00109
    00110         /* Arc */
    00111
    00112         SDL_GFXPRIMITIVES_SCOPE int arcColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color);
    00113         SDL_GFXPRIMITIVES_SCOPE int arcRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end,
    00114                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00115
    00116         /* AA Circle */
    00117
    00118         SDL_GFXPRIMITIVES_SCOPE int aacircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
    00119         SDL_GFXPRIMITIVES_SCOPE int aacircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
    00120                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00121
    00122         /* Filled Circle */
    00123
    00124         SDL_GFXPRIMITIVES_SCOPE int filledCircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color);
    00125         SDL_GFXPRIMITIVES_SCOPE int filledCircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
    00126                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00127
    00128         /* Ellipse */
    00129
    00130         SDL_GFXPRIMITIVES_SCOPE int ellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
    00131         SDL_GFXPRIMITIVES_SCOPE int ellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
    00132                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00133
    00134         /* AA Ellipse */
    00135
    00136         SDL_GFXPRIMITIVES_SCOPE int aaellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
    00137         SDL_GFXPRIMITIVES_SCOPE int aaellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
    00138                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00139
    00140         /* Filled Ellipse */
    00141
    00142         SDL_GFXPRIMITIVES_SCOPE int filledEllipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
    00143         SDL_GFXPRIMITIVES_SCOPE int filledEllipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
    00144                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00145
    00146         /* Pie */
    00147
    00148         SDL_GFXPRIMITIVES_SCOPE int pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
    00149                 Sint16 start, Sint16 end, Uint32 color);
    00150         SDL_GFXPRIMITIVES_SCOPE int pieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
    00151                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00152
    00153         /* Filled Pie */
    00154
    00155         SDL_GFXPRIMITIVES_SCOPE int filledPieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
    00156                 Sint16 start, Sint16 end, Uint32 color);
    00157         SDL_GFXPRIMITIVES_SCOPE int filledPieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
    00158                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00159
    00160         /* Trigon */
    00161
    00162         SDL_GFXPRIMITIVES_SCOPE int trigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
    00163         SDL_GFXPRIMITIVES_SCOPE int trigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
    00164                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00165
    00166         /* AA-Trigon */
    00167
    00168         SDL_GFXPRIMITIVES_SCOPE int aatrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
    00169         SDL_GFXPRIMITIVES_SCOPE int aatrigonRGBA(SDL_Surface * dst,  Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
    00170                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00171
    00172         /* Filled Trigon */
    00173
    00174         SDL_GFXPRIMITIVES_SCOPE int filledTrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
    00175         SDL_GFXPRIMITIVES_SCOPE int filledTrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
    00176                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00177
    00178         /* Polygon */
    00179
    00180         SDL_GFXPRIMITIVES_SCOPE int polygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
    00181         SDL_GFXPRIMITIVES_SCOPE int polygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
    00182                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00183
    00184         /* AA-Polygon */
    00185
    00186         SDL_GFXPRIMITIVES_SCOPE int aapolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
    00187         SDL_GFXPRIMITIVES_SCOPE int aapolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
    00188                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00189
    00190         /* Filled Polygon */
    00191
    00192         SDL_GFXPRIMITIVES_SCOPE int filledPolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
    00193         SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBA(SDL_Surface * dst, const Sint16 * vx,
    00194                 const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00195         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);
    00196
    00197         /* (Note: These MT versions are required for multi-threaded operation.) */
    00198
    00199         SDL_GFXPRIMITIVES_SCOPE int filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated);
    00200         SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBAMT(SDL_Surface * dst, const Sint16 * vx,
    00201                 const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
    00202                 int **polyInts, int *polyAllocated);
    00203         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);
    00204
    00205         /* Bezier */
    00206
    00207         SDL_GFXPRIMITIVES_SCOPE int bezierColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color);
    00208         SDL_GFXPRIMITIVES_SCOPE int bezierRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
    00209                 int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00210
    00211         /* Characters/Strings */
    00212
    00213         SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch);
    00214         SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation(Uint32 rotation);
    00215         SDL_GFXPRIMITIVES_SCOPE int characterColor(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint32 color);
    00216         SDL_GFXPRIMITIVES_SCOPE int characterRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00217         SDL_GFXPRIMITIVES_SCOPE int stringColor(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint32 color);
    00218         SDL_GFXPRIMITIVES_SCOPE int stringRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00219
    00220         /* Ends C function definitions when using C++ */
    00221 #ifdef __cplusplus
    00222 }
    00223 #endif
    00224
    00225 #endif                          /* _SDL_gfxPrimitives_h */