59 Sint16 last1x, last1y, last2x, last2y, first1x, first1y, first2x, first2y, tempx,
tempy;
73 int pixel(SDL_Renderer *renderer, Sint16 x, Sint16 y)
75 return SDL_RenderDrawPoint(renderer, x, y);
88 int pixelColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint32 color)
90 Uint8 *c = (Uint8 *)&color;
91 return pixelRGBA(renderer, x, y, c[0], c[1], c[2], c[3]);
107 int pixelRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
110 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
111 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
112 result |= SDL_RenderDrawPoint(renderer, x, y);
130 int pixelRGBAWeight(SDL_Renderer * renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint32 weight)
136 ax = ((ax * weight) >> 8);
140 a = (Uint8)(ax & 0x000000ff);
143 return pixelRGBA(renderer, x, y, r, g, b, a);
158 int hline(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y)
160 return SDL_RenderDrawLine(renderer, x1, y, x2, y);;
175 int hlineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
177 Uint8 *c = (Uint8 *)&color;
178 return hlineRGBA(renderer, x1, x2, y, c[0], c[1], c[2], c[3]);
195 int hlineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
198 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
199 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
200 result |= SDL_RenderDrawLine(renderer, x1, y, x2, y);
216 int vline(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2)
218 return SDL_RenderDrawLine(renderer, x, y1, x, y2);;
232 int vlineColor(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
234 Uint8 *c = (Uint8 *)&color;
235 return vlineRGBA(renderer, x, y1, y2, c[0], c[1], c[2], c[3]);
252 int vlineRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
255 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
256 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
257 result |= SDL_RenderDrawLine(renderer, x, y1, x, y2);
275 int rectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
277 Uint8 *c = (Uint8 *)&color;
278 return rectangleRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
296 int rectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
307 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
309 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
313 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
347 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
348 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
349 result |= SDL_RenderDrawRect(renderer, &rect);
368 int roundedRectangleColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
370 Uint8 *c = (Uint8 *)&color;
390 int roundedRectangleRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
401 if (renderer == NULL)
425 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
427 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
431 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
478 result |=
arcRGBA(renderer, xx1, yy1, rad, 180, 270, r, g, b, a);
479 result |=
arcRGBA(renderer, xx2, yy1, rad, 270, 360, r, g, b, a);
480 result |=
arcRGBA(renderer, xx1, yy2, rad, 90, 180, r, g, b, a);
481 result |=
arcRGBA(renderer, xx2, yy2, rad, 0, 90, r, g, b, a);
487 result |=
hlineRGBA(renderer, xx1, xx2, y1, r, g, b, a);
488 result |=
hlineRGBA(renderer, xx1, xx2, y2, r, g, b, a);
491 result |=
vlineRGBA(renderer, x1, yy1, yy2, r, g, b, a);
492 result |=
vlineRGBA(renderer, x2, yy1, yy2, r, g, b, a);
513 int roundedBoxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
515 Uint8 *c = (Uint8 *)&color;
516 return roundedBoxRGBA(renderer, x1, y1, x2, y2, rad, c[0], c[1], c[2], c[3]);
536 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
539 Sint16 w, h, r2, tmp;
542 Sint16 ocx = (Sint16) 0xffff;
543 Sint16 ocy = (Sint16) 0xffff;
546 Sint16 d_se = -2 * rad + 5;
547 Sint16 xpcx, xmcx, xpcy, xmcy;
548 Sint16 ypcy, ymcy, ypcx, ymcx;
554 if (renderer == NULL)
578 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
580 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
584 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
629 dx = x2 - x1 - rad - rad;
630 dy = y2 - y1 - rad - rad;
636 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
637 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
651 result |=
hline(renderer, xmcx, xpcx + dx, ypcy + dy);
652 result |=
hline(renderer, xmcx, xpcx + dx, ymcy);
654 result |=
hline(renderer, xmcx, xpcx + dx, y);
663 result |=
hline(renderer, xmcy, xpcy + dx, ymcx);
664 result |=
hline(renderer, xmcy, xpcy + dx, ypcx + dy);
666 result |=
hline(renderer, xmcy, xpcy + dx, y);
689 if (dx > 0 && dy > 0) {
690 result |=
boxRGBA(renderer, x1, y1 + rad + 1, x2, y2 - rad, r, g, b, a);
710 int boxColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
712 Uint8 *c = (Uint8 *)&color;
713 return boxRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
731 int boxRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
742 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
744 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
748 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
775 rect.w = x2 - x1 + 1;
776 rect.h = y2 - y1 + 1;
782 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
783 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
784 result |= SDL_RenderFillRect(renderer, &rect);
801 int line(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
806 return SDL_RenderDrawLine(renderer, x1, y1, x2, y2);
821 int lineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
823 Uint8 *c = (Uint8 *)&color;
824 return lineRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3]);
842 int lineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
848 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
849 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
850 result |= SDL_RenderDrawLine(renderer, x1, y1, x2, y2);
882 int _aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
int draw_endpoint)
884 Sint32 xx0, yy0, xx1, yy1;
886 Uint32 intshift, erracc, erradj;
887 Uint32 erracctmp, wgt, wgtcompmask;
888 int dx, dy, tmp, xdir, y0p1, x0pxdir;
935 return (
vlineRGBA(renderer, x1, y1, y2, r, g, b, a));
938 return (
vlineRGBA(renderer, x1, yy0, yy0+dy, r, g, b, a));
940 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
943 }
else if (dy == 0) {
949 return (
hlineRGBA(renderer, x1, x2, y1, r, g, b, a));
952 return (
hlineRGBA(renderer, xx0, xx0+dx, y1, r, g, b, a));
954 return (
pixelRGBA(renderer, x1, y1, r, g, b, a));
957 }
else if ((dx == dy) && (draw_endpoint)) {
961 return (
lineRGBA(renderer, x1, y1, x2, y2, r, g, b, a));
988 result |=
pixelRGBA(renderer, x1, y1, r, g, b, a);
1003 erradj = ((dx << 16) / dy) << 16;
1008 x0pxdir = xx0 + xdir;
1012 if (erracc <= erracctmp) {
1026 wgt = (erracc >> intshift) & 255;
1027 result |=
pixelRGBAWeight (renderer, xx0, yy0, r, g, b, a, 255 - wgt);
1041 erradj = ((dy << 16) / dx) << 16;
1051 if (erracc <= erracctmp) {
1064 wgt = (erracc >> intshift) & 255;
1065 result |=
pixelRGBAWeight (renderer, xx0, yy0, r, g, b, a, 255 - wgt);
1073 if (draw_endpoint) {
1078 result |=
pixelRGBA (renderer, x2, y2, r, g, b, a);
1096 int aalineColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
1098 Uint8 *c = (Uint8 *)&color;
1099 return _aalineRGBA(renderer, x1, y1, x2, y2, c[0], c[1], c[2], c[3], 1);
1117 int aalineRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1119 return _aalineRGBA(renderer, x1, y1, x2, y2, r, g, b, a, 1);
1135 int circleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
1137 Uint8 *c = (Uint8 *)&color;
1138 return ellipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
1155 int circleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1157 return ellipseRGBA(renderer, x, y, rad, rad, r, g, b, a);
1175 int arcColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
1177 Uint8 *c = (Uint8 *)&color;
1178 return arcRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3]);
1198 int arcRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1203 Sint16 df = 1 - rad;
1205 Sint16 d_se = -2 * rad + 5;
1206 Sint16 xpcx, xmcx, xpcy, xmcy;
1207 Sint16 ypcy, ymcy, ypcx, ymcx;
1209 int startoct, endoct, oct, stopval_start = 0, stopval_end = 0;
1210 double dstart, dend, temp = 0.;
1223 return (
pixelRGBA(renderer, x, y, r, g, b, a));
1252 while (start < 0) start += 360;
1253 while (end < 0) end += 360;
1258 startoct = start / 45;
1264 oct = (oct + 1) % 8;
1266 if (oct == startoct) {
1268 dstart = (double)start;
1273 temp = sin(dstart *
M_PI / 180.);
1277 temp = cos(dstart *
M_PI / 180.);
1281 temp = -cos(dstart *
M_PI / 180.);
1285 temp = -sin(dstart *
M_PI / 180.);
1289 stopval_start = (int)temp;
1297 if (oct % 2) drawoct |= (1 << oct);
1298 else drawoct &= 255 - (1 << oct);
1300 if (oct == endoct) {
1307 temp = sin(dend *
M_PI / 180);
1311 temp = cos(dend *
M_PI / 180);
1315 temp = -cos(dend *
M_PI / 180);
1319 temp = -sin(dend *
M_PI / 180);
1323 stopval_end = (int)temp;
1326 if (startoct == endoct) {
1334 drawoct &= 255 - (1 << oct);
1337 else if (oct % 2) drawoct &= 255 - (1 << oct);
1338 else drawoct |= (1 << oct);
1339 }
else if (oct != startoct) {
1340 drawoct |= (1 << oct);
1342 }
while (oct != endoct);
1350 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
1351 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
1364 if (drawoct & 4) result |=
pixel(renderer, xmcx, ypcy);
1365 if (drawoct & 2) result |=
pixel(renderer, xpcx, ypcy);
1366 if (drawoct & 32) result |=
pixel(renderer, xmcx, ymcy);
1367 if (drawoct & 64) result |=
pixel(renderer, xpcx, ymcy);
1369 if (drawoct & 96) result |=
pixel(renderer, x, ymcy);
1370 if (drawoct & 6) result |=
pixel(renderer, x, ypcy);
1375 if (cx > 0 && cx != cy) {
1378 if (drawoct & 8) result |=
pixel(renderer, xmcy, ypcx);
1379 if (drawoct & 1) result |=
pixel(renderer, xpcy, ypcx);
1380 if (drawoct & 16) result |=
pixel(renderer, xmcy, ymcx);
1381 if (drawoct & 128) result |=
pixel(renderer, xpcy, ymcx);
1382 }
else if (cx == 0) {
1383 if (drawoct & 24) result |=
pixel(renderer, xmcy, y);
1384 if (drawoct & 129) result |=
pixel(renderer, xpcy, y);
1390 if (stopval_start == cx) {
1393 if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);
1394 else drawoct |= (1 << startoct);
1396 if (stopval_end == cx) {
1397 if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
1398 else drawoct |= (1 << endoct);
1433 int aacircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
1435 Uint8 *c = (Uint8 *)&color;
1436 return aaellipseRGBA(renderer, x, y, rad, rad, c[0], c[1], c[2], c[3]);
1453 int aacircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1475 int _drawQuadrants(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 dx, Sint16 dy, Sint32 f)
1483 result |=
pixel(renderer, x, y);
1488 result |=
vline(renderer, x, ymdy, ypdy);
1490 result |=
pixel(renderer, x, ypdy);
1491 result |=
pixel(renderer, x, ymdy);
1500 result |=
vline(renderer, xpdx, ymdy, ypdy);
1501 result |=
vline(renderer, xmdx, ymdy, ypdy);
1503 result |=
pixel(renderer, xpdx, ypdy);
1504 result |=
pixel(renderer, xmdx, ypdy);
1505 result |=
pixel(renderer, xpdx, ymdy);
1506 result |=
pixel(renderer, xmdx, ymdy);
1529 #define ELLIPSE_OVERSCAN 4
1530 int _ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Sint32 f)
1533 Sint32 rx2, ry2, rx22, ry22;
1535 Sint32 curX, curY, curXp1, curYm1;
1536 Sint32 scrX, scrY, oldX, oldY;
1537 Sint32 deltaX, deltaY;
1542 if ((rx < 0) || (ry < 0)) {
1550 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
1551 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
1558 return (
pixel(renderer, x, y));
1560 return (
vline(renderer, x, y - ry, y + ry));
1564 return (
hline(renderer, x - rx, x + rx, y));
1585 deltaY = rx22 * curY;
1588 error = ry2 - rx2 * ry + rx2 / 4;
1589 while (deltaX <= deltaY)
1594 error += deltaX + ry2;
1604 if ((scrX != oldX && scrY == oldY) || (scrX != oldX && scrY != oldY)) {
1616 error = ry2 * curX * curXp1 + ((ry2 + 3) / 4) + rx2 * curYm1 * curYm1 - rx2 * ry2;
1634 if ((scrX != oldX && scrY == oldY) || (scrX != oldX && scrY != oldY)) {
1636 for (;oldY >= scrY; oldY--) {
1651 for (;oldY >= 0; oldY--) {
1672 int ellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
1674 Uint8 *c = (Uint8 *)&color;
1675 return _ellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3], 0);
1693 int ellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1695 return _ellipseRGBA(renderer, x, y, rx, ry, r, g, b, a, 0);
1713 Uint8 *c = (Uint8 *)&color;
1731 int filledCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1733 return _ellipseRGBA(renderer, x, y, rad, rad, r, g ,b, a, 1);
1740 #if defined(_MSC_VER)
1743 #include <emmintrin.h>
1744 static __inline
long
1747 return _mm_cvtss_si32(_mm_load_ss(&f));
1749 #elif defined(_M_IX86)
1761 #elif defined(_M_ARM)
1762 #include <armintr.h>
1763 #pragma warning(push)
1764 #pragma warning(disable: 4716)
1765 __declspec(naked) long
int
1773 #pragma warning(pop)
1775 #error lrint needed for MSVC on non X86/AMD64/ARM targets.
1791 int aaellipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
1793 Uint8 *c = (Uint8 *)&color;
1794 return aaellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3]);
1812 int aaellipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1816 int a2, b2, ds, dt, dxt, t, s, d;
1817 Sint16 xp, yp, xs, ys, dyt, od, xx, yy, xc2, yc2;
1820 Uint8 weight, iweight;
1825 if ((rx < 0) || (ry < 0)) {
1834 return (
pixelRGBA(renderer, x, y, r, g, b, a));
1836 return (
vlineRGBA(renderer, x, y - ry, y + ry, r, g, b, a));
1840 return (
hlineRGBA(renderer, x - rx, x + rx, y, r, g, b, a));
1854 sab = sqrt((
double)(a2 + b2));
1855 od = (Sint16)lrint(sab*0.01) + 1;
1856 dxt = (Sint16)lrint((
double)a2 / sab) + od;
1867 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
1870 result |=
pixelRGBA(renderer, xp, yp, r, g, b, a);
1871 result |=
pixelRGBA(renderer, xc2 - xp, yp, r, g, b, a);
1872 result |=
pixelRGBA(renderer, xp, yc2 - yp, r, g, b, a);
1873 result |=
pixelRGBA(renderer, xc2 - xp, yc2 - yp, r, g, b, a);
1875 for (i = 1; i <= dxt; i++) {
1881 else if ((d - s - a2) > 0) {
1882 if ((2 * d - s - a2) >= 0)
1901 cp = (float) abs(d) / (float) abs(s);
1910 weight = (Uint8) (cp * 255);
1911 iweight = 255 - weight;
1932 dyt = (Sint16)lrint((
double)b2 / sab ) + od;
1934 for (i = 1; i <= dyt; i++) {
1940 else if ((d + t - b2) < 0) {
1941 if ((2 * d + t - b2) <= 0)
1960 cp = (float) abs(d) / (float) abs(t);
1969 weight = (Uint8) (cp * 255);
1970 iweight = 255 - weight;
2009 Uint8 *c = (Uint8 *)&color;
2010 return _ellipseRGBA(renderer, x, y, rx, ry, c[0], c[1], c[2], c[3], 1);
2028 int filledEllipseRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2030 return _ellipseRGBA(renderer, x, y, rx, ry, r, g, b, a, 1);
2055 int _pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 filled)
2058 double angle, start_angle, end_angle;
2074 start = start % 360;
2081 return (
pixelRGBA(renderer, x, y, r, g, b, a));
2088 deltaAngle = 3.0 / dr;
2089 start_angle = (double) start *(2.0 *
M_PI / 360.0);
2090 end_angle = (double) end *(2.0 *
M_PI / 360.0);
2092 end_angle += (2.0 *
M_PI);
2099 angle = start_angle;
2100 while (angle < end_angle) {
2101 angle += deltaAngle;
2106 vx = vy = (Sint16 *) malloc(2 *
sizeof(Uint16) * numpoints);
2119 angle = start_angle;
2120 vx[1] = x + (int) (dr * cos(angle));
2121 vy[1] = y + (int) (dr * sin(angle));
2125 result =
lineRGBA(renderer, vx[0], vy[0], vx[1], vy[1], r, g, b, a);
2131 angle = start_angle;
2132 while (angle < end_angle) {
2133 angle += deltaAngle;
2134 if (angle>end_angle)
2138 vx[i] = x + (int) (dr * cos(angle));
2139 vy[i] = y + (int) (dr * sin(angle));
2147 result =
polygonRGBA(renderer, vx, vy, numpoints, r, g, b, a);
2170 int pieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
2171 Sint16 start, Sint16 end, Uint32 color)
2173 Uint8 *c = (Uint8 *)&color;
2174 return _pieRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3], 0);
2193 int pieRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad,
2194 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2196 return _pieRGBA(renderer, x, y, rad, start, end, r, g, b, a, 0);
2212 int filledPieColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
2214 Uint8 *c = (Uint8 *)&color;
2215 return _pieRGBA(renderer, x, y, rad, start, end, c[0], c[1], c[2], c[3], 1);
2235 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2237 return _pieRGBA(renderer, x, y, rad, start, end, r, g, b, a, 1);
2258 int trigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
2290 int trigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
2291 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2324 int aatrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
2356 int aatrigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
2357 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2390 int filledTrigonColor(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
2424 int filledTrigonRGBA(SDL_Renderer * renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
2425 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2453 int polygonColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint32 color)
2455 Uint8 *c = (Uint8 *)&color;
2456 return polygonRGBA(renderer, vx, vy, n, c[0], c[1], c[2], c[3]);
2469 int polygon(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n)
2499 points = (SDL_Point*)malloc(
sizeof(SDL_Point) * nn);
2506 points[i].x = vx[i];
2507 points[i].y = vy[i];
2509 points[n].x = vx[0];
2510 points[n].y = vy[0];
2515 result |= SDL_RenderDrawLines(renderer, points, nn);
2535 int polygonRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2541 const Sint16 *x1, *y1, *x2, *y2;
2572 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
2573 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
2578 result |=
polygon(renderer, vx, vy, n);
2596 int aapolygonColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint32 color)
2598 Uint8 *c = (Uint8 *)&color;
2599 return aapolygonRGBA(renderer, vx, vy, n, c[0], c[1], c[2], c[3]);
2616 int aapolygonRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2620 const Sint16 *x1, *y1, *x2, *y2;
2651 for (i = 1; i < n; i++) {
2652 result |=
_aalineRGBA(renderer, *x1, *y1, *x2, *y2, r, g, b, a, 0);
2659 result |=
_aalineRGBA(renderer, *x1, *y1, *vx, *vy, r, g, b, a, 0);
2676 return (*(
const int *) a) - (*(
const int *) b);
2684 static int *gfxPrimitivesPolyIntsGlobal = NULL;
2691 static int gfxPrimitivesPolyAllocatedGlobal = 0;
2711 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)
2721 int *gfxPrimitivesPolyInts = NULL;
2722 int *gfxPrimitivesPolyIntsNew = NULL;
2723 int gfxPrimitivesPolyAllocated = 0;
2745 if ((polyInts==NULL) || (polyAllocated==NULL)) {
2747 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
2748 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
2751 gfxPrimitivesPolyInts = *polyInts;
2752 gfxPrimitivesPolyAllocated = *polyAllocated;
2758 if (!gfxPrimitivesPolyAllocated) {
2759 gfxPrimitivesPolyInts = (
int *) malloc(
sizeof(
int) * n);
2760 gfxPrimitivesPolyAllocated = n;
2762 if (gfxPrimitivesPolyAllocated < n) {
2763 gfxPrimitivesPolyIntsNew = (
int *) realloc(gfxPrimitivesPolyInts,
sizeof(
int) * n);
2764 if (!gfxPrimitivesPolyIntsNew) {
2765 if (!gfxPrimitivesPolyInts) {
2766 free(gfxPrimitivesPolyInts);
2767 gfxPrimitivesPolyInts = NULL;
2769 gfxPrimitivesPolyAllocated = 0;
2771 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsNew;
2772 gfxPrimitivesPolyAllocated = n;
2780 if (gfxPrimitivesPolyInts==NULL) {
2781 gfxPrimitivesPolyAllocated = 0;
2787 if ((polyInts==NULL) || (polyAllocated==NULL)) {
2788 gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
2789 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
2791 *polyInts = gfxPrimitivesPolyInts;
2792 *polyAllocated = gfxPrimitivesPolyAllocated;
2798 if (gfxPrimitivesPolyInts==NULL) {
2807 for (i = 1; (i < n); i++) {
2810 }
else if (vy[i] > maxy) {
2819 for (y = miny; (y <= maxy); y++) {
2821 for (i = 0; (i < n); i++) {
2834 }
else if (y1 > y2) {
2842 if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
2843 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
2853 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
2854 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
2856 for (i = 0; (i < ints); i += 2) {
2857 xa = gfxPrimitivesPolyInts[i] + 1;
2858 xa = (xa >> 16) + ((xa & 32768) >> 15);
2859 xb = gfxPrimitivesPolyInts[i+1] - 1;
2860 xb = (xb >> 16) + ((xb & 32768) >> 15);
2861 result |=
hline(renderer, xa, xb, y);
2879 int filledPolygonColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint32 color)
2881 Uint8 *c = (Uint8 *)&color;
2899 int filledPolygonRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2921 int _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)
2926 int texture_x_walker;
2927 int texture_y_start;
2928 SDL_Rect source_rect,dst_rect;
2929 int pixels_written,write_width;
2948 texture_x_walker = (x1 - texture_dx) % texture_w;
2949 if (texture_x_walker < 0){
2950 texture_x_walker = texture_w + texture_x_walker ;
2953 texture_y_start = (y + texture_dy) % texture_h;
2954 if (texture_y_start < 0){
2955 texture_y_start = texture_h + texture_y_start;
2959 source_rect.y = texture_y_start;
2960 source_rect.x = texture_x_walker;
2969 if (w <= texture_w -texture_x_walker){
2971 source_rect.x = texture_x_walker;
2973 dst_rect.w = source_rect.w;
2974 result = (SDL_RenderCopy(renderer, texture, &source_rect, &dst_rect) == 0);
2978 pixels_written = texture_w - texture_x_walker;
2979 source_rect.w = pixels_written;
2980 source_rect.x = texture_x_walker;
2982 dst_rect.w = source_rect.w;
2983 result |= (SDL_RenderCopy(renderer, texture, &source_rect, &dst_rect) == 0);
2984 write_width = texture_w;
2989 while (pixels_written < w){
2990 if (write_width >= w - pixels_written) {
2991 write_width = w - pixels_written;
2993 source_rect.w = write_width;
2994 dst_rect.x = x1 + pixels_written;
2995 dst_rect.w = source_rect.w;
2996 result |= (SDL_RenderCopy(renderer, texture, &source_rect, &dst_rect) == 0);
2997 pixels_written += write_width;
3021 SDL_Surface * texture,
int texture_dx,
int texture_dy,
int **polyInts,
int *polyAllocated)
3026 int minx,maxx,miny, maxy;
3031 int *gfxPrimitivesPolyInts = NULL;
3032 int *gfxPrimitivesPolyIntsTemp = NULL;
3033 int gfxPrimitivesPolyAllocated = 0;
3034 SDL_Texture *textureAsTexture = NULL;
3046 if ((polyInts==NULL) || (polyAllocated==NULL)) {
3048 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
3049 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
3052 gfxPrimitivesPolyInts = *polyInts;
3053 gfxPrimitivesPolyAllocated = *polyAllocated;
3059 if (!gfxPrimitivesPolyAllocated) {
3060 gfxPrimitivesPolyInts = (
int *) malloc(
sizeof(
int) * n);
3061 gfxPrimitivesPolyAllocated = n;
3063 if (gfxPrimitivesPolyAllocated < n) {
3064 gfxPrimitivesPolyIntsTemp = (
int *) realloc(gfxPrimitivesPolyInts,
sizeof(
int) * n);
3065 if (gfxPrimitivesPolyIntsTemp == NULL) {
3069 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsTemp;
3070 gfxPrimitivesPolyAllocated = n;
3077 if (gfxPrimitivesPolyInts==NULL) {
3078 gfxPrimitivesPolyAllocated = 0;
3084 if ((polyInts==NULL) || (polyAllocated==NULL)) {
3085 gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
3086 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
3088 *polyInts = gfxPrimitivesPolyInts;
3089 *polyAllocated = gfxPrimitivesPolyAllocated;
3095 if (gfxPrimitivesPolyInts==NULL) {
3106 for (i = 1; (i < n); i++) {
3109 }
else if (vy[i] > maxy) {
3114 }
else if (vx[i] > maxx) {
3120 textureAsTexture = SDL_CreateTextureFromSurface(renderer, texture);
3121 if (textureAsTexture == NULL)
3125 SDL_SetTextureBlendMode(textureAsTexture, SDL_BLENDMODE_BLEND);
3131 for (y = miny; (y <= maxy); y++) {
3133 for (i = 0; (i < n); i++) {
3146 }
else if (y1 > y2) {
3154 if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
3155 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
3161 for (i = 0; (i < ints); i += 2) {
3162 xa = gfxPrimitivesPolyInts[i] + 1;
3163 xa = (xa >> 16) + ((xa & 32768) >> 15);
3164 xb = gfxPrimitivesPolyInts[i+1] - 1;
3165 xb = (xb >> 16) + ((xb & 32768) >> 15);
3166 result |=
_HLineTextured(renderer, xa, xb, y, textureAsTexture, texture->w, texture->h, texture_dx, texture_dy);
3170 SDL_RenderPresent(renderer);
3171 SDL_DestroyTexture(textureAsTexture);
3192 int texturedPolygon(SDL_Renderer *renderer,
const Sint16 * vx,
const Sint16 * vy,
int n, SDL_Surface *texture,
int texture_dx,
int texture_dy)
3197 return (
texturedPolygonMT(renderer, vx, vy, n, texture, texture_dx, texture_dy, NULL, NULL));
3205 static SDL_Texture *gfxPrimitivesFont[256];
3210 static const unsigned char *currentFontdata = gfxPrimitivesFontdata;
3215 static Uint32 charWidth = 8;
3220 static Uint32 charHeight = 8;
3225 static Uint32 charWidthLocal = 8;
3230 static Uint32 charHeightLocal = 8;
3235 static Uint32 charPitch = 1;
3240 static Uint32 charRotation = 0;
3245 static Uint32 charSize = 8;
3264 if ((fontdata) && (cw) && (ch)) {
3265 currentFontdata = (
unsigned char *)fontdata;
3269 currentFontdata = gfxPrimitivesFontdata;
3274 charPitch = (charWidth+7)/8;
3275 charSize = charPitch * charHeight;
3278 if ((charRotation==1) || (charRotation==3))
3280 charWidthLocal = charHeight;
3281 charHeightLocal = charWidth;
3285 charWidthLocal = charWidth;
3286 charHeightLocal = charHeight;
3290 for (i = 0; i < 256; i++) {
3291 if (gfxPrimitivesFont[i]) {
3292 SDL_DestroyTexture(gfxPrimitivesFont[i]);
3293 gfxPrimitivesFont[i] = NULL;
3310 rotation = rotation & 3;
3311 if (charRotation != rotation)
3314 charRotation = rotation;
3317 if ((charRotation==1) || (charRotation==3))
3319 charWidthLocal = charHeight;
3320 charHeightLocal = charWidth;
3324 charWidthLocal = charWidth;
3325 charHeightLocal = charHeight;
3329 for (i = 0; i < 256; i++) {
3330 if (gfxPrimitivesFont[i]) {
3331 SDL_DestroyTexture(gfxPrimitivesFont[i]);
3332 gfxPrimitivesFont[i] = NULL;
3352 int characterRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y,
char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3358 const unsigned char *charpos;
3363 SDL_Surface *character;
3364 SDL_Surface *rotatedCharacter;
3372 srect.w = charWidthLocal;
3373 srect.h = charHeightLocal;
3380 drect.w = charWidthLocal;
3381 drect.h = charHeightLocal;
3384 ci = (
unsigned char) c;
3390 if (gfxPrimitivesFont[ci] == NULL) {
3394 character = SDL_CreateRGBSurface(SDL_SWSURFACE,
3395 charWidth, charHeight, 32,
3396 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
3397 if (character == NULL) {
3401 charpos = currentFontdata + ci * charSize;
3402 linepos = (Uint8 *)character->pixels;
3403 pitch = character->pitch;
3409 for (iy = 0; iy < charHeight; iy++) {
3412 for (ix = 0; ix < charWidth; ix++) {
3413 if (!(mask >>= 1)) {
3418 *(Uint32 *)curpos = 0xffffffff;
3420 *(Uint32 *)curpos = 0;
3431 SDL_FreeSurface(character);
3432 character = rotatedCharacter;
3436 gfxPrimitivesFont[ci] = SDL_CreateTextureFromSurface(renderer, character);
3437 SDL_FreeSurface(character);
3442 if (gfxPrimitivesFont[ci] == NULL) {
3451 result |= SDL_SetTextureColorMod(gfxPrimitivesFont[ci], r, g, b);
3452 result |= SDL_SetTextureAlphaMod(gfxPrimitivesFont[ci], a);
3457 result |= SDL_RenderCopy(renderer, gfxPrimitivesFont[ci], &srect, &drect);
3474 int characterColor(SDL_Renderer * renderer, Sint16 x, Sint16 y,
char c, Uint32 color)
3476 Uint8 *co = (Uint8 *)&color;
3477 return characterRGBA(renderer, x, y, c, co[0], co[1], co[2], co[3]);
3495 int stringColor(SDL_Renderer * renderer, Sint16 x, Sint16 y,
const char *s, Uint32 color)
3497 Uint8 *c = (Uint8 *)&color;
3498 return stringRGBA(renderer, x, y, s, c[0], c[1], c[2], c[3]);
3515 int stringRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y,
const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3520 const char *curchar = s;
3522 while (*curchar && !result) {
3523 result |=
characterRGBA(renderer, curx, cury, *curchar, r, g, b, a);
3524 switch (charRotation)
3527 curx += charWidthLocal;
3530 curx -= charWidthLocal;
3533 cury += charHeightLocal;
3536 cury -= charHeightLocal;
3560 double blend,muk,munk;
3566 if (t>=(
double)ndata) {
3567 return(data[ndata-1]);
3577 munk = pow(1-mu,(
double)n);
3578 for (k=0;k<=n;k++) {
3589 blend /= (double)kn;
3593 blend /= (double)nkn;
3597 result += data[k] * blend;
3615 int bezierColor(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
int s, Uint32 color)
3617 Uint8 *c = (Uint8 *)&color;
3618 return bezierRGBA(renderer, vx, vy, n, s, c[0], c[1], c[2], c[3]);
3636 int bezierRGBA(SDL_Renderer * renderer,
const Sint16 * vx,
const Sint16 * vy,
int n,
int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3640 double *x, *y, t, stepsize;
3641 Sint16 x1, y1, x2, y2;
3656 stepsize=(double)1.0/(
double)s;
3659 if ((x=(
double *)malloc(
sizeof(
double)*(n+1)))==NULL) {
3662 if ((y=(
double *)malloc(
sizeof(
double)*(n+1)))==NULL) {
3666 for (i=0; i<n; i++) {
3677 result |= SDL_SetRenderDrawBlendMode(renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
3678 result |= SDL_SetRenderDrawColor(renderer, r, g, b, a);
3686 for (i = 0; i <= (n*s); i++) {
3690 result |=
line(renderer, x1, y1, x2, y2);
3716 int thickLineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
3718 Uint8 *c = (Uint8 *)&color;
3719 return thickLineRGBA(renderer, x1, y1, x2, y2, width, c[0], c[1], c[2], c[3]);
3738 int thickLineRGBA(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
3741 double dx, dy, dx1, dy1, dx2, dy2;
3742 double l, wl2, nx, ny, ang, adj;
3743 Sint16 px[4], py[4];
3745 if (renderer == NULL) {
3754 if ((x1 == x2) && (y1 == y2)) {
3756 return boxRGBA(renderer, x1 - wh, y1 - wh, x2 + width, y2 + width, r, g, b, a);
3761 return lineRGBA(renderer, x1, y1, x2, y2, r, g, b, a);
3765 dx = (double)(x2 - x1);
3766 dy = (double)(y2 - y1);
3767 l = SDL_sqrt(dx*dx + dy*dy);
3768 ang = SDL_atan2(dx, dy);
3769 adj = 0.1 + 0.9 * SDL_fabs(SDL_cos(2.0 * ang));
3770 wl2 = ((double)width - adj)/(2.0 * l);
3779 px[0] = (Sint16)(dx1 + ny);
3780 px[1] = (Sint16)(dx1 - ny);
3781 px[2] = (Sint16)(dx2 - ny);
3782 px[3] = (Sint16)(dx2 + ny);
3783 py[0] = (Sint16)(dy1 - nx);
3784 py[1] = (Sint16)(dy1 + nx);
3785 py[2] = (Sint16)(dy2 + nx);
3786 py[3] = (Sint16)(dy2 - nx);
int polygonColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
Draw polygon with alpha blending.
int filledPieColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
Draw filled pie with alpha blending.
int line(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
Draw line with alpha blending using the currently set color.
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.
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).
int 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 boxColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw box (filled rectangle) with blending.
int pixelColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint32 color)
Draw pixel with blending enabled if a<255.
The structure passed to the internal Murphy iterator.
int ellipseRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw ellipse with blending.
int 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.
int 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.
The structure passed to the internal Bresenham iterator.
int arcColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
Arc with blending.
int 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 filledPolygonColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
Draw filled polygon with alpha blending.
void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch)
Sets or resets the current global font data.
int pixelRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw pixel with blending enabled if a<255.
int ellipseColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
Draw ellipse with blending.
int roundedRectangleColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
Draw rounded-corner rectangle with blending.
int 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.
int 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.
int polygon(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n)
Draw polygon with the currently set color and blend mode.
int circleColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
Draw circle with blending.
int hlineRGBA(SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw horizontal line with blending.
int rectangleColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw rectangle with blending.
int 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.
int 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.
int aapolygonColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
Draw anti-aliased polygon with alpha blending.
int 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.
int pixel(SDL_Renderer *renderer, Sint16 x, Sint16 y)
Draw pixel in currently set color.
int aacircleColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
Draw anti-aliased circle with blending.
int filledCircleColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
Draw filled circle with blending.
int 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 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.
int 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.
int _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.
double _evaluateBezier(double *data, int ndata, double t)
Internal function to calculate bezier interpolator of data array with ndata values at position 't'...
int aalineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw anti-aliased line with alpha blending.
void gfxPrimitivesSetFontRotation(Uint32 rotation)
Sets current global font character rotation steps.
int 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.
int lineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
Draw line with alpha blending.
int 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.
int circleRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw circle with blending.
int _gfxPrimitivesCompareInt(const void *a, const void *b)
Internal helper qsort callback functions used in filled polygon drawing.
int _ellipseRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Sint32 f)
int hlineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
Draw horizontal line with blending.
int stringColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, const char *s, Uint32 color)
Draw a string in the currently set font.
int rectangleRGBA(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw rectangle with blending.
int 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.
int vline(SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2)
Draw vertical line in currently set color.
int 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 filledCircleRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw filled circle with blending.
int 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.
int 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.
int 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 _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.
int 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.
int 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.
int thickLineColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
Draw a thick line with alpha blending.
int 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).
int characterColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, char c, Uint32 color)
Draw a character of the currently set font.
int bezierColor(SDL_Renderer *renderer, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
Draw a bezier curve with alpha blending.
int _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.
int filledEllipseColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
Draw filled ellipse with blending.
int hline(SDL_Renderer *renderer, Sint16 x1, Sint16 x2, Sint16 y)
Draw horizontal line in currently set color.
int 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.
int pieColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
Draw pie (outline) with alpha blending.
#define ELLIPSE_OVERSCAN
Internal function to draw ellipse or filled ellipse with blending.
int 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.
int vlineRGBA(SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Draw vertical line with blending.
int 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.
int roundedBoxColor(SDL_Renderer *renderer, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
Draw rounded-corner box (filled rectangle) with blending.
int 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.
int aaellipseColor(SDL_Renderer *renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
Draw anti-aliased ellipse with blending.
int vlineColor(SDL_Renderer *renderer, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
Draw vertical line with blending.
int 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.
SDL_Surface * rotateSurface90Degrees(SDL_Surface *src, int numClockwiseTurns)
Rotates a 8/16/24/32 bit surface in increments of 90 degrees.