SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.h Source File

SDL_gfx 2.0.25

- Main Page
- Data Structures
- Files

- File List
- Globals

I:/Sources/sdlgfx/SDL_gfxPrimitives.h
Go to the documentation of this file.

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