File: sdlgfx.py

package info (click to toggle)
pysdl2 0.9.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,328 kB
  • sloc: python: 24,685; makefile: 36; sh: 8
file content (1767 lines) | stat: -rw-r--r-- 77,357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
import os
from ctypes import Structure, POINTER, c_int, c_float, c_void_p, c_char, \
    c_char_p, c_double
from ctypes import POINTER as _P
from .dll import DLL, SDLFunc, AttributeDict
from .stdinc import Uint8, Uint32, Sint16
from .render import SDL_Renderer
from .surface import SDL_Surface

# NOTE: This module is currently missing wrappers for the image filtering
# functions in SDL2_imageFilter.h. However, because we have Pillow on Python
# this isn't really a pressing concern. Time permitting, these functions may
# be wrapped at a later date for the sake of completeness.

__all__ = [
    # Constants
    "FPS_UPPER_LIMIT", "FPS_LOWER_LIMIT", "FPS_DEFAULT",
    "SDL2_GFXPRIMITIVES_MAJOR", "SDL2_GFXPRIMITIVES_MAJOR",
    "SDL2_GFXPRIMITIVES_MICRO", "SMOOTHING_OFF", "SMOOTHING_ON",

    # Structs
    "FPSManager",

    # Python Functions
    "get_dll_file"
]


try:
    dll = DLL("SDL2_gfx", ["SDL2_gfx", "SDL2_gfx-1.0"],
              os.getenv("PYSDL2_DLL_PATH"))
except RuntimeError as exc:
    raise ImportError(exc)


def get_dll_file():
    """Gets the file name of the loaded SDL2_gfx library."""
    return dll.libfile

_bind = dll.bind_function


# Constants, enums, type definitions, and macros

SDL2_GFXPRIMITIVES_MAJOR = 1
SDL2_GFXPRIMITIVES_MINOR = 0
SDL2_GFXPRIMITIVES_MICRO = 4

FPS_UPPER_LIMIT = 200
FPS_LOWER_LIMIT = 1
FPS_DEFAULT = 30

SMOOTHING_OFF = 0
SMOOTHING_ON = 1

class FPSManager(Structure):
    """A structure holding the state and timing of the framerate manager.

    This class can be used with other SDL_gfx functions to set a custom
    framerate within a given rendering loop. When used with
    :func:`SDL_framerateDelay`, it uses its initial frame onset time
    (:attr:`baseticks`) and the duration per frame to try to present frames
    at consistent intervals from that initial point.

    After an FPSManager is created, it needs to be initialized with
    :func:`SDL_initFramerate` before it can be used.

    .. note::
        This method of frame pacing may not play nicely with vsync in SDL2.

    Attributes:
        framecount (int): The number of frames counted by the manager since
            being initialized.
        rateticks (float): The time delay (in ms) between each frame.
        baseticks (int): The milliseconds since SDL initialization at which the
            manager was initialized with :func:`SDL_initFramerate`. Used
            internally as the initial frame onset time.
        lastticks (int): The milliseconds since SDL initialization at which the
            previous frame was displayed.
        rate (int): The framerate (in Hz) of the manager.

    """
    _fields_ = [
        ("framecount", Uint32),
        ("rateticks", c_float),
        ("baseticks", Uint32),
        ("lastticks", Uint32),
        ("rate", Uint32),
    ]


# Raw ctypes function definitions

_funcdefs = [
    SDLFunc("SDL_initFramerate", [_P(FPSManager)]),
    SDLFunc("SDL_setFramerate", [_P(FPSManager), Uint32], c_int),
    SDLFunc("SDL_getFramerate", [_P(FPSManager)], c_int),
    SDLFunc("SDL_getFramecount", [_P(FPSManager)], Uint32),
    SDLFunc("SDL_framerateDelay", [_P(FPSManager)], Uint32),
    SDLFunc("pixelColor", [_P(SDL_Renderer), Sint16, Sint16, Uint32], c_int),
    SDLFunc("pixelRGBA", [_P(SDL_Renderer), Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("hlineColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("hlineRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("vlineColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("vlineRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("rectangleColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("rectangleRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("roundedRectangleColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("roundedRectangleRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("boxColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("boxRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("roundedBoxColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("roundedBoxRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("lineColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("lineRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("aalineColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("aalineRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("thickLineColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint32], c_int),
    SDLFunc("thickLineRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("circleColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("circleRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("arcColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("arcRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("aacircleColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("aacircleRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("filledCircleColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("filledCircleRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("ellipseColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("ellipseRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("aaellipseColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("aaellipseRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("filledEllipseColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("filledEllipseRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("pieColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("pieRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("filledPieColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("filledPieRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("trigonColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("trigonRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("aatrigonColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("aatrigonRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("filledTrigonColor", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Uint32], c_int),
    SDLFunc("filledTrigonRGBA", [_P(SDL_Renderer), Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("polygonColor", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, Uint32], c_int),
    SDLFunc("polygonRGBA", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("aapolygonColor", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, Uint32], c_int),
    SDLFunc("aapolygonRGBA", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("filledPolygonColor", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, Uint32], c_int),
    SDLFunc("filledPolygonRGBA", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("texturedPolygon", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, _P(SDL_Surface), c_int, c_int], c_int),
    SDLFunc("bezierColor", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, c_int, Uint32], c_int),
    SDLFunc("bezierRGBA", [_P(SDL_Renderer), _P(Sint16), _P(Sint16), c_int, c_int, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("gfxPrimitivesSetFont", [c_void_p, Uint32, Uint32]),
    SDLFunc("gfxPrimitivesSetFontRotation", [Uint32]),
    SDLFunc("characterColor", [_P(SDL_Renderer), Sint16, Sint16, c_char, Uint32], c_int),
    SDLFunc("characterRGBA", [_P(SDL_Renderer), Sint16, Sint16, c_char, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("stringColor", [_P(SDL_Renderer), Sint16, Sint16, c_char_p, Uint32], c_int),
    SDLFunc("stringRGBA", [_P(SDL_Renderer), Sint16, Sint16, c_char_p, Uint8, Uint8, Uint8, Uint8], c_int),
    SDLFunc("rotozoomSurface", [_P(SDL_Surface), c_double, c_double, c_int], _P(SDL_Surface)),
    SDLFunc("rotozoomSurfaceXY", [_P(SDL_Surface), c_double, c_double, c_double, c_int], _P(SDL_Surface)),
    SDLFunc("rotozoomSurfaceSize", [c_int, c_int, c_double, c_double, _P(c_int), _P(c_int)]),
    SDLFunc("rotozoomSurfaceSizeXY", [c_int, c_int, c_double, c_double, c_double, _P(c_int), _P(c_int)]),
    SDLFunc("zoomSurface", [_P(SDL_Surface), c_double, c_double, c_int], _P(SDL_Surface)),
    SDLFunc("zoomSurfaceSize", [c_int, c_int, c_double, c_double, _P(c_int), _P(c_int)]),
    SDLFunc("shrinkSurface", [_P(SDL_Surface), c_int, c_int], _P(SDL_Surface)),
    SDLFunc("rotateSurface90Degrees", [_P(SDL_Surface), c_int], _P(SDL_Surface)),
]
_ctypes = AttributeDict()
for f in _funcdefs:
    _ctypes[f.name] = _bind(f.name, f.args, f.returns, f.added)
    __all__.append(f.name) # Add all bound functions to module namespace


# Python wrapper functions

def SDL_initFramerate(manager):
    """Initializes a framerate manager.

    Calling this function on an :class:`FPSManager` initializes it with a
    default framerate of 30 Hz and prepares it for counting and timing frames.
    If the manager was already initialized, calling this function will reset
    its framecount, initial frame onset time, and framerate.

    Args:
        manager (:obj:`sdlgfx.FPSManager`): The framerate manager to initialize.

    """
    return _ctypes.SDL_initFramerate(manager)

def SDL_setFramerate(manager, rate):
    """Sets the framerate of a framerate manager.

    Sets a new framerate for the manager, resetting both the framecount and the
    the initial frame onset time. Framerates must be between ``FPS_LOWER_LIMIT``
    (1) and ``FPS_UPPER_LIMIT`` (200), inclusive, to be accepted.

    Args:
        manager (:obj:`sdlgfx.FPSManager`): The framerate manager to configure.
        rate (int): The new framerate in Hz.

    Returns:
        int: 0 on success, or -1 if an error occurred.

    """
    return _ctypes["SDL_setFramerate"](manager, rate)

def SDL_getFramerate(manager):
    """Gets the current framerate for a framerate manager.

    Args:
        manager (:obj:`sdlgfx.FPSManager`): The framerate manager for which the
            currently set framerate will be retrieved.

    Returns:
        int: 0 on success, or -1 if an error occurred.

    """
    return _ctypes["SDL_getFramerate"](manager)

def SDL_getFramecount(manager):
    """Gets the current number of frames counted by a framerate manager.

    .. note::
        This value is reset whenever a frame is dropped (i.e. the rendering
        loop takes longer than the set interval between frames) or the framerate
        is changed.

    Args:
        manager (:obj:`sdlgfx.FPSManager`): The framerate manager for which the
            current framecount will be retrieved.

    Returns:
        int: 0 on success, or -1 if an error occurred.

    """
    return _ctypes["SDL_getFramecount"](manager)

def SDL_framerateDelay(manager):
    """Delays execution until the next frame occurs.

    This function waits for the next frame onset (as determined by the rate set
    by :func:`SDL_setFramerate`) to keep frame pacing consistent. This should be
    called once per loop within the program's main rendering loop.
    
    If the rendering loop takes longer than the set framerate, the delay will be
    zero and the framecount and initial frame onset time will be reset.

    Args:
        manager (:obj:`sdlgfx.FPSManager`): The framerate manager to use for
            frame pacing.

    Returns:
        int: 0 on success, or -1 if an error occurred.

    """
    return _ctypes["SDL_framerateDelay"](manager)


def pixelColor(renderer, x, y, color):
    """Draws a single pixel to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X (horizontal) coordinate of the pixel.
        y (int): The Y (vertical) coordinate of the pixel.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["pixelColor"](renderer, x, y, color)

def pixelRGBA(renderer, x, y, r, g, b, a):
    """Draws a single pixel to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X (horizontal) coordinate of the pixel.
        y (int): The Y (vertical) coordinate of the pixel.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["pixelRGBA"](renderer, x, y, r, g, b, a)

def hlineColor(renderer, x1, x2, y, color):
    """Draws a horizontal line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y (int): The Y (vertical) coordinate of the points of the line.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["hlineColor"](renderer, x1, x2, y, color)

def hlineRGBA(renderer, x1, x2, y, r, g, b, a):
    """Draws a horizontal line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y (int): The Y coordinate of the points of the line.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["hlineRGBA"](renderer, x1, x2, y, r, g, b, a)

def vlineColor(renderer, x, y1, y2, color):
    """Draws a vertical line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the points of the line.
        y1 (int): The X coordinate of the first point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["vlineColor"](renderer, x, y1, y2, color)

def vlineRGBA(renderer, x, y1, y2, r, g, b, a):
    """Draws a vertical line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the points of the line.
        y1 (int): The X coordinate of the first point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["vlineRGBA"](renderer, x, y1, y2, r, g, b, a)


def rectangleColor(renderer, x1, y1, x2, y2, color):
    """Draws an unfilled rectangle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["rectangleColor"](renderer, x1, y1, x2, y2, color)

def rectangleRGBA(renderer, x1, y1, x2, y2, r, g, b, a):
    """Draws an unfilled rectangle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["rectangleRGBA"](renderer, x1, y1, x2, y2, r, g, b, a)

def roundedRectangleColor(renderer, x1, y1, x2, y2, rad, color):
    """Draws an unfilled rectangle with rounded corners to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        rad (int): The radius of the arc of the rounded corners.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["roundedRectangleColor"](renderer, x1, y1, x2, y2, rad, color)

def roundedRectangleRGBA(renderer, x1, y1, x2, y2, rad, r, g, b, a):
    """Draws an unfilled rectangle with rounded corners to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        rad (int): The radius of the arc of the rounded corners.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["roundedRectangleRGBA"](renderer, x1, y1, x2, y2, rad, r, g, b, a)

def boxColor(renderer, x1, y1, x2, y2, color):
    """Draws a filled rectangle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["boxColor"](renderer, x1, y1, x2, y2, color)

def boxRGBA(renderer, x1, y1, x2, y2, r, g, b, a):
    """Draws a filled rectangle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["boxRGBA"](renderer, x1, y1, x2, y2, r, g, b, a)

def roundedBoxColor(renderer, x1, y1, x2, y2, rad, color):
    """Draws a filled rectangle with rounded corners to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        rad (int): The radius of the arc of the rounded corners.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["roundedBoxColor"](renderer, x1, y1, x2, y2, rad, color)

def roundedBoxRGBA(renderer, x1, y1, x2, y2, rad, r, g, b, a):
    """Draws a filled rectangle with rounded corners to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the top-right point of the rectangle.
        y1 (int): The Y coordinate of the top-right point of the rectangle.
        x2 (int): The X coordinate of the bottom-left point of the rectangle.
        y2 (int): The Y coordinate of the bottom-left point of the rectangle.
        rad (int): The radius of the arc of the rounded corners.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["roundedBoxRGBA"](renderer, x1, y1, x2, y2, rad, r, g, b, a)


def lineColor(renderer, x1, y1, x2, y2, color):
    """Draws a line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        y1 (int): The Y coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["lineColor"](renderer, x1, y1, x2, y2, color)

def lineRGBA(renderer, x1, y1, x2, y2, r, g, b, a):
    """Draws a line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        y1 (int): The Y coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["lineRGBA"](renderer, x1, y1, x2, y2, r, g, b, a)

def aalineColor(renderer, x1, y1, x2, y2, color):
    """Draws an anti-aliased line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        y1 (int): The Y coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aalineColor"](renderer, x1, y1, x2, y2, color)

def aalineRGBA(renderer, x1, y1, x2, y2, r, g, b, a):
    """Draws an anti-aliased line to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        y1 (int): The Y coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aalineRGBA"](renderer, x1, y1, x2, y2, r, g, b, a)

def thickLineColor(renderer, x1, y1, x2, y2, width, color):
    """Draws a line with a given thickness to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        y1 (int): The Y coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        width (int): The thickness of the line in pixels (from 1 to 255).
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["thickLineColor"](renderer, x1, y1, x2, y2, width, color)

def thickLineRGBA(renderer, x1, y1, x2, y2, width, r, g, b, a):
    """Draws a line with a given thickness to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): The X coordinate of the first point of the line.
        y1 (int): The Y coordinate of the first point of the line.
        x2 (int): The X coordinate of the second point of the line.
        y2 (int): The Y coordinate of the second point of the line.
        width (int): The thickness of the line in pixels (from 1 to 255).
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["thickLineRGBA"](renderer, x1, y1, x2, y2, width, r, g, b, a)


def circleColor(renderer, x, y, rad, color):
    """Draws an unfilled circle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["circleColor"](renderer, x, y, rad, color)

def circleRGBA(renderer, x, y, rad, r, g, b, a):
    """Draws an unfilled circle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["circleRGBA"](renderer, x, y, rad, r, g, b, a)

def arcColor(renderer, x, y, rad, start, end, color):
    """Draws an arc to the renderer with a given color.

    The start and end of the arc are defined in units of degrees, with 0 being
    the bottom of the arc circle and increasing counter-clockwise (e.g. 90 being
    the rightmost point of the circle).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        start (int): The start of the arc (in degrees).
        end (int): The end of the arc (in degrees).
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["arcColor"](renderer, x, y, rad, start, end, color)

def arcRGBA(renderer, x, y, rad, start, end, r, g, b, a):
    """Draws an arc to the renderer with a given color.

    The start and end of the arc are defined in units of degrees, with 0 being
    the bottom of the arc circle and increasing counter-clockwise (e.g. 90 being
    the rightmost point of the circle).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        start (int): The start of the arc (in degrees).
        end (int): The end of the arc (in degrees).
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["arcRGBA"](renderer, x, y, rad, start, end, r, g, b, a)

def aacircleColor(renderer, x, y, rad, color):
    """Draws an anti-aliased unfilled circle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aacircleColor"](renderer, x, y, rad, color)

def aacircleRGBA(renderer, x, y, rad, r, g, b, a):
    """Draws an anti-aliased unfilled circle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aacircleRGBA"](renderer, x, y, rad, r, g, b, a)

def filledCircleColor(renderer, x, y, rad, color):
    """Draws a filled circle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledCircleColor"](renderer, x, y, rad, color)

def filledCircleRGBA(renderer, x, y, rad, r, g, b, a):
    """Draws a filled circle to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the circle.
        y (int): The Y coordinate of the center of the circle.
        rad (int): The radius (in pixels) of the circle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledCircleRGBA"](renderer, x, y, rad, r, g, b, a)


def ellipseColor(renderer, x, y, rx, ry, color):
    """Draws an unfilled ellipse to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the ellipse.
        y (int): The Y coordinate of the center of the ellipse.
        rx (int): The x-axis radius (i.e. width) of the ellipse.
        ry (int): The y-axis radius (i.e. height) of the ellipse.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["ellipseColor"](renderer, x, y, rx, ry, color)

def ellipseRGBA(renderer, x, y, rx, ry, r, g, b, a):
    """Draws an unfilled ellipse to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the ellipse.
        y (int): The Y coordinate of the center of the ellipse.
        rx (int): The x-axis radius (i.e. width) of the ellipse.
        ry (int): The y-axis radius (i.e. height) of the ellipse.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["ellipseRGBA"](renderer, x, y, rx, ry, r, g, b, a)

def aaellipseColor(renderer, x, y, rx, ry, color):
    """Draws an anti-aliased unfilled ellipse to the renderer in a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the ellipse.
        y (int): The Y coordinate of the center of the ellipse.
        rx (int): The x-axis radius (i.e. width) of the ellipse.
        ry (int): The y-axis radius (i.e. height) of the ellipse.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aaellipseColor"](renderer, x, y, rx, ry, color)

def aaellipseRGBA(renderer, x, y, rx, ry, r, g, b, a):
    """Draws an anti-aliased unfilled ellipse to the renderer in a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the ellipse.
        y (int): The Y coordinate of the center of the ellipse.
        rx (int): The x-axis radius (i.e. width) of the ellipse.
        ry (int): The y-axis radius (i.e. height) of the ellipse.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aaellipseRGBA"](renderer, x, y, rx, ry, r, g, b, a)

def filledEllipseColor(renderer, x, y, rx, ry, color):
    """Draws a filled ellipse to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the ellipse.
        y (int): The Y coordinate of the center of the ellipse.
        rx (int): The x-axis radius (i.e. width) of the ellipse.
        ry (int): The y-axis radius (i.e. height) of the ellipse.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledEllipseColor"](renderer, x, y, rx, ry, color)

def filledEllipseRGBA(renderer, x, y, rx, ry, r, g, b, a):
    """Draws a filled ellipse to the renderer with a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the ellipse.
        y (int): The Y coordinate of the center of the ellipse.
        rx (int): The x-axis radius (i.e. width) of the ellipse.
        ry (int): The y-axis radius (i.e. height) of the ellipse.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledEllipseRGBA"](renderer, x, y, rx, ry, r, g, b, a)


def pieColor(renderer, x, y, rad, start, end, color):
    """Draws an unfilled pie slice (i.e. circle segment) to the renderer.

    The start and end of the pie are defined in units of degrees, with 0 being
    the bottom of the circle and increasing counter-clockwise (e.g. 90 being
    the rightmost point of the circle).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the pie (circle).
        y (int): The Y coordinate of the center of the pie (circle).
        rad (int): The radius (in pixels) of the pie.
        start (int): Start of the pie slice (in degrees).
        end (int): End of the pie slice (in degrees)
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["pieColor"](renderer, x, y, rad, start, end, color)

def pieRGBA(renderer, x, y, rad, start, end, r, g, b, a):
    """Draws an unfilled pie slice (i.e. circle segment) to the renderer.

    The start and end of the pie are defined in units of degrees, with 0 being
    the bottom of the circle and increasing counter-clockwise (e.g. 90 being
    the rightmost point of the circle).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the pie (circle).
        y (int): The Y coordinate of the center of the pie (circle).
        rad (int): The radius (in pixels) of the pie.
        start (int): Start of the pie slice (in degrees).
        end (int): End of the pie slice (in degrees)
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["pieRGBA"](renderer, x, y, rad, start, end, r, g, b, a)

def filledPieColor(renderer, x, y, rad, start, end, color):
    """Draws a filled pie slice (i.e. circle segment) to the renderer.

    The start and end of the pie are defined in units of degrees, with 0 being
    the bottom of the circle and increasing counter-clockwise (e.g. 90 being
    the rightmost point of the circle).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the pie (circle).
        y (int): The Y coordinate of the center of the pie (circle).
        rad (int): The radius (in pixels) of the pie.
        start (int): Start of the pie slice (in degrees).
        end (int): End of the pie slice (in degrees)
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledPieColor"](renderer, x, y, rad, start, end, color)

def filledPieRGBA(renderer, x, y, rad, start, end, r, g, b, a):
    """Draws a filled pie slice (i.e. circle segment) to the renderer.

    The start and end of the pie are defined in units of degrees, with 0 being
    the bottom of the circle and increasing counter-clockwise (e.g. 90 being
    the rightmost point of the circle).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the center of the pie (circle).
        y (int): The Y coordinate of the center of the pie (circle).
        rad (int): The radius (in pixels) of the pie.
        start (int): Start of the pie slice (in degrees).
        end (int): End of the pie slice (in degrees)
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledPieRGBA"](renderer, x, y, rad, start, end, r, g, b, a)


def trigonColor(renderer, x1, y1, x2, y2, x3, y3, color):
    """Draws a trigon (i.e. triangle outline) to the renderer in a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): X coordinate of the first point of the triangle.
        y1 (int): Y coordinate of the first point of the triangle.
        x2 (int): X coordinate of the second point of the triangle.
        y2 (int): Y coordinate of the second point of the triangle.
        x3 (int): X coordinate of the third point of the triangle.
        y3 (int): Y coordinate of the third point of the triangle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["trigonColor"](renderer, x1, y1, x2, y2, x3, y3, color)

def trigonRGBA(renderer, x1, y1, x2, y2, x3, y3, r, g, b, a):
    """Draws a trigon (i.e. triangle outline) to the renderer in a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): X coordinate of the first point of the triangle.
        y1 (int): Y coordinate of the first point of the triangle.
        x2 (int): X coordinate of the second point of the triangle.
        y2 (int): Y coordinate of the second point of the triangle.
        x3 (int): X coordinate of the third point of the triangle.
        y3 (int): Y coordinate of the third point of the triangle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["trigonRGBA"](renderer, x1, y1, x2, y2, x3, y3, r, g, b, a)

def aatrigonColor(renderer, x1, y1, x2, y2, x3, y3, color):
    """Draws an anti-aliased trigon (i.e. triangle outline) to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): X coordinate of the first point of the triangle.
        y1 (int): Y coordinate of the first point of the triangle.
        x2 (int): X coordinate of the second point of the triangle.
        y2 (int): Y coordinate of the second point of the triangle.
        x3 (int): X coordinate of the third point of the triangle.
        y3 (int): Y coordinate of the third point of the triangle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aatrigonColor"](renderer, x1, y1, x2, y2, x3, y3, color)

def aatrigonRGBA(renderer, x1, y1, x2, y2, x3, y3, r, g, b, a):
    """Draws an anti-aliased trigon (i.e. triangle outline) to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): X coordinate of the first point of the triangle.
        y1 (int): Y coordinate of the first point of the triangle.
        x2 (int): X coordinate of the second point of the triangle.
        y2 (int): Y coordinate of the second point of the triangle.
        x3 (int): X coordinate of the third point of the triangle.
        y3 (int): Y coordinate of the third point of the triangle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aatrigonRGBA"](renderer, x1, y1, x2, y2, x3, y3, r, g, b, a)

def filledTrigonColor(renderer, x1, y1, x2, y2, x3, y3, color):
    """Draws a filled triangle to the renderer in a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): X coordinate of the first point of the triangle.
        y1 (int): Y coordinate of the first point of the triangle.
        x2 (int): X coordinate of the second point of the triangle.
        y2 (int): Y coordinate of the second point of the triangle.
        x3 (int): X coordinate of the third point of the triangle.
        y3 (int): Y coordinate of the third point of the triangle.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledTrigonColor"](renderer, x1, y1, x2, y2, x3, y3, color)

def filledTrigonRGBA(renderer, x1, y1, x2, y2, x3, y3, r, g, b, a):
    """Draws a filled triangle to the renderer in a given color.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x1 (int): X coordinate of the first point of the triangle.
        y1 (int): Y coordinate of the first point of the triangle.
        x2 (int): X coordinate of the second point of the triangle.
        y2 (int): Y coordinate of the second point of the triangle.
        x3 (int): X coordinate of the third point of the triangle.
        y3 (int): Y coordinate of the third point of the triangle.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledTrigonRGBA"](renderer, x1, y1, x2, y2, x3, y3, r, g, b, a)


def polygonColor(renderer, vx, vy, n, color):
    """Draws an unfilled polygon to the renderer in a given color.

    Vertices are specified as ``ctypes.c_int16`` arrays, with two arrays of
    equal size defining the x and y coordinates of the points making up the
    polygon. To create these vertex arrays in Python, you can create lists and
    cast them to ctypes arrays which can be passed directly to the function::

       x_coords = [5, 5, 15, 15]
       y_coords = [5, 10, 10, 5]
       vx = (ctypes.c_int16 * len(x_coords))(*x_coords)
       vy = (ctypes.c_int16 * len(y_coords))(*y_coords)

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["polygonColor"](renderer, vx, vy, n, color)

def polygonRGBA(renderer, vx, vy, n, r, g, b, a):
    """Draws an unfilled polygon to the renderer in a given color.

    See :func:`polygonColor` for more information on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["polygonRGBA"](renderer, vx, vy, n, r, g, b, a)

def aapolygonColor(renderer, vx, vy, n, color):
    """Draws an anti-aliased unfilled polygon to the renderer in a given color.

    See :func:`polygonColor` for more information on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aapolygonColor"](renderer, vx, vy, n, color)

def aapolygonRGBA(renderer, vx, vy, n, r, g, b, a):
    """Draws an anti-aliased unfilled polygon to the renderer in a given color.

    See :func:`polygonColor` for more information on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["aapolygonRGBA"](renderer, vx, vy, n, r, g, b, a)

def filledPolygonColor(renderer, vx, vy, n, color):
    """Draws a filled polygon to the renderer in a given color.

    See :func:`polygonColor` for more information on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledPolygonColor"](renderer, vx, vy, n, color)

def filledPolygonRGBA(renderer, vx, vy, n, r, g, b, a):
    """Draws a filled polygon to the renderer in a given color.

    See :func:`polygonColor` for more information on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["filledPolygonRGBA"](renderer, vx, vy, n, r, g, b, a)

def texturedPolygon(renderer, vx, vy, n, texture, texture_dx, texture_dy):
    """Draws a polygon to the renderer with a given texture.

    The location of the texture is relative to the top-left corner of the
    renderer, as opposed to being relative to the polygon itself. As such,
    both the vertex coordinates and texture coordinates need to be adjusted
    equally to render a polygon with the same texture placement at a different
    location.

    The texture must be associated with the same renderer used to draw the
    polygon.

    See :func:`polygonColor` for more information on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the polygon's vertices.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the polygon's vertices.
        n (int): The number of vertices in the polygon.
        texture (:obj:`SDL_Texture`): The texture with which to fill the
            polygon.
        texture_dx (int): The X offset of the texture relative to the top-left
            corner of the renderer.
        texture_dy (int): The Y offset of the texture relative to the top-left
            corner of the renderer.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["texturedPolygon"](
        renderer, vx, vy, n, texture, texture_dx, texture_dy
    )


def bezierColor(renderer, vx, vy, n, s, color):
    """Draws a Bezier curve to the renderer in a given color.

    The first and last vertex are the start and end points of the Bezier,
    respectively, with the points in between defining the control points of the
    curve. For example, a 3rd order (i.e. cubic) Bezier would be defined using
    4 vertices, with the two middle vertices being the control points.

    See :func:`polygonColor` for more information on creating the vertex arrays
    for this function.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the points of the Bezier curve.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the points of the Bezier curve.
        n (int): The number of points in the bezier curve (minimum of 3).
        s (int): The number of interpolation steps to use when drawing the
            curve (minimum of 2). The higher the value, the smoother the curve.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["bezierColor"](renderer, vx, vy, n, s, color)

def bezierRGBA(renderer, vx, vy, n, s, r, g, b, a):
    """Draws a Bezier curve to the renderer in a given color.

    See :func:`bezierColor` for more details on usage.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the X coordinates
            of the points of the Bezier curve.
        vx (POINTER(:obj:`~ctypes.c_int16`)): Array containing the Y coordinates
            of the points of the Bezier curve.
        n (int): The number of points in the bezier curve (minimum of 3).
        s (int): The number of interpolation steps to use when drawing the
            curve (minimum of 2). The higher the value, the smoother the curve.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["bezierRGBA"](renderer, vx, vy, n, s, r, g, b, a)


def gfxPrimitivesSetFont(fontdata, cw, ch):
    """Sets or resets the current global GFX font.

    The SDL_gfx library uses its own special format for bitmap fonts. Basically,
    fonts are byte arrays where each glyph is made up of the same number of
    bytes (as defined by the ``cw`` and ``ch`` arguments). The bytes are used as
    a binary bitmask with 1s indicating the pixels of the character and 0s
    indicating the transparent background. For example, the following is the
    definition of the capital H glyph in the default font:

    .. code-block:: c

       /*
       * 72 0x48 'H' 
       */
       0xc6,			/* 11000110 */
       0xc6,			/* 11000110 */
       0xc6,			/* 11000110 */
       0xfe,			/* 11111110 */
       0xc6,			/* 11000110 */
       0xc6,			/* 11000110 */
       0xc6,			/* 11000110 */
       0x00,			/* 00000000 */

    Each font must contain glyphs for all 256 ASCII characters. Since this is
    a pretty painful format for defining your own fonts, you can load and use
    any of the predefined SDL_gfx fonts from the following link:
    https://github.com/ferzkopp/SDL_gfx/tree/master/Fonts

    If no font has been set, SDL_gfx defaults to rendering with a built-in 8x8
    pixel font.

    .. note::
        If anyone comes up with a way of converting standard bitmap fonts into
        the SDL_gfx format, please let us know! That would be incredibly cool
        and handy.

    Args:
        fontdata (:obj:`~ctypes.c_void_p`): A pointer to the start of the array
            containing the new global font data, or a null pointer to reset the
            global font to the default 8x8 font.
        cw (int): The width (in bytes) of each character of the font. Ignored if
            ``fontdata`` is null.
        ch (int): The height (in bytes) of each character of the font. Ignored
            if ``fontdata`` is null.

    """
    return _ctypes["gfxPrimitivesSetFont"](fontdata, cw, ch)

def gfxPrimitivesSetFontRotation(rotation):
    """Sets the global character rotation for GFX font rendering.

    Characters can only be rotated in 90 degree increments. Calling this
    function will reset the character cache.

    Args:
        rotation (int): The number of clockwise 90-degree rotations to apply to
            font characters when rendering text.

    """
    return _ctypes["gfxPrimitivesSetFontRotation"](rotation)

def characterColor(renderer, x, y, c, color):
    """Draws a single character with the current GFX font to the renderer.

    Python characters can be converted to ASCII integers for use with this
    function using the built-in :func:`ord` function (e.g. ``ord(u"A")``).

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the upper-left corner of the character.
        y (int): The Y coordinate of the upper-left corner of the character.
        c (int): The ASCII number (from 0 to 255) of the character.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["characterColor"](renderer, x, y, c, color)

def characterRGBA(renderer, x, y, c, r, g, b, a):
    """Draws a single character with the current GFX font to the renderer.

    See :func:`characterColor` for more usage information.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the upper-left corner of the character.
        y (int): The Y coordinate of the upper-left corner of the character.
        c (int): The ASCII number (from 0 to 255) of the character.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["characterRGBA"](renderer, x, y, c, r, g, b, a)

def stringColor(renderer, x, y, s, color):
    """Draws an ASCII string with the current GFX font to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the upper-left corner of the string.
        y (int): The Y coordinate of the upper-left corner of the string.
        s (bytes): The ASCII-encoded bytestring of text to render.
        color (int): The color to draw with as a 32-bit ``0xRRGGBBAA`` integer
            (e.g. ``0xFF0000FF`` for solid red).

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["stringColor"](renderer, x, y, s, color)

def stringRGBA(renderer, x, y, s, r, g, b, a):
    """Draws an ASCII string with the current GFX font to the renderer.

    If the rendering color has any transparency, blending will be enabled.

    Args:
        renderer (:obj:`SDL_Renderer`): The renderer to draw on.
        x (int): The X coordinate of the upper-left corner of the string.
        y (int): The Y coordinate of the upper-left corner of the string.
        s (bytes): The ASCII-encoded bytestring of text to render.
        r (int): The red value (from 0 to 255) of the color to draw with.
        g (int): The green value (from 0 to 255) of the color to draw with.
        b (int): The blue value (from 0 to 255) of the color to draw with.
        a (int): The alpha value (from 0 to 255) of the color to draw with.

    Returns:
        int: 0 on success, or -1 on failure.

    """
    return _ctypes["stringRGBA"](renderer, x, y, s, r, g, b, a)


def rotozoomSurface(src, angle, zoom, smooth):
    """Rotates & zooms a surface.

    Rotates and zooms an :obj:`SDL_Surface` to a new output surface, with
    optional anti-aliasing. If the surface is not 8-bit or 32-bit RGBA/ABGR, it
    will be converted into a 32-bit RGBA format on the fly.
    
    Args:
        src (:obj:`SDL_Surface`): The surface to rotate and zoom.
        angle (float): The angle to rotate the surface (in degrees).
        zoom (float): The scaling factor for the surface.
        smooth (int): If set to 1, the output image will be anti-aliased. If set
            to 0, no anti-aliasing will be performed. Must be either 0 or 1.
    
    Returns:
        :obj:`SDL_Surface`: A new output surface with zoom & rotation applied.

    """
    return _ctypes["rotozoomSurface"](src, angle, zoom, smooth)

def rotozoomSurfaceXY(src, angle, zoomx, zoomy, smooth):
    """Rotates & zooms a surface with different x & y scaling factors.

    Rotates and zooms an :obj:`SDL_Surface` to a new output surface, with
    optional anti-aliasing. If the surface is not 8-bit or 32-bit RGBA/ABGR, it
    will be converted into a 32-bit RGBA format on the fly.
    
    Args:
        src (:obj:`SDL_Surface`): The surface to rotate and zoom.
        angle (float): The angle to rotate the surface (in degrees).
        zoomx (float): The x-axis (horizontal) scaling factor.
        zoomy (float): The y-axis (vertical) scaling factor.
        smooth (int): If set to 1, the output image will be anti-aliased. If set
            to 0, no anti-aliasing will be performed. Must be either 0 or 1.
    
    Returns:
        :obj:`SDL_Surface`: A new output surface with zoom & rotation applied.

    """
    return _ctypes["rotozoomSurfaceXY"](src, angle, zoomx, zoomy, smooth)

def rotozoomSurfaceSize(width, height, angle, zoom, dstwidth, dstheight):
    """Returns the output surface size of a :func:`rotozoomSurface` call.

    This function outputs the calculated height and width by reference to the
    ``dstwidth`` and ``dstheight`` arguments, and does not return any value
    itself.

    Args:
        width (int): The width (in pixels) of the source surface.
        height (int): The height (in pixels) of the source surface.
        angle (float): The angle to rotate the surface (in degrees).
        zoom (float): The scaling factor for the surface.
        dstwidth (byref(`c_int`)): A reference to the ctypes int where the
            calculated width of the output surface will be stored.
        dstheight (byref(`c_int`)): A reference to the ctypes int where the
            calculated height of the output surface will be stored.

    """
    return _ctypes["rotozoomSurfaceSize"](
        width, height, angle, zoom, dstwidth, dstheight
    )

def rotozoomSurfaceSizeXY(width, height, angle, zoomx, zoomy, dstwidth, dstheight):
    """Returns the output surface size of a :func:`rotozoomSurfaceXY` call.

    This function outputs the calculated height and width by reference to the
    ``dstwidth`` and ``dstheight`` arguments, and does not return any value
    itself.

    Args:
        width (int): The width (in pixels) of the source surface.
        height (int): The height (in pixels) of the source surface.
        angle (float): The angle to rotate the surface (in degrees).
        zoomx (float): The x-axis (horizontal) scaling factor.
        zoomy (float): The y-axis (vertical) scaling factor.
        dstwidth (byref(`c_int`)): A reference to the ctypes int where the
            calculated width of the output surface will be stored.
        dstheight (byref(`c_int`)): A reference to the ctypes int where the
            calculated height of the output surface will be stored.

    """
    return _ctypes["rotozoomSurfaceSizeXY"](
        width, height, angle, zoomx, zoomy, dstwidth, dstheight
    )

def zoomSurface(src, zoomx, zoomy, smooth):
    """Zooms a surface with different x & y scaling factors.

    This function renders to a new surface, with optional anti-aliasing. If a
    zoom factor is negative, the image will be flipped along that axis. If the
    surface is not 8-bit or 32-bit RGBA/ABGR, it will be converted into a 32-bit
    RGBA format on the fly.

    Args:
        src (:obj:`SDL_Surface`): The surface to zoom.
        zoomx (float): The x-axis (horizontal) zoom factor.
        zoomy (float): The y-axis (vertical) zoom factor.
        smooth (int): If set to 1, the output image will be anti-aliased. If set
            to 0, no anti-aliasing will be performed. Must be either 0 or 1.
    
    Returns:
        :obj:`SDL_Surface`: A new output surface with zoom applied.

    """
    return _ctypes["zoomSurface"](src, zoomx, zoomy, smooth)

def zoomSurfaceSize(width, height, zoomx, zoomy, dstwidth, dstheight):
    """Returns the output surface size of a :func:`zoomSurface` call.

    This function outputs the calculated height and width by reference to the
    ``dstwidth`` and ``dstheight`` arguments, and does not return any value
    itself.

    Args:
        width (int): The width (in pixels) of the source surface.
        height (int): The height (in pixels) of the source surface.
        zoomx (float): The x-axis (horizontal) scaling factor.
        zoomy (float): The y-axis (vertical) scaling factor.
        dstwidth (byref(`c_int`)): A reference to the ctypes int where the
            calculated width of the output surface will be stored.
        dstheight (byref(`c_int`)): A reference to the ctypes int where the
            calculated height of the output surface will be stored.

    """
    return _ctypes["zoomSurfaceSize"](width, height, zoomx, zoomy, dstwidth, dstheight)

def shrinkSurface(src, factorx, factory):
    """Shrinks a surface by an integer ratio using averaging.

    This function renders to a new surface, meaning that the original surface is
    not modified. The output surface is anti-aliased by averaging the source
    RGBA information. If the surface is not 8-bit or 32-bit RGBA/ABGR, it will
    be converted into a 32-bit RGBA format on the fly.

    Args:
        src (:obj:`SDL_Surface`): The surface to zoom.
        factorx (int): The x-axis (horizontal) shrink factor (e.g. 2 = 2x smaller).
        factory (int): The y-axis (vertical) shrink factor (e.g. 2 = 2x smaller).


    Returns:
        :obj:`SDL_Surface`: The new shrunken surface.

    """
    return _ctypes["shrinkSurface"](src, factorx, factory)

def rotateSurface90Degrees(src, numClockwiseTurns):
    """Rotates an SDL surface clockwise in increments of 90 degrees.

    Faster than rotozoomer since no scanning or interpolation takes place.
    Input surface must be 8-bit, 16-bit, 24-bit, or 32-bit.

    Args:
        src (:obj:`SDL_Surface`): The source surface to rotate.
        numClockwiseTurns (int): The number of clockwise 90 degree rotations to
            apply to the source.

    Returns:
        :obj:`SDL_Surface`: The new rotated surface, or `None` if the source
        surface was not a compatible format.

    """
    return _ctypes["rotateSurface90Degrees"](src, numClockwiseTurns)