50bool pixel(SDL_Renderer *renderer, Sint16 x, Sint16 y)
52 return SDL_RenderPoint(renderer, x, y);
65bool pixelColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint32 color)
67 Uint8 *c = (Uint8 *)&color;
68 return pixelRGBA(renderer, x, y, c[0], c[1], c[2], c[3]);
84bool pixelRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
87 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
88 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
89 result &= SDL_RenderPoint(renderer, x, y);
107bool pixelRGBAWeight(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint32 weight)
113 ax = ((ax * weight) >> 8);
117 a = (Uint8)(ax & 0x000000ff);
120 return pixelRGBA(renderer, x, y, r, g, b, a);
135bool hline(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y)
137 return SDL_RenderLine(renderer, x1, y, x2, y);;
152bool hlineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
154 Uint8 *c = (Uint8 *)&color;
155 return hlineRGBA(renderer, x1, x2, y, c[0], c[1], c[2], c[3]);
172bool hlineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
175 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
176 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
177 result &= SDL_RenderLine(renderer, x1, y, x2, y);
193bool vline(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2)
195 return SDL_RenderLine(renderer, x, y1, x, y2);;
209bool vlineColor(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
211 Uint8 *c = (Uint8 *)&color;
212 return vlineRGBA(renderer, x, y1, y2, c[0], c[1], c[2], c[3]);
229bool vlineRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
232 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
233 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
234 result &= SDL_RenderLine(renderer, x, y1, x, y2);
252bool rectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
254 Uint8 *c = (Uint8 *)&color;
255 return rectangleRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
273bool rectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
284 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
286 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
290 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
324 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
325 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
326 result &= SDL_RenderRect(renderer, &rect);
345bool roundedRectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
347 Uint8 *c = (Uint8 *)&color;
367bool roundedRectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
378 if (renderer == NULL)
402 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
404 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
408 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
455 result &=
arcRGBA(renderer, xx1, yy1, rad, 180, 270, r, g, b, a);
456 result &=
arcRGBA(renderer, xx2, yy1, rad, 270, 360, r, g, b, a);
457 result &=
arcRGBA(renderer, xx1, yy2, rad, 90, 180, r, g, b, a);
458 result &=
arcRGBA(renderer, xx2, yy2, rad, 0, 90, r, g, b, a);
464 result &=
hlineRGBA(renderer, xx1, xx2, y1, r, g, b, a);
465 result &=
hlineRGBA(renderer, xx1, xx2, y2, r, g, b, a);
468 result &=
vlineRGBA(renderer, x1, yy1, yy2, r, g, b, a);
469 result &=
vlineRGBA(renderer, x2, yy1, yy2, r, g, b, a);
490bool roundedBoxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
492 Uint8 *c = (Uint8 *)&color;
493 return roundedBoxRGBA(renderer, x1, y1, x2, y2, rad, c[0], c[1], c[2], c[3]);
513 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
516 Sint16 w, h, r2, tmp;
519 Sint16 ocx = (Sint16) 0xffff;
520 Sint16 ocy = (Sint16) 0xffff;
523 Sint16 d_se = -2 * rad + 5;
524 Sint16 xpcx, xmcx, xpcy, xmcy;
525 Sint16 ypcy, ymcy, ypcx, ymcx;
531 if (renderer == NULL)
547 return boxRGBA(renderer, x1, y1, x2, y2, r, g, b, a);
555 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
557 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
561 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
606 dx = x2 - x1 - rad - rad;
607 dy = y2 - y1 - rad - rad;
613 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
614 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
628 result &=
hline(renderer, xmcx, xpcx + dx, ypcy + dy);
629 result &=
hline(renderer, xmcx, xpcx + dx, ymcy);
631 result &=
hline(renderer, xmcx, xpcx + dx, y);
640 result &=
hline(renderer, xmcy, xpcy + dx, ymcx);
641 result &=
hline(renderer, xmcy, xpcy + dx, ypcx + dy);
643 result &=
hline(renderer, xmcy, xpcy + dx, y);
666 if (dx > 0 && dy > 0) {
667 result &=
boxRGBA(renderer, x1, y1 + rad + 1, x2, y2 - rad, r, g, b, a);
687bool boxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
689 Uint8 *c = (Uint8 *)&color;
690 return boxRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
708bool boxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
719 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
721 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
725 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
752 rect.w = x2 - x1 + 1;
753 rect.h = y2 - y1 + 1;
759 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
760 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
761 result &= SDL_RenderFillRect(renderer, &rect);
778bool line(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
783 return SDL_RenderLine(renderer, x1, y1, x2, y2);
798bool lineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
800 Uint8 *c = (Uint8 *)&color;
801 return lineRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
819bool lineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
825 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
826 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
827 result &= SDL_RenderLine(renderer, x1, y1, x2, y2);
859int _aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
int draw_endpoint)
861 Sint32 xx0, yy0, xx1, yy1;
863 Uint32 intshift, erracc, erradj;
864 Uint32 erracctmp, wgt, wgtcompmask;
865 int dx, dy, tmp, xdir, y0p1, x0pxdir;
912 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
915 return (
vlineRGBA(renderer, x1, yy0, yy0+dy, r, g, b, a));
917 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
920 }
else if (dy == 0) {
926 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
929 return (
hlineRGBA(renderer, xx0, xx0+(xdir*dx), y1, r, g, b, a));
931 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
934 }
else if ((dx == dy) && (draw_endpoint)) {
938 return (
lineRGBA(renderer, x1, y1, x2, y2, r, g, b, a));
965 result &=
pixelRGBA(renderer, x1, y1, r, g, b, a);
980 erradj = ((dx << 16) / dy) << 16;
985 x0pxdir = xx0 + xdir;
989 if (erracc <= erracctmp) {
1003 wgt = (erracc >> intshift) & 255;
1004 result &=
pixelRGBAWeight (renderer, xx0, yy0, r, g, b, a, 255 - wgt);
1018 erradj = ((dy << 16) / dx) << 16;
1028 if (erracc <= erracctmp) {
1041 wgt = (erracc >> intshift) & 255;
1042 result &=
pixelRGBAWeight (renderer, xx0, yy0, r, g, b, a, 255 - wgt);
1050 if (draw_endpoint) {
1055 result &=
pixelRGBA (renderer, x2, y2, r, g, b, a);
1073bool aalineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
1075 Uint8 *c = (Uint8 *)&color;
1076 return _aalineRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3], 1);
1094bool aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1096 return _aalineRGBA(renderer, x1, y1, x2, y2, r, g, b, a, 1);
1112bool circleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
1114 Uint8 *c = (Uint8 *)&color;
1115 return ellipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
1132bool circleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1134 return ellipseRGBA(renderer, x, y, rad, rad, r, g, b, a);
1152bool arcColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
1154 Uint8 *c = (Uint8 *)&color;
1155 return arcRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3]);
1175bool arcRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1180 Sint16 df = 1 - rad;
1182 Sint16 d_se = -2 * rad + 5;
1183 Sint16 xpcx, xmcx, xpcy, xmcy;
1184 Sint16 ypcy, ymcy, ypcx, ymcx;
1186 int startoct, endoct, oct, stopval_start = 0, stopval_end = 0;
1187 double dstart, dend, temp = 0.;
1200 return (
pixelRGBA(renderer, x, y, r, g, b, a));
1229 while (start < 0) start += 360;
1230 while (end < 0) end += 360;
1235 startoct = start / 45;
1241 oct = (oct + 1) % 8;
1243 if (oct == startoct) {
1245 dstart = (double)start;
1250 temp = sin(dstart *
M_PI / 180.);
1254 temp = cos(dstart *
M_PI / 180.);
1258 temp = -cos(dstart *
M_PI / 180.);
1262 temp = -sin(dstart *
M_PI / 180.);
1266 stopval_start = (int)temp;
1274 if (oct % 2) drawoct |= (1 << oct);
1275 else drawoct &= 255 - (1 << oct);
1277 if (oct == endoct) {
1284 temp = sin(dend *
M_PI / 180);
1288 temp = cos(dend *
M_PI / 180);
1292 temp = -cos(dend *
M_PI / 180);
1296 temp = -sin(dend *
M_PI / 180);
1300 stopval_end = (int)temp;
1303 if (startoct == endoct) {
1311 drawoct &= 255 - (1 << oct);
1314 else if (oct % 2) drawoct &= 255 - (1 << oct);
1315 else drawoct |= (1 << oct);
1316 }
else if (oct != startoct) {
1317 drawoct |= (1 << oct);
1319 }
while (oct != endoct);
1327 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
1328 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
1341 if (drawoct & 4) result &=
pixel(renderer, xmcx, ypcy);
1342 if (drawoct & 2) result &=
pixel(renderer, xpcx, ypcy);
1343 if (drawoct & 32) result &=
pixel(renderer, xmcx, ymcy);
1344 if (drawoct & 64) result &=
pixel(renderer, xpcx, ymcy);
1346 if (drawoct & 96) result &=
pixel(renderer, x, ymcy);
1347 if (drawoct & 6) result &=
pixel(renderer, x, ypcy);
1352 if (cx > 0 && cx != cy) {
1355 if (drawoct & 8) result &=
pixel(renderer, xmcy, ypcx);
1356 if (drawoct & 1) result &=
pixel(renderer, xpcy, ypcx);
1357 if (drawoct & 16) result &=
pixel(renderer, xmcy, ymcx);
1358 if (drawoct & 128) result &=
pixel(renderer, xpcy, ymcx);
1359 }
else if (cx == 0) {
1360 if (drawoct & 24) result &=
pixel(renderer, xmcy, y);
1361 if (drawoct & 129) result &=
pixel(renderer, xpcy, y);
1367 if (stopval_start == cx) {
1370 if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);
1371 else drawoct |= (1 << startoct);
1373 if (stopval_end == cx) {
1374 if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
1375 else drawoct |= (1 << endoct);
1410bool aacircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
1412 Uint8 *c = (Uint8 *)&color;
1413 return aaellipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
1430bool aacircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1452int _drawQuadrants(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 dx, Sint16 dy, Sint32 f)
1460 result &=
pixel(renderer, x, y);
1465 result &=
vline(renderer, x, ymdy, ypdy);
1467 result &=
pixel(renderer, x, ypdy);
1468 result &=
pixel(renderer, x, ymdy);
1477 result &=
vline(renderer, xpdx, ymdy, ypdy);
1478 result &=
vline(renderer, xmdx, ymdy, ypdy);
1480 result &=
pixel(renderer, xpdx, ypdy);
1481 result &=
pixel(renderer, xmdx, ypdy);
1482 result &=
pixel(renderer, xpdx, ymdy);
1483 result &=
pixel(renderer, xmdx, ymdy);
1506#define DEFAULT_ELLIPSE_OVERSCAN 4
1507bool _ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Sint32 f)
1511 Sint32 rx2, ry2, rx22, ry22;
1513 Sint32 curX, curY, curXp1, curYm1;
1514 Sint32 scrX, scrY, oldX, oldY;
1515 Sint32 deltaX, deltaY;
1516 Sint32 ellipseOverscan;
1521 if ((rx < 0) || (ry < 0)) {
1529 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
1530 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
1537 return (
pixel(renderer, x, y));
1539 return (
vline(renderer, x, y - ry, y + ry));
1543 return (
hline(renderer, x - rx, x + rx, y));
1552 if (rxi >= 512 || ryi >= 512)
1556 else if (rxi >= 256 || ryi >= 256)
1573 rxi *= ellipseOverscan;
1574 ryi *= ellipseOverscan;
1582 deltaY = rx22 * curY;
1585 error = ry2 - rx2 * ryi + rx2 / 4;
1586 while (deltaX <= deltaY)
1591 error += deltaX + ry2;
1599 scrX = curX / ellipseOverscan;
1600 scrY = curY / ellipseOverscan;
1601 if ((scrX != oldX && scrY == oldY) || (scrX != oldX && scrY != oldY)) {
1613 error = ry2 * curX * curXp1 + ((ry2 + 3) / 4) + rx2 * curYm1 * curYm1 - rx2 * ry2;
1629 scrX = curX / ellipseOverscan;
1630 scrY = curY / ellipseOverscan;
1631 if ((scrX != oldX && scrY == oldY) || (scrX != oldX && scrY != oldY)) {
1633 for (;oldY >= scrY; oldY--) {
1648 for (;oldY >= 0; oldY--) {
1669bool ellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
1671 Uint8 *c = (Uint8 *)&color;
1672 return _ellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3], 0);
1690bool ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1692 return _ellipseRGBA(renderer, x, y, rx, ry, r, g, b, a, 0);
1710 Uint8 *c = (Uint8 *)&color;
1728bool filledCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1730 return _ellipseRGBA(renderer, x, y, rad, rad, r, g ,b, a, 1);
1737#if defined(_MSC_VER) && _MSC_VER < 1920
1740#include <emmintrin.h>
1744 return _mm_cvtss_si32(_mm_load_ss(&f));
1746#elif defined(_M_IX86)
1758#elif defined(_M_ARM)
1760#pragma warning(push)
1761#pragma warning(disable: 4716)
1762__declspec(naked)
long int
1772#error lrint needed for MSVC on non X86/AMD64/ARM targets.
1788bool aaellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
1790 Uint8 *c = (Uint8 *)&color;
1791 return aaellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3]);
1809bool aaellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1813 int a2, b2, ds, dt, dxt, t, s, d;
1814 Sint16 xp, yp, xs, ys, dyt, od, xx, yy, xc2, yc2;
1817 Uint8 weight, iweight;
1822 if ((rx < 0) || (ry < 0)) {
1831 return (
pixelRGBA(renderer, x, y, r, g, b, a));
1833 return (
vlineRGBA(renderer, x, y - ry, y + ry, r, g, b, a));
1837 return (
hlineRGBA(renderer, x - rx, x + rx, y, r, g, b, a));
1851 sab = sqrt((
double)(a2 + b2));
1852 od = (Sint16)lrint(sab*0.01) + 1;
1853 dxt = (Sint16)lrint((
double)a2 / sab) + od;
1864 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
1867 result &=
pixelRGBA(renderer, xp, yp, r, g, b, a);
1868 result &=
pixelRGBA(renderer, xc2 - xp, yp, r, g, b, a);
1869 result &=
pixelRGBA(renderer, xp, yc2 - yp, r, g, b, a);
1870 result &=
pixelRGBA(renderer, xc2 - xp, yc2 - yp, r, g, b, a);
1872 for (i = 1; i <= dxt; i++) {
1878 else if ((d - s - a2) > 0) {
1879 if ((2 * d - s - a2) >= 0)
1898 cp = (float) abs(d) / (float) abs(s);
1907 weight = (Uint8) (cp * 255);
1908 iweight = 255 - weight;
1929 dyt = (Sint16)lrint((
double)b2 / sab ) + od;
1931 for (i = 1; i <= dyt; i++) {
1937 else if ((d + t - b2) < 0) {
1938 if ((2 * d + t - b2) <= 0)
1957 cp = (float) abs(d) / (float) abs(t);
1966 weight = (Uint8) (cp * 255);
1967 iweight = 255 - weight;
2006 Uint8 *c = (Uint8 *)&color;
2007 return _ellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3], 1);
2025bool filledEllipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2027 return _ellipseRGBA(renderer, x, y, rx, ry, r, g, b, a, 1);
2052bool _pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 filled)
2055 double angle, start_angle, end_angle;
2071 start = start % 360;
2078 return (
pixelRGBA(renderer, x, y, r, g, b, a));
2085 deltaAngle = 3.0 / dr;
2086 start_angle = (double) start *(2.0 *
M_PI / 360.0);
2087 end_angle = (double) end *(2.0 *
M_PI / 360.0);
2089 end_angle += (2.0 *
M_PI);
2096 angle = start_angle;
2097 while (angle < end_angle) {
2098 angle += deltaAngle;
2103 vx = vy = (Sint16 *) malloc(2 *
sizeof(Uint16) * numpoints);
2116 angle = start_angle;
2117 vx[1] = x + (int) (dr * cos(angle));
2118 vy[1] = y + (int) (dr * sin(angle));
2122 result =
lineRGBA(renderer, vx[0], vy[0], vx[1], vy[1], r, g, b, a);
2128 angle = start_angle;
2129 while (angle < end_angle) {
2130 angle += deltaAngle;
2131 if (angle>end_angle)
2135 vx[i] = x + (int) (dr * cos(angle));
2136 vy[i] = y + (int) (dr * sin(angle));
2144 result =
polygonRGBA(renderer, vx, vy, numpoints, r, g, b, a);
2167bool pieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
2168 Sint16 start, Sint16 end, Uint32 color)
2170 Uint8 *c = (Uint8 *)&color;
2171 return _pieRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3], 0);
2190bool pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
2191 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2193 return _pieRGBA(renderer, x, y, rad, start, end, r, g, b, a, 0);
2209bool filledPieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
2211 Uint8 *c = (Uint8 *)&color;
2212 return _pieRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3], 1);
2232 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2234 return _pieRGBA(renderer, x, y, rad, start, end, r, g, b, a, 1);
2255bool trigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
2287bool trigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
2288 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2321bool aatrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
2353bool aatrigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
2354 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2387bool filledTrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
2421bool filledTrigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
2422 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2450bool polygonColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint32 color)
2452 Uint8 *c = (Uint8 *)&color;
2453 return polygonRGBA(renderer, vx, vy, n, c[0], c[1], c[2], c[3]);
2466bool polygon(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n)
2496 points = (SDL_FPoint*)malloc(
sizeof(SDL_FPoint) * nn);
2503 points[i].x = vx[i];
2504 points[i].y = vy[i];
2506 points[n].x = vx[0];
2507 points[n].y = vy[0];
2512 result &= SDL_RenderLines(renderer, points, nn);
2532bool polygonRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2538 const Sint16 *x1, *y1, *x2, *y2;
2569 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
2570 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
2575 result &=
polygon(renderer, vx, vy, n);
2593bool aapolygonColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint32 color)
2595 Uint8 *c = (Uint8 *)&color;
2596 return aapolygonRGBA(renderer, vx, vy, n, c[0], c[1], c[2], c[3]);
2613bool aapolygonRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2617 const Sint16 *x1, *y1, *x2, *y2;
2648 for (i = 1; i < n; i++) {
2649 result &=
_aalineRGBA(renderer, *x1, *y1, *x2, *y2, r, g, b, a, 0);
2656 result &=
_aalineRGBA(renderer, *x1, *y1, *vx, *vy, r, g, b, a, 0);
2673 return (*(
const int *) a) - (*(
const int *) b);
2681static int *gfxPrimitivesPolyIntsGlobal = NULL;
2688static int gfxPrimitivesPolyAllocatedGlobal = 0;
2708int filledPolygonRGBAMT(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
int **polyInts,
int *polyAllocated)
2718 int *gfxPrimitivesPolyInts = NULL;
2719 int *gfxPrimitivesPolyIntsNew = NULL;
2720 int gfxPrimitivesPolyAllocated = 0;
2742 if ((polyInts==NULL) || (polyAllocated==NULL)) {
2744 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
2745 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
2748 gfxPrimitivesPolyInts = *polyInts;
2749 gfxPrimitivesPolyAllocated = *polyAllocated;
2755 if (!gfxPrimitivesPolyAllocated) {
2756 gfxPrimitivesPolyInts = (
int *) malloc(
sizeof(
int) * n);
2757 gfxPrimitivesPolyAllocated = n;
2759 if (gfxPrimitivesPolyAllocated < n) {
2760 gfxPrimitivesPolyIntsNew = (
int *) realloc(gfxPrimitivesPolyInts,
sizeof(
int) * n);
2761 if (!gfxPrimitivesPolyIntsNew) {
2762 if (!gfxPrimitivesPolyInts) {
2763 free(gfxPrimitivesPolyInts);
2764 gfxPrimitivesPolyInts = NULL;
2766 gfxPrimitivesPolyAllocated = 0;
2768 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsNew;
2769 gfxPrimitivesPolyAllocated = n;
2777 if (gfxPrimitivesPolyInts==NULL) {
2778 gfxPrimitivesPolyAllocated = 0;
2784 if ((polyInts==NULL) || (polyAllocated==NULL)) {
2785 gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
2786 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
2788 *polyInts = gfxPrimitivesPolyInts;
2789 *polyAllocated = gfxPrimitivesPolyAllocated;
2795 if (gfxPrimitivesPolyInts==NULL) {
2804 for (i = 1; (i < n); i++) {
2807 }
else if (vy[i] > maxy) {
2815 for (y = miny; (y <= maxy); y++) {
2817 for (i = 0; (i < n); i++) {
2830 }
else if (y1 > y2) {
2838 if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
2839 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
2849 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
2850 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
2852 for (i = 0; (i < ints); i += 2) {
2853 xa = gfxPrimitivesPolyInts[i] + 1;
2854 xa = (xa >> 16) + ((xa & 32768) >> 15);
2855 xb = gfxPrimitivesPolyInts[i+1] - 1;
2856 xb = (xb >> 16) + ((xb & 32768) >> 15);
2857 result &=
hline(renderer, xa, xb, y);
2875bool filledPolygonColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint32 color)
2877 Uint8 *c = (Uint8 *)&color;
2895bool filledPolygonRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2917bool _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)
2922 int texture_x_walker;
2923 int texture_y_start;
2924 SDL_FRect source_rect,dst_rect;
2925 int pixels_written,write_width;
2944 texture_x_walker = (x1 - texture_dx) % texture_w;
2945 if (texture_x_walker < 0){
2946 texture_x_walker = texture_w + texture_x_walker ;
2949 texture_y_start = (y + texture_dy) % texture_h;
2950 if (texture_y_start < 0){
2951 texture_y_start = texture_h + texture_y_start;
2955 source_rect.y = texture_y_start;
2956 source_rect.x = texture_x_walker;
2965 if (w <= texture_w -texture_x_walker){
2967 source_rect.x = texture_x_walker;
2969 dst_rect.w = source_rect.w;
2970 result = (SDL_RenderTexture(renderer, texture, &source_rect, &dst_rect) == 0);
2974 pixels_written = texture_w - texture_x_walker;
2975 source_rect.w = pixels_written;
2976 source_rect.x = texture_x_walker;
2978 dst_rect.w = source_rect.w;
2979 result &= (SDL_RenderTexture(renderer, texture, &source_rect, &dst_rect) == 0);
2980 write_width = texture_w;
2985 while (pixels_written < w){
2986 if (write_width >= w - pixels_written) {
2987 write_width = w - pixels_written;
2989 source_rect.w = write_width;
2990 dst_rect.x = x1 + pixels_written;
2991 dst_rect.w = source_rect.w;
2992 result &= (SDL_RenderTexture(renderer, texture, &source_rect, &dst_rect) == 0);
2993 pixels_written += write_width;
3017 SDL_Surface * texture,
int texture_dx,
int texture_dy,
int **polyInts,
int *polyAllocated)
3022 int minx,maxx,miny, maxy;
3027 int *gfxPrimitivesPolyInts = NULL;
3028 int *gfxPrimitivesPolyIntsTemp = NULL;
3029 int gfxPrimitivesPolyAllocated = 0;
3030 SDL_Texture *textureAsTexture = NULL;
3042 if ((polyInts==NULL) || (polyAllocated==NULL)) {
3044 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
3045 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
3048 gfxPrimitivesPolyInts = *polyInts;
3049 gfxPrimitivesPolyAllocated = *polyAllocated;
3055 if (!gfxPrimitivesPolyAllocated) {
3056 gfxPrimitivesPolyInts = (
int *) malloc(
sizeof(
int) * n);
3057 gfxPrimitivesPolyAllocated = n;
3059 if (gfxPrimitivesPolyAllocated < n) {
3060 gfxPrimitivesPolyIntsTemp = (
int *) realloc(gfxPrimitivesPolyInts,
sizeof(
int) * n);
3061 if (gfxPrimitivesPolyIntsTemp == NULL) {
3065 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsTemp;
3066 gfxPrimitivesPolyAllocated = n;
3073 if (gfxPrimitivesPolyInts==NULL) {
3074 gfxPrimitivesPolyAllocated = 0;
3080 if ((polyInts==NULL) || (polyAllocated==NULL)) {
3081 gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
3082 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
3084 *polyInts = gfxPrimitivesPolyInts;
3085 *polyAllocated = gfxPrimitivesPolyAllocated;
3091 if (gfxPrimitivesPolyInts==NULL) {
3102 for (i = 1; (i < n); i++) {
3105 }
else if (vy[i] > maxy) {
3110 }
else if (vx[i] > maxx) {
3116 textureAsTexture = SDL_CreateTextureFromSurface(renderer, texture);
3117 if (textureAsTexture == NULL)
3121 SDL_SetTextureBlendMode(textureAsTexture, SDL_BLENDMODE_BLEND);
3127 for (y = miny; (y <= maxy); y++) {
3129 for (i = 0; (i < n); i++) {
3142 }
else if (y1 > y2) {
3150 if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
3151 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
3157 for (i = 0; (i < ints); i += 2) {
3158 xa = gfxPrimitivesPolyInts[i] + 1;
3159 xa = (xa >> 16) + ((xa & 32768) >> 15);
3160 xb = gfxPrimitivesPolyInts[i+1] - 1;
3161 xb = (xb >> 16) + ((xb & 32768) >> 15);
3162 result &=
_HLineTextured(renderer, xa, xb, y, textureAsTexture, texture->w, texture->h, texture_dx, texture_dy);
3166 SDL_DestroyTexture(textureAsTexture);
3187bool texturedPolygon(SDL_Renderer *renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, SDL_Surface *texture,
int texture_dx,
int texture_dy)
3192 return (
texturedPolygonMT(renderer, vx, vy, n, texture, texture_dx, texture_dy, NULL, NULL));
3200static SDL_Texture *gfxPrimitivesFont[256];
3205static const unsigned char *currentFontdata = gfxPrimitivesFontdata;
3210static Uint32 charWidth = 8;
3215static Uint32 charHeight = 8;
3220static Uint32 charWidthLocal = 8;
3225static Uint32 charHeightLocal = 8;
3230static Uint32 charPitch = 1;
3235static Uint32 charRotation = 0;
3240static Uint32 charSize = 8;
3259 if ((fontdata) && (cw) && (ch)) {
3260 currentFontdata = (
unsigned char *)fontdata;
3264 currentFontdata = gfxPrimitivesFontdata;
3269 charPitch = (charWidth+7)/8;
3270 charSize = charPitch * charHeight;
3273 if ((charRotation==1) || (charRotation==3))
3275 charWidthLocal = charHeight;
3276 charHeightLocal = charWidth;
3280 charWidthLocal = charWidth;
3281 charHeightLocal = charHeight;
3285 for (i = 0; i < 256; i++) {
3286 if (gfxPrimitivesFont[i]) {
3287 SDL_DestroyTexture(gfxPrimitivesFont[i]);
3288 gfxPrimitivesFont[i] = NULL;
3305 rotation = rotation & 3;
3306 if (charRotation != rotation)
3309 charRotation = rotation;
3312 if ((charRotation==1) || (charRotation==3))
3314 charWidthLocal = charHeight;
3315 charHeightLocal = charWidth;
3319 charWidthLocal = charWidth;
3320 charHeightLocal = charHeight;
3324 for (i = 0; i < 256; i++) {
3325 if (gfxPrimitivesFont[i]) {
3326 SDL_DestroyTexture(gfxPrimitivesFont[i]);
3327 gfxPrimitivesFont[i] = NULL;
3347bool characterRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y,
char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3353 const unsigned char *charpos;
3358 SDL_Surface *character;
3359 SDL_Surface *rotatedCharacter;
3367 srect.w = charWidthLocal;
3368 srect.h = charHeightLocal;
3375 drect.w = charWidthLocal;
3376 drect.h = charHeightLocal;
3379 ci = (
unsigned char) c;
3385 if (gfxPrimitivesFont[ci] == NULL) {
3389 character = SDL_CreateSurface(
3390 charWidth, charHeight, SDL_PIXELFORMAT_RGBA8888);
3391 if (character == NULL) {
3395 charpos = currentFontdata + ci * charSize;
3396 linepos = (Uint8 *)character->pixels;
3397 pitch = character->pitch;
3403 for (iy = 0; iy < charHeight; iy++) {
3406 for (ix = 0; ix < charWidth; ix++) {
3407 if (!(mask >>= 1)) {
3412 *(Uint32 *)curpos = 0xffffffff;
3414 *(Uint32 *)curpos = 0;
3425 SDL_DestroySurface(character);
3426 character = rotatedCharacter;
3430 gfxPrimitivesFont[ci] = SDL_CreateTextureFromSurface(renderer, character);
3431 SDL_DestroySurface(character);
3436 if (gfxPrimitivesFont[ci] == NULL) {
3445 result &= SDL_SetTextureColorMod(gfxPrimitivesFont[ci], r, g, b);
3446 result &= SDL_SetTextureAlphaMod(gfxPrimitivesFont[ci], a);
3451 result &= SDL_RenderTexture(renderer, gfxPrimitivesFont[ci], &srect, &drect);
3468bool characterColor(SDL_Renderer * renderer, Sint16 x, Sint16 y,
char c, Uint32 color)
3470 Uint8 *co = (Uint8 *)&color;
3471 return characterRGBA(renderer, x, y, c, co[0], co[1], co[2], co[3]);
3489bool stringColor(SDL_Renderer * renderer, Sint16 x, Sint16 y,
const char *s, Uint32 color)
3491 Uint8 *c = (Uint8 *)&color;
3492 return stringRGBA(renderer, x, y, s, c[0], c[1], c[2], c[3]);
3509bool stringRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3514 const char *curchar = s;
3516 while (*curchar && result) {
3517 result &=
characterRGBA(renderer, curx, cury, *curchar, r, g, b, a);
3518 switch (charRotation)
3521 curx += charWidthLocal;
3524 curx -= charWidthLocal;
3527 cury += charHeightLocal;
3530 cury -= charHeightLocal;
3554 double blend,muk,munk;
3560 if (t>=(
double)ndata) {
3561 return(data[ndata-1]);
3571 munk = pow(1-mu,(
double)n);
3572 for (k=0;k<=n;k++) {
3583 blend /= (double)kn;
3587 blend /= (double)nkn;
3591 result += data[k] * blend;
3609bool bezierColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
int s, Uint32 color)
3611 Uint8 *c = (Uint8 *)&color;
3612 return bezierRGBA(renderer, vx, vy, n, s, c[0], c[1], c[2], c[3]);
3630bool bezierRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3634 double *x, *y, t, stepsize;
3635 Sint16 x1, y1, x2, y2;
3650 stepsize=(double)1.0/(
double)s;
3653 if ((x=(
double *)malloc(
sizeof(
double)*(n+1)))==NULL) {
3656 if ((y=(
double *)malloc(
sizeof(
double)*(n+1)))==NULL) {
3660 for (i=0; i<n; i++) {
3671 result &= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
3672 result &= SDL_SetRenderDrawColor(renderer, r, g, b, a);
3680 for (i = 0; i <= (n*s); i++) {
3684 result &=
line(renderer, x1, y1, x2, y2);
3710bool thickLineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
3712 Uint8 *c = (Uint8 *)&color;
3713 return thickLineRGBA(renderer, x1, y1, x2, y2, width, c[0], c[1], c[2], c[3]);
3732bool thickLineRGBA(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3735 double dx, dy, dx1, dy1, dx2, dy2;
3736 double l, wl2, nx, ny, ang, adj;
3737 Sint16 px[4], py[4];
3739 if (renderer == NULL) {
3748 if ((x1 == x2) && (y1 == y2)) {
3750 return boxRGBA(renderer, x1 - wh, y1 - wh, x2 + width, y2 + width, r, g, b, a);
3755 return lineRGBA(renderer, x1, y1, x2, y2, r, g, b, a);
3759 dx = (double)(x2 - x1);
3760 dy = (double)(y2 - y1);
3761 l = SDL_sqrt(dx*dx + dy*dy);
3762 ang = SDL_atan2(dx, dy);
3763 adj = 0.1 + 0.9 * SDL_fabs(SDL_cos(2.0 * ang));
3764 wl2 = ((double)width - adj)/(2.0 * l);
3773 px[0] = (Sint16)(dx1 + ny);
3774 px[1] = (Sint16)(dx1 - ny);
3775 px[2] = (Sint16)(dx2 - ny);
3776 px[3] = (Sint16)(dx2 + ny);
3777 py[0] = (Sint16)(dy1 - nx);
3778 py[1] = (Sint16)(dy1 + nx);
3779 py[2] = (Sint16)(dy2 + nx);
3780 py[3] = (Sint16)(dy2 - nx);
bool pixel(SDL_Renderer *renderer, Sint16 x, Sint16 y)
Draw pixel in currently set color.
bool polygonColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
Draw polygon with alpha blending.
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 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 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 filledPolygonColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
Draw filled 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 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 vline(SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2)
Draw vertical line in currently set color.
bool characterColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint32 color)
Draw a character of the currently set font.
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 aapolygonColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
Draw anti-aliased polygon 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.
bool aaellipseColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
Draw anti-aliased ellipse with 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 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 line(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
Draw line with alpha blending using the currently set color.
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 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 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 arcColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
Arc with 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 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.
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 boxColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw box (filled rectangle) with blending.
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 circleColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
Draw circle with 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.
bool aacircleColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
Draw anti-aliased circle 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 pixelColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint32 color)
Draw pixel with blending enabled if a<255.
bool rectangleColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw rectangle with blending.
bool ellipseColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
Draw ellipse with blending.
bool lineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw line 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 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.
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 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.
bool filledCircleRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw filled circle with blending.
double _evaluateBezier(double *data, int ndata, double t)
Internal function to calculate bezier interpolator of data array with ndata values at position 't'.
bool vlineColor(SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
Draw vertical line with 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 aacircleRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw anti-aliased circle 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 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 filledPieColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
Draw filled pie with alpha blending.
bool pieColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
Draw pie (outline) with alpha 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 roundedRectangleColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
Draw rounded-corner rectangle 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 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 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 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.
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 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 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 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 filledEllipseColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
Draw filled ellipse with blending.
#define DEFAULT_ELLIPSE_OVERSCAN
Internal function to draw ellipse or 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 vlineRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw vertical line with blending.
bool _ellipseRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Sint32 f)
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 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 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 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 hline(SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y)
Draw horizontal line in currently set color.
int _gfxPrimitivesCompareInt(const void *a, const void *b)
Internal helper qsort callback functions used in filled polygon drawing.
bool thickLineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
Draw a thick line with alpha blending.
void gfxPrimitivesSetFontRotation(Uint32 rotation)
Sets current global font character rotation steps.
bool aalineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw anti-aliased line with alpha blending.
bool stringColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint32 color)
Draw a string in the currently set font.
void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch)
Sets or resets the current global font data.
SDL_Surface * rotateSurface90Degrees(SDL_Surface *src, int numClockwiseTurns)
Rotates a 8/16/24/32 bit surface in increments of 90 degrees.