SDL2_gfx: I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h Source File

SDL2_gfx 1.0.0 GraphicsprimitivesandsurfacefunctionsforSDL2

- Main Page
- Data Structures
- Files

- File List
- Globals

I:/Sources/sdl2gfx/SDL2_gfxPrimitives.h
Go to the documentation of this file.

    00001 /*
    00002
    00003 SDL2_gfxPrimitives.h: graphics primitives for SDL
    00004
    00005 Copyright (C) 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 _SDL2_gfxPrimitives_h
    00031 #define _SDL2_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 SDL2_GFXPRIMITIVES_MAJOR        1
    00048 #define SDL2_GFXPRIMITIVES_MINOR        0
    00049 #define SDL2_GFXPRIMITIVES_MICRO        0
    00050
    00051
    00052         /* ---- Function Prototypes */
    00053
    00054 #ifdef _MSC_VER
    00055 #  if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)
    00056 #    define SDL2_GFXPRIMITIVES_SCOPE __declspec(dllexport)
    00057 #  else
    00058 #    ifdef LIBSDL2_GFX_DLL_IMPORT
    00059 #      define SDL2_GFXPRIMITIVES_SCOPE __declspec(dllimport)
    00060 #    endif
    00061 #  endif
    00062 #endif
    00063 #ifndef SDL2_GFXPRIMITIVES_SCOPE
    00064 #  define SDL2_GFXPRIMITIVES_SCOPE extern
    00065 #endif
    00066
    00067         /* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */
    00068
    00069         /* Pixel */
    00070
    00071         SDL2_GFXPRIMITIVES_SCOPE int pixelColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint32 color);
    00072         SDL2_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00073
    00074         /* Horizontal line */
    00075
    00076         SDL2_GFXPRIMITIVES_SCOPE int hlineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color);
    00077         SDL2_GFXPRIMITIVES_SCOPE int hlineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00078
    00079         /* Vertical line */
    00080
    00081         SDL2_GFXPRIMITIVES_SCOPE int vlineColor(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color);
    00082         SDL2_GFXPRIMITIVES_SCOPE int vlineRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00083
    00084         /* Rectangle */
    00085
    00086         SDL2_GFXPRIMITIVES_SCOPE int rectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00087         SDL2_GFXPRIMITIVES_SCOPE int rectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
    00088                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00089
    00090         /* Rounded-Corner Rectangle */
    00091
    00092         SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
    00093         SDL2_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA(SDL_Renderer * renderer, 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         SDL2_GFXPRIMITIVES_SCOPE int boxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00099         SDL2_GFXPRIMITIVES_SCOPE int boxRGBA(SDL_Renderer * renderer, 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         SDL2_GFXPRIMITIVES_SCOPE int roundedBoxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
    00105         SDL2_GFXPRIMITIVES_SCOPE int roundedBoxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2,
    00106                 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00107
    00108         /* Line */
    00109
    00110         SDL2_GFXPRIMITIVES_SCOPE int lineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00111         SDL2_GFXPRIMITIVES_SCOPE int lineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
    00112                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00113
    00114         /* AA Line */
    00115
    00116         SDL2_GFXPRIMITIVES_SCOPE int aalineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
    00117         SDL2_GFXPRIMITIVES_SCOPE int aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1,
    00118                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00119
    00120         /* Thick Line */
    00121         SDL2_GFXPRIMITIVES_SCOPE int thickLineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
    00122                 Uint8 width, Uint32 color);
    00123         SDL2_GFXPRIMITIVES_SCOPE int thickLineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
    00124                 Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00125
    00126         /* Circle */
    00127
    00128         SDL2_GFXPRIMITIVES_SCOPE int circleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
    00129         SDL2_GFXPRIMITIVES_SCOPE int circleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00130
    00131         /* Arc */
    00132
    00133         SDL2_GFXPRIMITIVES_SCOPE int arcColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color);
    00134         SDL2_GFXPRIMITIVES_SCOPE int arcRGBA(SDL_Renderer * renderer, 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         SDL2_GFXPRIMITIVES_SCOPE int aacircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
    00140         SDL2_GFXPRIMITIVES_SCOPE int aacircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
    00141                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00142
    00143         /* Filled Circle */
    00144
    00145         SDL2_GFXPRIMITIVES_SCOPE int filledCircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 r, Uint32 color);
    00146         SDL2_GFXPRIMITIVES_SCOPE int filledCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
    00147                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00148
    00149         /* Ellipse */
    00150
    00151         SDL2_GFXPRIMITIVES_SCOPE int ellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
    00152         SDL2_GFXPRIMITIVES_SCOPE int ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
    00153                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00154
    00155         /* AA Ellipse */
    00156
    00157         SDL2_GFXPRIMITIVES_SCOPE int aaellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
    00158         SDL2_GFXPRIMITIVES_SCOPE int aaellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
    00159                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00160
    00161         /* Filled Ellipse */
    00162
    00163         SDL2_GFXPRIMITIVES_SCOPE int filledEllipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
    00164         SDL2_GFXPRIMITIVES_SCOPE int filledEllipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
    00165                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00166
    00167         /* Pie */
    00168
    00169         SDL2_GFXPRIMITIVES_SCOPE int pieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
    00170                 Sint16 start, Sint16 end, Uint32 color);
    00171         SDL2_GFXPRIMITIVES_SCOPE int pieRGBA(SDL_Renderer * renderer, 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         SDL2_GFXPRIMITIVES_SCOPE int filledPieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
    00177                 Sint16 start, Sint16 end, Uint32 color);
    00178         SDL2_GFXPRIMITIVES_SCOPE int filledPieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
    00179                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00180
    00181         /* Trigon */
    00182
    00183         SDL2_GFXPRIMITIVES_SCOPE int trigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
    00184         SDL2_GFXPRIMITIVES_SCOPE int trigonRGBA(SDL_Renderer * renderer, 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         SDL2_GFXPRIMITIVES_SCOPE int aatrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
    00190         SDL2_GFXPRIMITIVES_SCOPE int aatrigonRGBA(SDL_Renderer * renderer,  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         SDL2_GFXPRIMITIVES_SCOPE int filledTrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
    00196         SDL2_GFXPRIMITIVES_SCOPE int filledTrigonRGBA(SDL_Renderer * renderer, 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         SDL2_GFXPRIMITIVES_SCOPE int polygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
    00202         SDL2_GFXPRIMITIVES_SCOPE int polygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy,
    00203                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00204
    00205         /* AA-Polygon */
    00206
    00207         SDL2_GFXPRIMITIVES_SCOPE int aapolygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
    00208         SDL2_GFXPRIMITIVES_SCOPE int aapolygonRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy,
    00209                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00210
    00211         /* Filled Polygon */
    00212
    00213         SDL2_GFXPRIMITIVES_SCOPE int filledPolygonColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
    00214         SDL2_GFXPRIMITIVES_SCOPE int filledPolygonRGBA(SDL_Renderer * renderer, const Sint16 * vx,
    00215                 const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00216
    00217         /* Textured Polygon */
    00218
    00219         SDL2_GFXPRIMITIVES_SCOPE int texturedPolygon(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy);
    00220
    00221         /* Bezier */
    00222
    00223         SDL2_GFXPRIMITIVES_SCOPE int bezierColor(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color);
    00224         SDL2_GFXPRIMITIVES_SCOPE int bezierRGBA(SDL_Renderer * renderer, const Sint16 * vx, const Sint16 * vy,
    00225                 int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00226
    00227         /* Characters/Strings */
    00228
    00229         SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch);
    00230         SDL2_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation(Uint32 rotation);
    00231         SDL2_GFXPRIMITIVES_SCOPE int characterColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, char c, Uint32 color);
    00232         SDL2_GFXPRIMITIVES_SCOPE int characterRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00233         SDL2_GFXPRIMITIVES_SCOPE int stringColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, const char *s, Uint32 color);
    00234         SDL2_GFXPRIMITIVES_SCOPE int stringRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    00235
    00236         /* Ends C function definitions when using C++ */
    00237 #ifdef __cplusplus
    00238 }
    00239 #endif
    00240
    00241 #endif                          /* _SDL2_gfxPrimitives_h */