SDL_gfx  2.0.25
Data Structures | Defines | Functions
I:/Sources/sdlgfx/SDL_gfxPrimitives.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_rotozoom.h"
#include "SDL_gfxPrimitives_font.h"
#include "SDL_gfxBlitFunc.h"

Go to the source code of this file.

Data Structures

struct  SDL_gfxBresenhamIterator
 The structure passed to the internal Bresenham iterator. More...
struct  SDL_gfxMurphyIterator
 The structure passed to the internal Murphy iterator. More...

Defines

#define DEFAULT_ALPHA_PIXEL_ROUTINE
#define ALPHA_PIXEL_ADDITIVE_BLEND
#define clip_xmin(surface)   surface->clip_rect.x
#define clip_xmax(surface)   surface->clip_rect.x+surface->clip_rect.w-1
#define clip_ymin(surface)   surface->clip_rect.y
#define clip_ymax(surface)   surface->clip_rect.y+surface->clip_rect.h-1
#define CLIP_LEFT_EDGE   0x1
#define CLIP_RIGHT_EDGE   0x2
#define CLIP_BOTTOM_EDGE   0x4
#define CLIP_TOP_EDGE   0x8
#define CLIP_INSIDE(a)   (!a)
#define CLIP_REJECT(a, b)   (a&b)
#define CLIP_ACCEPT(a, b)   (!(a|b))
#define ABS(a)   (((a)<0) ? -(a) : (a))
#define AAlevels   256
#define AAbits   8
#define HYPOT(x, y)   sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))

Functions

int fastPixelColorNolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Internal pixel drawing - fast, no blending, no locking, clipping.
int fastPixelColorNolockNoclip (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Internal pixel drawing - fast, no blending, no locking, no clipping.
int fastPixelColor (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Internal pixel drawing - fast, no blending, locking, clipping.
int fastPixelRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Internal pixel drawing - fast, no blending, locking, RGB input.
int fastPixelRGBANolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Internal pixel drawing - fast, no blending, no locking RGB input.
int _putPixelAlpha (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)
 Internal pixel drawing function with alpha blending where input color in in destination format.
int pixelColor (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Pixel draw with blending enabled if a<255.
int pixelColorNolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Pixel draw with blending enabled if a<255 - no surface locking.
int _filledRectAlpha (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha)
 Internal function to draw filled rectangle with alpha blending.
int filledRectAlpha (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw filled rectangle of RGBA color with alpha blending.
int _HLineAlpha (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Internal function to draw horizontal line of RGBA color with alpha blending.
int _VLineAlpha (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Internal function to draw vertical line of RGBA color with alpha blending.
int pixelColorWeight (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
 Pixel draw with blending enabled and using alpha weight on color.
int pixelColorWeightNolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
 Pixel draw with blending enabled and using alpha weight on color - no locking.
int pixelRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Pixel draw with blending enabled if a<255.
int hlineColorStore (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line without blending;.
int hlineRGBAStore (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line without blending.
int hlineColor (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line with blending.
int hlineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line with blending.
int vlineColor (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Draw vertical line with blending.
int vlineRGBA (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw vertical line with blending.
int rectangleColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw rectangle with blending.
int rectangleRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rectangle with blending.
int roundedRectangleColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner rectangle with blending.
int roundedRectangleRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner rectangle with blending.
int roundedBoxColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner box (filled rectangle) with blending.
int roundedBoxRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner box (filled rectangle) with blending.
int boxColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw box (filled rectangle) with blending.
int boxRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw box (filled rectangle) with blending.
int lineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw line with alpha blending.
int lineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw line with alpha blending.
int _aalineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, int draw_endpoint)
 Internal function to draw anti-aliased line with alpha blending and endpoint control.
int aalineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Ddraw anti-aliased line with alpha blending.
int aalineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased line with alpha blending.
int circleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw circle with blending.
int circleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw circle with blending.
int arcColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Arc with blending.
int arcRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Arc with blending.
int aacircleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw anti-aliased circle with blending.
int aacircleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased circle with blending.
int filledCircleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw filled circle with blending.
int filledCircleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled circle with blending.
int ellipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw ellipse with blending.
int ellipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw ellipse with blending.
int aaellipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw anti-aliased ellipse with blending.
int aaellipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased ellipse with blending.
int filledEllipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw filled ellipse with blending.
int filledEllipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled ellipse with blending.
int _pieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 filled)
 Internal float (low-speed) pie-calc implementation by drawing polygons.
int pieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw pie (outline) with alpha blending.
int pieRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pie (outline) with alpha blending.
int filledPieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw filled pie with alpha blending.
int filledPieRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled pie with alpha blending.
int trigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw trigon (triangle outline) with alpha blending.
int trigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw trigon (triangle outline) with alpha blending.
int aatrigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
int aatrigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
int filledTrigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw filled trigon (triangle) with alpha blending.
int filledTrigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled trigon (triangle) with alpha blending.
int polygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw polygon with alpha blending.
int polygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw polygon with alpha blending.
int aapolygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw anti-aliased polygon with alpha blending.
int aapolygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased polygon with alpha blending.
int _gfxPrimitivesCompareInt (const void *a, const void *b)
 Internal helper qsort callback functions used in filled polygon drawing.
int filledPolygonColorMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
int filledPolygonRGBAMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
int filledPolygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw filled polygon with alpha blending.
int filledPolygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled polygon with alpha blending.
int _HLineTextured (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface *texture, int texture_dx, int texture_dy)
 Internal function to draw a textured horizontal line.
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)
 Draws a polygon filled with the given texture (Multi-Threading Capable).
int texturedPolygon (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
 Draws a polygon filled with the given texture.
void gfxPrimitivesSetFont (const void *fontdata, Uint32 cw, Uint32 ch)
 Sets or resets the current global font data.
void gfxPrimitivesSetFontRotation (Uint32 rotation)
 Sets current global font character rotation steps.
int characterColor (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint32 color)
 Draw a character of the currently set font.
int characterRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a character of the currently set font.
int stringColor (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint32 color)
 Draw a string in the currently set font.
int stringRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a string in the currently set font.
double _evaluateBezier (double *data, int ndata, double t)
 Internal function to calculate bezier interpolator of data array with ndata values at position 't'.
int bezierColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
 Draw a bezier curve with alpha blending.
int bezierRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a bezier curve with alpha blending.
int _bresenhamInitialize (SDL_gfxBresenhamIterator *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
 Internal function to initialize the Bresenham line iterator.
int _bresenhamIterate (SDL_gfxBresenhamIterator *b)
 Internal function to move Bresenham line iterator to the next position.
void _murphyParaline (SDL_gfxMurphyIterator *m, Sint16 x, Sint16 y, int d1)
 Internal function to to draw parallel lines with Murphy algorithm.
void _murphyIteration (SDL_gfxMurphyIterator *m, Uint8 miter, Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)
 Internal function to to draw one iteration of the Murphy algorithm.
void _murphyWideline (SDL_gfxMurphyIterator *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)
 Internal function to to draw wide lines with Murphy algorithm.
int thickLineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
 Draw a thick line with alpha blending.
int thickLineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a thick line with alpha blending.

Define Documentation

#define AAbits   8

Definition at line 2567 of file SDL_gfxPrimitives.c.

#define AAlevels   256

Definition at line 2566 of file SDL_gfxPrimitives.c.

#define ABS (   a)    (((a)<0) ? -(a) : (a))

Definition at line 2333 of file SDL_gfxPrimitives.c.

Definition at line 44 of file SDL_gfxPrimitives.c.

#define CLIP_ACCEPT (   a,
 
)    (!(a|b))

Definition at line 1991 of file SDL_gfxPrimitives.c.

#define CLIP_BOTTOM_EDGE   0x4

Definition at line 1987 of file SDL_gfxPrimitives.c.

#define CLIP_INSIDE (   a)    (!a)

Definition at line 1989 of file SDL_gfxPrimitives.c.

#define CLIP_LEFT_EDGE   0x1

Definition at line 1985 of file SDL_gfxPrimitives.c.

#define CLIP_REJECT (   a,
 
)    (a&b)

Definition at line 1990 of file SDL_gfxPrimitives.c.

#define CLIP_RIGHT_EDGE   0x2

Definition at line 1986 of file SDL_gfxPrimitives.c.

#define CLIP_TOP_EDGE   0x8

Definition at line 1988 of file SDL_gfxPrimitives.c.

#define clip_xmax (   surface)    surface->clip_rect.x+surface->clip_rect.w-1

Definition at line 73 of file SDL_gfxPrimitives.c.

#define clip_xmin (   surface)    surface->clip_rect.x

Definition at line 72 of file SDL_gfxPrimitives.c.

#define clip_ymax (   surface)    surface->clip_rect.y+surface->clip_rect.h-1

Definition at line 75 of file SDL_gfxPrimitives.c.

#define clip_ymin (   surface)    surface->clip_rect.y

Definition at line 74 of file SDL_gfxPrimitives.c.

Definition at line 42 of file SDL_gfxPrimitives.c.

#define HYPOT (   x,
 
)    sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))

Definition at line 6606 of file SDL_gfxPrimitives.c.


Function Documentation

int _aalineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color,
int  draw_endpoint 
)

Internal function to draw anti-aliased line with alpha blending and endpoint control.

This implementation of the Wu antialiasing code is based on Mike Abrash's DDJ article which was reprinted as Chapter 42 of his Graphics Programming Black Book, but has been optimized to work with SDL and utilizes 32-bit fixed-point arithmetic by A. Schiffler. The endpoint control allows the supression to draw the last pixel useful for rendering continous aa-lines with alpha<255.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
draw_endpointFlag indicating if the endpoint should be drawn; draw if non-zero.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2589 of file SDL_gfxPrimitives.c.

int _bresenhamInitialize ( SDL_gfxBresenhamIterator b,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2 
)

Internal function to initialize the Bresenham line iterator.

Example of use: SDL_gfxBresenhamIterator b; _bresenhamInitialize (&b, x1, y1, x2, y2); do { plot(b.x, b.y); } while (_bresenhamIterate(&b)==0);

Parameters:
bPointer to struct for bresenham line drawing state.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6323 of file SDL_gfxPrimitives.c.

Internal function to move Bresenham line iterator to the next position.

Maybe updates the x and y coordinates of the iterator struct.

Parameters:
bPointer to struct for bresenham line drawing state.
Returns:
Returns 0 on success, 1 if last point was reached, 2 if moving past end-of-line, -1 on failure.

Definition at line 6385 of file SDL_gfxPrimitives.c.

double _evaluateBezier ( double *  data,
int  ndata,
double  t 
)

Internal function to calculate bezier interpolator of data array with ndata values at position 't'.

Parameters:
dataArray of values.
ndataSize of array.
tPosition for which to calculate interpolated value. t should be between [0, ndata].
Returns:
Interpolated value at position t, value[0] when t<0, value[n-1] when t>n.

Definition at line 6162 of file SDL_gfxPrimitives.c.

int _filledRectAlpha ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color,
Uint8  alpha 
)

Internal function to draw filled rectangle with alpha blending.

Assumes color is in destination format.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first corner (upper left) of the rectangle.
y1Y coordinate of the first corner (upper left) of the rectangle.
x2X coordinate of the second corner (lower right) of the rectangle.
y2Y coordinate of the second corner (lower right) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
alphaAlpha blending amount for pixels.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 595 of file SDL_gfxPrimitives.c.

int _gfxPrimitivesCompareInt ( const void *  a,
const void *  b 
)

Internal helper qsort callback functions used in filled polygon drawing.

Parameters:
aThe surface to draw on.
bVertex array containing X coordinates of the points of the polygon.
Returns:
Returns 0 if a==b, a negative number if a<b or a positive number if a>b.

Definition at line 5163 of file SDL_gfxPrimitives.c.

int _HLineAlpha ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Internal function to draw horizontal line of RGBA color with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 905 of file SDL_gfxPrimitives.c.

int _HLineTextured ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Internal function to draw a textured horizontal line.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
textureThe texture surface to retrieve color information from.
texture_dxThe X offset for the texture lookup.
texture_dyThe Y offset for the textured lookup.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5437 of file SDL_gfxPrimitives.c.

void _murphyIteration ( SDL_gfxMurphyIterator m,
Uint8  miter,
Uint16  ml1bx,
Uint16  ml1by,
Uint16  ml2bx,
Uint16  ml2by,
Uint16  ml1x,
Uint16  ml1y,
Uint16  ml2x,
Uint16  ml2y 
)

Internal function to to draw one iteration of the Murphy algorithm.

Parameters:
mPointer to struct for murphy iterator.
miterIteration count.
ml1bxX coordinate of a point.
ml1byY coordinate of a point.
ml2bxX coordinate of a point.
ml2byY coordinate of a point.
ml1xX coordinate of a point.
ml1yY coordinate of a point.
ml2xX coordinate of a point.
ml2yY coordinate of a point.

Definition at line 6490 of file SDL_gfxPrimitives.c.

void _murphyParaline ( SDL_gfxMurphyIterator m,
Sint16  x,
Sint16  y,
int  d1 
)

Internal function to to draw parallel lines with Murphy algorithm.

Parameters:
mPointer to struct for murphy iterator.
xX coordinate of point.
yY coordinate of point.
d1Direction square/diagonal.

Definition at line 6428 of file SDL_gfxPrimitives.c.

void _murphyWideline ( SDL_gfxMurphyIterator m,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  miter 
)

Internal function to to draw wide lines with Murphy algorithm.

Draws lines parallel to ideal line.

Parameters:
mPointer to struct for murphy iterator.
x1X coordinate of first point.
y1Y coordinate of first point.
x2X coordinate of second point.
y2Y coordinate of second point.
widthWidth of line.
miterIteration count.

Definition at line 6622 of file SDL_gfxPrimitives.c.

int _pieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color,
Uint8  filled 
)

Internal float (low-speed) pie-calc implementation by drawing polygons.

Note: Determines vertex array and uses polygon or filledPolygon drawing routines to render.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
filledFlag indicating if the pie should be filled (=1) or not (=0).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4553 of file SDL_gfxPrimitives.c.

int _putPixelAlpha ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color,
Uint8  alpha 
)

Internal pixel drawing function with alpha blending where input color in in destination format.

Contains two alternative 32 bit alpha blending routines which can be enabled at the source level with the defines DEFAULT_ALPHA_PIXEL_ROUTINE or EXPERIMENTAL_ALPHA_PIXEL_ROUTINE. Only the bits up to the surface depth are significant in the color value.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
alphaThe blend factor to apply while drawing.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 286 of file SDL_gfxPrimitives.c.

int _VLineAlpha ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Internal function to draw vertical line of RGBA color with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (top) of the line.
y2Y coordinate of the second point (bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 921 of file SDL_gfxPrimitives.c.

int aacircleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw anti-aliased circle with blending.

Note: The AA-circle routine is based on AA-ellipse with identical radii.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
colorThe color value of the aa-circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3512 of file SDL_gfxPrimitives.c.

int aacircleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
rThe red value of the aa-circle to draw.
gThe green value of the aa-circle to draw.
bThe blue value of the aa-circle to draw.
aThe alpha value of the aa-circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3531 of file SDL_gfxPrimitives.c.

int aaellipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw anti-aliased ellipse with blending.

Note: Based on code from Anders Lindstroem, which is based on code from sge library, which is based on code from TwinLib.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
colorThe color value of the aa-ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4088 of file SDL_gfxPrimitives.c.

int aaellipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
rThe red value of the aa-ellipse to draw.
gThe green value of the aa-ellipse to draw.
bThe blue value of the aa-ellipse to draw.
aThe alpha value of the aa-ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4328 of file SDL_gfxPrimitives.c.

int aalineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Ddraw anti-aliased line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2828 of file SDL_gfxPrimitives.c.

int aalineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
rThe red value of the aa-line to draw.
gThe green value of the aa-line to draw.
bThe blue value of the aa-line to draw.
aThe alpha value of the aa-line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2848 of file SDL_gfxPrimitives.c.

int aapolygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the aa-polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5077 of file SDL_gfxPrimitives.c.

int aapolygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the aa-polygon to draw.
gThe green value of the aa-polygon to draw.
bThe blue value of the aa-polygon to draw.
aThe alpha value of the aa-polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5145 of file SDL_gfxPrimitives.c.

int aatrigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
colorThe color value of the aa-trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4859 of file SDL_gfxPrimitives.c.

int aatrigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
rThe red value of the aa-trigon to draw.
gThe green value of the aa-trigon to draw.
bThe blue value of the aa-trigon to draw.
aThe alpha value of the aa-trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4891 of file SDL_gfxPrimitives.c.

int arcColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Arc with blending.

Note Arc drawing is based on circle algorithm by A. Schiffler and written by D. Raber. Calculates which octants arc goes through and renders pixels accordingly.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
colorThe color value of the arc to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3117 of file SDL_gfxPrimitives.c.

int arcRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Arc with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
rThe red value of the arc to draw.
gThe green value of the arc to draw.
bThe blue value of the arc to draw.
aThe alpha value of the arc to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3488 of file SDL_gfxPrimitives.c.

int bezierColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint32  color 
)

Draw a bezier curve with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
colorThe color value of the bezier curve to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6221 of file SDL_gfxPrimitives.c.

int bezierRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a bezier curve with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
rThe red value of the bezier curve to draw.
gThe green value of the bezier curve to draw.
bThe blue value of the bezier curve to draw.
aThe alpha value of the bezier curve to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6296 of file SDL_gfxPrimitives.c.

int boxColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2107 of file SDL_gfxPrimitives.c.

int boxRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2319 of file SDL_gfxPrimitives.c.

int characterColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
char  c,
Uint32  color 
)

Draw a character of the currently set font.

On first call for a particular character and color combination, the function needs to generate the character surface (slower. Subsequent calls blit a cached surface (fast). Uses alpha blending if A<255 in color.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
colorThe color value of the character to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5908 of file SDL_gfxPrimitives.c.

int characterRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
char  c,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a character of the currently set font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6077 of file SDL_gfxPrimitives.c.

int circleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw circle with blending.

Note: Circle drawing routine is based on an algorithms from the sge library, but modified by A. Schiffler for multiple pixel-draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
colorThe color value of the circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2872 of file SDL_gfxPrimitives.c.

int circleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
rThe red value of the circle to draw.
gThe green value of the circle to draw.
bThe blue value of the circle to draw.
aThe alpha value of the circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3090 of file SDL_gfxPrimitives.c.

int ellipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw ellipse with blending.

Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-pixel draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
colorThe color value of the ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3709 of file SDL_gfxPrimitives.c.

int ellipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
rThe red value of the ellipse to draw.
gThe green value of the ellipse to draw.
bThe blue value of the ellipse to draw.
aThe alpha value of the ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4023 of file SDL_gfxPrimitives.c.

int fastPixelColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Internal pixel drawing - fast, no blending, locking, clipping.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 190 of file SDL_gfxPrimitives.c.

int fastPixelColorNolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Internal pixel drawing - fast, no blending, no locking, clipping.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 87 of file SDL_gfxPrimitives.c.

int fastPixelColorNolockNoclip ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Internal pixel drawing - fast, no blending, no locking, no clipping.

Function is faster but dangerous since no clipping check is done. Code needs to make sure we stay in surface bounds before calling.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 144 of file SDL_gfxPrimitives.c.

int fastPixelRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Internal pixel drawing - fast, no blending, locking, RGB input.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
rThe red value of the pixel to draw.
gThe green value of the pixel to draw.
bThe blue value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 228 of file SDL_gfxPrimitives.c.

int fastPixelRGBANolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Internal pixel drawing - fast, no blending, no locking RGB input.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
rThe red value of the pixel to draw.
gThe green value of the pixel to draw.
bThe blue value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 256 of file SDL_gfxPrimitives.c.

int filledCircleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw filled circle with blending.

Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-hline draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
colorThe color value of the filled circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3556 of file SDL_gfxPrimitives.c.

int filledCircleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
rThe red value of the filled circle to draw.
gThe green value of the filled circle to draw.
bThe blue value of the filled circle to draw.
aThe alpha value of the filled circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3683 of file SDL_gfxPrimitives.c.

int filledEllipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw filled ellipse with blending.

Note: Based on algorithm from sge library with multiple-hline draw removal and other speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
colorThe color value of the filled ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4358 of file SDL_gfxPrimitives.c.

int filledEllipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
rThe red value of the filled ellipse to draw.
gThe green value of the filled ellipse to draw.
bThe blue value of the filled ellipse to draw.
aThe alpha value of the filled ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4526 of file SDL_gfxPrimitives.c.

int filledPieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw filled pie with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
colorThe color value of the filled pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4747 of file SDL_gfxPrimitives.c.

int filledPieRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled pie with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
rThe red value of the filled pie to draw.
gThe green value of the filled pie to draw.
bThe blue value of the filled pie to draw.
aThe alpha value of the filled pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4768 of file SDL_gfxPrimitives.c.

int filledPolygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw filled polygon with alpha blending.

Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5394 of file SDL_gfxPrimitives.c.

int filledPolygonColorMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5197 of file SDL_gfxPrimitives.c.

int filledPolygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5416 of file SDL_gfxPrimitives.c.

int filledPolygonRGBAMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5372 of file SDL_gfxPrimitives.c.

int filledRectAlpha ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw filled rectangle of RGBA color with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first corner (upper left) of the rectangle.
y1Y coordinate of the first corner (upper left) of the rectangle.
x2X coordinate of the second corner (lower right) of the rectangle.
y2Y coordinate of the second corner (lower right) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 856 of file SDL_gfxPrimitives.c.

int filledTrigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
colorThe color value of the filled trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4925 of file SDL_gfxPrimitives.c.

int filledTrigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
rThe red value of the filled trigon to draw.
gThe green value of the filled trigon to draw.
bThe blue value of the filled trigon to draw.
aThe alpha value of the filled trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4959 of file SDL_gfxPrimitives.c.

void gfxPrimitivesSetFont ( const void *  fontdata,
Uint32  cw,
Uint32  ch 
)

Sets or resets the current global font data.

The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]

Parameters:
fontdataPointer to array of font data. Set to NULL, to reset global font to the default 8x8 font.
cwWidth of character in bytes. Ignored if fontdata==NULL.
chHeight of character in bytes. Ignored if fontdata==NULL.

Definition at line 5815 of file SDL_gfxPrimitives.c.

void gfxPrimitivesSetFontRotation ( Uint32  rotation)

Sets current global font character rotation steps.

Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.

Parameters:
rotationNumber of 90deg clockwise steps to rotate

Definition at line 5861 of file SDL_gfxPrimitives.c.

int hlineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1204 of file SDL_gfxPrimitives.c.

int hlineColorStore ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line without blending;.

Just stores the color value (including the alpha component) without blending. Only the same number of bits of the destination surface are transfered from the input color value.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1041 of file SDL_gfxPrimitives.c.

int hlineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1373 of file SDL_gfxPrimitives.c.

int hlineRGBAStore ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line without blending.

Just stores the color value (including the alpha component) without blending. Function should only be used for 32 bit target surfaces.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1185 of file SDL_gfxPrimitives.c.

int lineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2347 of file SDL_gfxPrimitives.c.

int lineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2556 of file SDL_gfxPrimitives.c.

int pieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw pie (outline) with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4703 of file SDL_gfxPrimitives.c.

int pieRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pie (outline) with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
rThe red value of the pie to draw.
gThe green value of the pie to draw.
bThe blue value of the pie to draw.
aThe alpha value of the pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4726 of file SDL_gfxPrimitives.c.

int pixelColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Pixel draw with blending enabled if a<255.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 509 of file SDL_gfxPrimitives.c.

int pixelColorNolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Pixel draw with blending enabled if a<255 - no surface locking.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 557 of file SDL_gfxPrimitives.c.

int pixelColorWeight ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color,
Uint32  weight 
)

Pixel draw with blending enabled and using alpha weight on color.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
weightThe weight multiplied into the alpha value of the pixel.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 937 of file SDL_gfxPrimitives.c.

int pixelColorWeightNolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color,
Uint32  weight 
)

Pixel draw with blending enabled and using alpha weight on color - no locking.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
weightThe weight multiplied into the alpha value of the pixel.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 965 of file SDL_gfxPrimitives.c.

int pixelRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Pixel draw with blending enabled if a<255.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
rThe red color value of the pixel to draw.
gThe green color value of the pixel to draw.
bThe blue color value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 995 of file SDL_gfxPrimitives.c.

int polygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4988 of file SDL_gfxPrimitives.c.

int polygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the polygon to draw.
gThe green value of the polygon to draw.
bThe blue value of the polygon to draw.
aThe alpha value of the polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5056 of file SDL_gfxPrimitives.c.

int rectangleColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1580 of file SDL_gfxPrimitives.c.

int rectangleRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1663 of file SDL_gfxPrimitives.c.

int roundedBoxColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1837 of file SDL_gfxPrimitives.c.

int roundedBoxRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1970 of file SDL_gfxPrimitives.c.

int roundedRectangleColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1685 of file SDL_gfxPrimitives.c.

int roundedRectangleRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1815 of file SDL_gfxPrimitives.c.

int stringColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
const char *  s,
Uint32  color 
)

Draw a string in the currently set font.

The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
colorThe color value of the string to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6099 of file SDL_gfxPrimitives.c.

int stringRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
const char *  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a string in the currently set font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
rThe red value of the string to draw.
gThe green value of the string to draw.
bThe blue value of the string to draw.
aThe alpha value of the string to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6143 of file SDL_gfxPrimitives.c.

int texturedPolygon ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Draws a polygon filled with the given texture.

This standard version is calling multithreaded versions with NULL cache parameters.

Parameters:
dstthe destination surface,
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5741 of file SDL_gfxPrimitives.c.

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 
)

Draws a polygon filled with the given texture (Multi-Threading Capable).

This operation use internally SDL_BlitSurface for lines of the source texture. It supports alpha drawing.

To get the best performance of this operation you need to make sure the texture and the dst surface have the same format (see http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html). The last two parameters are optional, but required for multithreaded operation. When set to NULL, uses global static temp array.

Parameters:
dstthe destination surface,
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
polyIntspreallocated temp array storage for vertex sorting (used for multi-threaded operation)
polyAllocatedflag indicating oif the temp array was allocated (used for multi-threaded operation)
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5574 of file SDL_gfxPrimitives.c.

int thickLineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint32  color 
)

Draw a thick line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6808 of file SDL_gfxPrimitives.c.

int thickLineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a thick line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6847 of file SDL_gfxPrimitives.c.

int trigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses polygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
colorThe color value of the trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4793 of file SDL_gfxPrimitives.c.

int trigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw trigon (triangle outline) with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
rThe red value of the trigon to draw.
gThe green value of the trigon to draw.
bThe blue value of the trigon to draw.
aThe alpha value of the trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4825 of file SDL_gfxPrimitives.c.

int vlineColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Draw vertical line with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1392 of file SDL_gfxPrimitives.c.

int vlineRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw vertical line with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1560 of file SDL_gfxPrimitives.c.