SDL3_gfx 1.0.0
Graphics primitives and surface functions for SDL3
C:/Users/ADMIN/Documents/GitHub/SDL3_gfx/SDL3_gfxPrimitives.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SDL3_gfxPrimitives.h"
#include "SDL3_rotozoom.h"
#include "SDL3_gfxPrimitives_font.h"

Go to the source code of this file.

Macros

#define AAlevels   256
 
#define AAbits   8
 
#define DEFAULT_ELLIPSE_OVERSCAN   4
 Internal function to draw ellipse or filled ellipse with blending.
 

Functions

bool pixel (SDL_Renderer *renderer, Sint16 x, Sint16 y)
 Draw pixel in currently set color.
 
bool pixelColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint32 color)
 Draw pixel with blending enabled if a<255.
 
bool pixelRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pixel with blending enabled if a<255.
 
bool pixelRGBAWeight (SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint32 weight)
 Draw pixel with blending enabled and using alpha weight on color.
 
bool hline (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y)
 Draw horizontal line in currently set color.
 
bool hlineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line with blending.
 
bool hlineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line with blending.
 
bool vline (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2)
 Draw vertical line in currently set color.
 
bool vlineColor (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Draw vertical line with blending.
 
bool vlineRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw vertical line with blending.
 
bool rectangleColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw rectangle with blending.
 
bool rectangleRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rectangle with blending.
 
bool roundedRectangleColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner rectangle with blending.
 
bool roundedRectangleRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner rectangle with blending.
 
bool roundedBoxColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner box (filled rectangle) with blending.
 
bool roundedBoxRGBA (SDL_Renderer *renderer, 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.
 
bool boxColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw box (filled rectangle) with blending.
 
bool boxRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw box (filled rectangle) with blending.
 
bool line (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
 Draw line with alpha blending using the currently set color.
 
bool lineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw line with alpha blending.
 
bool lineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw line with alpha blending.
 
int _aalineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int draw_endpoint)
 Internal function to draw anti-aliased line with alpha blending and endpoint control.
 
bool aalineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw anti-aliased line with alpha blending.
 
bool aalineRGBA (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased line with alpha blending.
 
bool circleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw circle with blending.
 
bool circleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw circle with blending.
 
bool arcColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Arc with blending.
 
bool arcRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Arc with blending.
 
bool aacircleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw anti-aliased circle with blending.
 
bool aacircleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased circle with blending.
 
int _drawQuadrants (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 dx, Sint16 dy, Sint32 f)
 Internal function to draw pixels or lines in 4 quadrants.
 
bool _ellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Sint32 f)
 
bool ellipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw ellipse with blending.
 
bool ellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw ellipse with blending.
 
bool filledCircleColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw filled circle with blending.
 
bool filledCircleRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled circle with blending.
 
bool aaellipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw anti-aliased ellipse with blending.
 
bool aaellipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased ellipse with blending.
 
bool filledEllipseColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw filled ellipse with blending.
 
bool filledEllipseRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled ellipse with blending.
 
bool _pieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 filled)
 Internal float (low-speed) pie-calc implementation by drawing polygons.
 
bool pieColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw pie (outline) with alpha blending.
 
bool pieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pie (outline) with alpha blending.
 
bool filledPieColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw filled pie with alpha blending.
 
bool filledPieRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled pie with alpha blending.
 
bool trigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw trigon (triangle outline) with alpha blending.
 
bool trigonRGBA (SDL_Renderer *renderer, 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.
 
bool aatrigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
 
bool aatrigonRGBA (SDL_Renderer *renderer, 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.
 
bool filledTrigonColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw filled trigon (triangle) with alpha blending.
 
bool filledTrigonRGBA (SDL_Renderer *renderer, 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.
 
bool polygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw polygon with alpha blending.
 
bool polygon (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n)
 Draw polygon with the currently set color and blend mode.
 
bool polygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw polygon with alpha blending.
 
bool aapolygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw anti-aliased polygon with alpha blending.
 
bool aapolygonRGBA (SDL_Renderer *renderer, 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 filledPolygonRGBAMT (SDL_Renderer *renderer, 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).
 
bool filledPolygonColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw filled polygon with alpha blending.
 
bool filledPolygonRGBA (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled polygon with alpha blending.
 
bool _HLineTextured (SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, SDL_Texture *texture, int texture_w, int texture_h, int texture_dx, int texture_dy)
 Internal function to draw a textured horizontal line.
 
bool texturedPolygonMT (SDL_Renderer *renderer, 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).
 
bool texturedPolygon (SDL_Renderer *renderer, 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.
 
bool characterRGBA (SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a character of the currently set font.
 
bool characterColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint32 color)
 Draw a character of the currently set font.
 
bool stringColor (SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint32 color)
 Draw a string in the currently set font.
 
bool stringRGBA (SDL_Renderer *renderer, 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'.
 
bool bezierColor (SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
 Draw a bezier curve with alpha blending.
 
bool bezierRGBA (SDL_Renderer *renderer, 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.
 
bool thickLineColor (SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
 Draw a thick line with alpha blending.
 
bool thickLineRGBA (SDL_Renderer *renderer, 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.
 

Macro Definition Documentation

◆ AAbits

#define AAbits   8

Definition at line 834 of file SDL3_gfxPrimitives.c.

◆ AAlevels

#define AAlevels   256

Definition at line 833 of file SDL3_gfxPrimitives.c.

◆ DEFAULT_ELLIPSE_OVERSCAN

#define DEFAULT_ELLIPSE_OVERSCAN   4

Internal function to draw ellipse or filled ellipse with blending.

Parameters
rendererThe renderer 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.
fFlag indicating if the ellipse should be filled (1) or not (0).
Returns
Returns true on success, false on failure.

Definition at line 1506 of file SDL3_gfxPrimitives.c.

Function Documentation

◆ _aalineRGBA()

int _aalineRGBA ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a,
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
rendererThe renderer 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.
draw_endpointFlag indicating if the endpoint should be drawn; draw if non-zero.
Returns
Returns true on success, false on failure.

Definition at line 859 of file SDL3_gfxPrimitives.c.

◆ _drawQuadrants()

int _drawQuadrants ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 dx,
Sint16 dy,
Sint32 f )

Internal function to draw pixels or lines in 4 quadrants.

Parameters
rendererThe renderer to draw on.
xX coordinate of the center of the quadrant.
yY coordinate of the center of the quadrant.
dxX offset in pixels of the corners of the quadrant.
dyY offset in pixels of the corners of the quadrant.
fFlag indicating if the quadrant should be filled (1) or not (0).
Returns
Returns true on success, false on failure.

Definition at line 1452 of file SDL3_gfxPrimitives.c.

◆ _ellipseRGBA()

bool _ellipseRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a,
Sint32 f )

Definition at line 1507 of file SDL3_gfxPrimitives.c.

◆ _evaluateBezier()

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 3550 of file SDL3_gfxPrimitives.c.

◆ _gfxPrimitivesCompareInt()

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 2671 of file SDL3_gfxPrimitives.c.

◆ _HLineTextured()

bool _HLineTextured ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 x2,
Sint16 y,
SDL_Texture * texture,
int texture_w,
int texture_h,
int texture_dx,
int texture_dy )

Internal function to draw a textured horizontal line.

Parameters
rendererThe renderer 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 to retrieve color information from.
texture_wThe width of the texture.
texture_hThe height of the texture.
texture_dxThe X offset for the texture lookup.
texture_dyThe Y offset for the textured lookup.
Returns
Returns true on success, false on failure.

Definition at line 2917 of file SDL3_gfxPrimitives.c.

◆ _pieRGBA()

bool _pieRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Sint16 start,
Sint16 end,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a,
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
rendererThe renderer 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.
filledFlag indicating if the pie should be filled (=1) or not (=0).
Returns
Returns true on success, false on failure.

Definition at line 2052 of file SDL3_gfxPrimitives.c.

◆ aacircleColor()

bool aacircleColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Uint32 color )

Draw anti-aliased circle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1410 of file SDL3_gfxPrimitives.c.

◆ aacircleRGBA()

bool aacircleRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw anti-aliased circle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1430 of file SDL3_gfxPrimitives.c.

◆ aaellipseColor()

bool aaellipseColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint32 color )

Draw anti-aliased ellipse with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1788 of file SDL3_gfxPrimitives.c.

◆ aaellipseRGBA()

bool aaellipseRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw anti-aliased ellipse with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1809 of file SDL3_gfxPrimitives.c.

◆ aalineColor()

bool aalineColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint32 color )

Draw anti-aliased line with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1073 of file SDL3_gfxPrimitives.c.

◆ aalineRGBA()

bool aalineRGBA ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw anti-aliased line with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1094 of file SDL3_gfxPrimitives.c.

◆ aapolygonColor()

bool aapolygonColor ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
Uint32 color )

Draw anti-aliased polygon with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2593 of file SDL3_gfxPrimitives.c.

◆ aapolygonRGBA()

bool aapolygonRGBA ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw anti-aliased polygon with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2613 of file SDL3_gfxPrimitives.c.

◆ aatrigonColor()

bool aatrigonColor ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2321 of file SDL3_gfxPrimitives.c.

◆ aatrigonRGBA()

bool aatrigonRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2353 of file SDL3_gfxPrimitives.c.

◆ arcColor()

bool arcColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Sint16 start,
Sint16 end,
Uint32 color )

Arc with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1152 of file SDL3_gfxPrimitives.c.

◆ arcRGBA()

bool arcRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Sint16 start,
Sint16 end,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Arc with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1175 of file SDL3_gfxPrimitives.c.

◆ bezierColor()

bool bezierColor ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
int s,
Uint32 color )

Draw a bezier curve with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 3609 of file SDL3_gfxPrimitives.c.

◆ bezierRGBA()

bool bezierRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 3630 of file SDL3_gfxPrimitives.c.

◆ boxColor()

bool boxColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint32 color )

Draw box (filled rectangle) with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 687 of file SDL3_gfxPrimitives.c.

◆ boxRGBA()

bool boxRGBA ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw box (filled rectangle) with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 708 of file SDL3_gfxPrimitives.c.

◆ characterColor()

bool characterColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
char c,
Uint32 color )

Draw a character of the currently set font.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 3468 of file SDL3_gfxPrimitives.c.

◆ characterRGBA()

bool characterRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
char c,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw a character of the currently set font.

Parameters
rendererThe Renderer 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 true on success, false on failure.

Definition at line 3347 of file SDL3_gfxPrimitives.c.

◆ circleColor()

bool circleColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Uint32 color )

Draw circle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1112 of file SDL3_gfxPrimitives.c.

◆ circleRGBA()

bool circleRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw circle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1132 of file SDL3_gfxPrimitives.c.

◆ ellipseColor()

bool ellipseColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint32 color )

Draw ellipse with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1669 of file SDL3_gfxPrimitives.c.

◆ ellipseRGBA()

bool ellipseRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw ellipse with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1690 of file SDL3_gfxPrimitives.c.

◆ filledCircleColor()

bool filledCircleColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Uint32 color )

Draw filled circle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1708 of file SDL3_gfxPrimitives.c.

◆ filledCircleRGBA()

bool filledCircleRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw filled circle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 1728 of file SDL3_gfxPrimitives.c.

◆ filledEllipseColor()

bool filledEllipseColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint32 color )

Draw filled ellipse with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2004 of file SDL3_gfxPrimitives.c.

◆ filledEllipseRGBA()

bool filledEllipseRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rx,
Sint16 ry,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw filled ellipse with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2025 of file SDL3_gfxPrimitives.c.

◆ filledPieColor()

bool filledPieColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Sint16 start,
Sint16 end,
Uint32 color )

Draw filled pie with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2209 of file SDL3_gfxPrimitives.c.

◆ filledPieRGBA()

bool filledPieRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2231 of file SDL3_gfxPrimitives.c.

◆ filledPolygonColor()

bool filledPolygonColor ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
Uint32 color )

Draw filled polygon with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2875 of file SDL3_gfxPrimitives.c.

◆ filledPolygonRGBA()

bool filledPolygonRGBA ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw filled polygon with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2895 of file SDL3_gfxPrimitives.c.

◆ filledPolygonRGBAMT()

int filledPolygonRGBAMT ( SDL_Renderer * renderer,
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
rendererThe renderer 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 filled 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 true on success, false on failure.

Definition at line 2708 of file SDL3_gfxPrimitives.c.

◆ filledTrigonColor()

bool filledTrigonColor ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2387 of file SDL3_gfxPrimitives.c.

◆ filledTrigonRGBA()

bool filledTrigonRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2421 of file SDL3_gfxPrimitives.c.

◆ gfxPrimitivesSetFont()

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 3255 of file SDL3_gfxPrimitives.c.

◆ gfxPrimitivesSetFontRotation()

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 3301 of file SDL3_gfxPrimitives.c.

◆ hline()

bool hline ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 x2,
Sint16 y )

Draw horizontal line in currently set color.

Parameters
rendererThe renderer 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.
Returns
Returns true on success, false on failure.

Definition at line 135 of file SDL3_gfxPrimitives.c.

◆ hlineColor()

bool hlineColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 x2,
Sint16 y,
Uint32 color )

Draw horizontal line with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 152 of file SDL3_gfxPrimitives.c.

◆ hlineRGBA()

bool hlineRGBA ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 x2,
Sint16 y,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw horizontal line with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 172 of file SDL3_gfxPrimitives.c.

◆ line()

bool line ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2 )

Draw line with alpha blending using the currently set color.

Parameters
rendererThe renderer 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.
Returns
Returns true on success, false on failure.

Definition at line 778 of file SDL3_gfxPrimitives.c.

◆ lineColor()

bool lineColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint32 color )

Draw line with alpha blending.

Parameters
rendererThe renderer 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 seond point of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns
Returns true on success, false on failure.

Definition at line 798 of file SDL3_gfxPrimitives.c.

◆ lineRGBA()

bool lineRGBA ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw line with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 819 of file SDL3_gfxPrimitives.c.

◆ pieColor()

bool pieColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Sint16 rad,
Sint16 start,
Sint16 end,
Uint32 color )

Draw pie (outline) with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2167 of file SDL3_gfxPrimitives.c.

◆ pieRGBA()

bool pieRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2190 of file SDL3_gfxPrimitives.c.

◆ pixel()

bool pixel ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y )

Draw pixel in currently set color.

Parameters
rendererThe renderer to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
Returns
Returns true on success, false on failure.

Definition at line 50 of file SDL3_gfxPrimitives.c.

◆ pixelColor()

bool pixelColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Uint32 color )

Draw pixel with blending enabled if a<255.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 65 of file SDL3_gfxPrimitives.c.

◆ pixelRGBA()

bool pixelRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw pixel with blending enabled if a<255.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 84 of file SDL3_gfxPrimitives.c.

◆ pixelRGBAWeight()

bool pixelRGBAWeight ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a,
Uint32 weight )

Draw pixel with blending enabled and using alpha weight on color.

Parameters
rendererThe renderer to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position 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.
weightThe weight multiplied into the alpha value of the pixel.
Returns
Returns true on success, false on failure.

Definition at line 107 of file SDL3_gfxPrimitives.c.

◆ polygon()

bool polygon ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n )

Draw polygon with the currently set color and blend mode.

Parameters
rendererThe renderer 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.
Returns
Returns true on success, false on failure.

Definition at line 2466 of file SDL3_gfxPrimitives.c.

◆ polygonColor()

bool polygonColor ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
Uint32 color )

Draw polygon with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2450 of file SDL3_gfxPrimitives.c.

◆ polygonRGBA()

bool polygonRGBA ( SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw polygon with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 2532 of file SDL3_gfxPrimitives.c.

◆ rectangleColor()

bool rectangleColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint32 color )

Draw rectangle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 252 of file SDL3_gfxPrimitives.c.

◆ rectangleRGBA()

bool rectangleRGBA ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw rectangle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 273 of file SDL3_gfxPrimitives.c.

◆ roundedBoxColor()

bool roundedBoxColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Sint16 rad,
Uint32 color )

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

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 490 of file SDL3_gfxPrimitives.c.

◆ roundedBoxRGBA()

bool roundedBoxRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 512 of file SDL3_gfxPrimitives.c.

◆ roundedRectangleColor()

bool roundedRectangleColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Sint16 rad,
Uint32 color )

Draw rounded-corner rectangle with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 345 of file SDL3_gfxPrimitives.c.

◆ roundedRectangleRGBA()

bool roundedRectangleRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 367 of file SDL3_gfxPrimitives.c.

◆ stringColor()

bool stringColor ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 3489 of file SDL3_gfxPrimitives.c.

◆ stringRGBA()

bool stringRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y,
const char * s,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw a string in the currently set font.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 3509 of file SDL3_gfxPrimitives.c.

◆ texturedPolygon()

bool texturedPolygon ( SDL_Renderer * renderer,
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
rendererThe renderer to draw on.
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 true on success, false on failure.

Definition at line 3187 of file SDL3_gfxPrimitives.c.

◆ texturedPolygonMT()

bool texturedPolygonMT ( SDL_Renderer * renderer,
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).

Parameters
rendererThe renderer to draw on.
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 true on success, false on failure.

Definition at line 3016 of file SDL3_gfxPrimitives.c.

◆ thickLineColor()

bool thickLineColor ( SDL_Renderer * renderer,
Sint16 x1,
Sint16 y1,
Sint16 x2,
Sint16 y2,
Uint8 width,
Uint32 color )

Draw a thick line with alpha blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 3710 of file SDL3_gfxPrimitives.c.

◆ thickLineRGBA()

bool thickLineRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 3732 of file SDL3_gfxPrimitives.c.

◆ trigonColor()

bool trigonColor ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2255 of file SDL3_gfxPrimitives.c.

◆ trigonRGBA()

bool trigonRGBA ( SDL_Renderer * renderer,
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
rendererThe renderer 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 true on success, false on failure.

Definition at line 2287 of file SDL3_gfxPrimitives.c.

◆ vline()

bool vline ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y1,
Sint16 y2 )

Draw vertical line in currently set color.

Parameters
rendererThe renderer to draw on.
xX coordinate of 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.
Returns
Returns true on success, false on failure.

Definition at line 193 of file SDL3_gfxPrimitives.c.

◆ vlineColor()

bool vlineColor ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y1,
Sint16 y2,
Uint32 color )

Draw vertical line with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 209 of file SDL3_gfxPrimitives.c.

◆ vlineRGBA()

bool vlineRGBA ( SDL_Renderer * renderer,
Sint16 x,
Sint16 y1,
Sint16 y2,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a )

Draw vertical line with blending.

Parameters
rendererThe renderer 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 true on success, false on failure.

Definition at line 229 of file SDL3_gfxPrimitives.c.