File: video.rsd

package info (click to toggle)
ruby-sdl 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 1,544 kB
  • ctags: 1,359
  • sloc: cpp: 7,598; ansic: 4,498; ruby: 2,246; makefile: 106; sh: 102
file content (2861 lines) | stat: -rw-r--r-- 61,192 bytes parent folder | download | duplicates (2)
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
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
= Video
* ((<Video Subsystem Outline>))
* ((<SDL::Screen>))
* ((<SDL::Surface>))
* ((<SDL::VideoInfo>))
* ((<Color, PixelFormat and Pixel value>))

* Methods
TOC

== Video Subsystem Outline
SDL presents a very simple interface to the display framebuffer.
The framebuffer is represented as an offscreen surface to which
you can write directly. If you want the screen to show what you
have written, call the @[update|Screen#update_rect]
function which will guarantee that
the desired portion of the screen is updated.

Before you call any of the SDL video functions, you must first
call @[init](SDL::INIT_VIDEO), which initializes the video and
events in the SDL library. 

If you use both sound and video in your application, you need to
call @[init](SDL::INIT_AUDIO | SDL::INIT_VIDEO) before opening
the sound device, otherwise under Win32 DirectX, you won't be
able to set full-screen display modes.

After you have initialized the library, you can start up the
video display in a number of ways. The easiest way is to pick a
common screen resolution and depth and just initialize the
video, checking for errors. You will probably get what you want,
but SDL may be emulating your requested mode and converting the
display on update. The best way is to @[query|Screen.info], 
for the best video
mode closest to the desired one, and then 
@[convert|Surface#display_format] your images to 
that pixel format.

SDL currently supports any bit depth >= 8 bits per pixel. 8 bpp
formats are considered 8-bit palettized modes, while 12, 15, 16,
24, and 32 bits per pixel are considered "packed pixel" modes,
meaning each pixel contains the RGB color components packed in
the bits of the pixel.

After you have initialized your video mode, you can take the
surface that was returned, and write to it like any other
framebuffer, calling the update routine as you go.

== SDL::Surface
Graphical Surface class.

This class represent areas of "graphical" memory, memory that
can be drawn to. 

METHODS(Surface)

== SDL::Screen
Video framebuffer class. 

This class is subclass of @[Surface], and contents 
is shown in display.

The video framebuffer is returned by 
@[Screen.open] and @[Screen.get].

METHODS(Screen)

== SDL::VideoInfo
Video Target information class.

The instance of this class is returned by @[Screen.info]. It
contains information on either the 'best' available mode (if
called before @[Screen.open]) or the current video mode.

This class has following methods.

--- SDL::VideoInfo#hw_available

    Is it possible to create hardware surfaces?

--- SDL::VideoInfo#wm_available
    
    Is there a window manager available?

--- SDL::VideoInfo#blit_hw
    
    Are hardware to hardware blits accelerated?

--- SDL::VideoInfo#blit_hw_CC
    
    Are hardware to hardware colorkey blits accelerated?

--- SDL::VideoInfo#blit_hw_A
    
    Are hardware to hardware alpha blits accelerated?

--- SDL::VideoInfo#blit_sw
    
    Are software to hardware blits accelerated?

--- SDL::VideoInfo#blit_sw_CC
    
    Are software to hardware colorkey blits accelerated?

--- SDL::VideoInfo#blit_sw_A
    
    Are software to hardware alpha blits accelerated?

--- SDL::VideoInfo#blit_fill
    
    Are color fills accelerated?

--- SDL::VideoInfo#video_mem
    
    Total amount of video memory in Kilobytes

--- SDL::VideoInfo#bpp
    
    bits per pixel of the video device

== SDL::PixelFormat
Surface format information class.
Please see ((<Color, PixelFormat and Pixel value>)).

METHODS(PixelFormat)

== Color, PixelFormat and Pixel value

=== Outline
In Ruby/SDL, color is described as four elements
of 8-bit unsigned interger(from 0 to 255), Red, Green,
Blue and Alpha. In Ruby/SDL, this values are
packed as unsigned n-bit integer(n=8,16,24,32).
The rules of this conversion is called PixelFormat
and converted n-bit integer is called pixel value.
Each surface has one PixelFormat, and you can use
@[Surface#format] to get PixelFormat from surface object.
You can also covert from or to pixel values calling
@[PixelFormat#map_rgb], @[PixelFormat#map_rgba],
@[PixelFormat#get_rgb] and @[PixelFormat#get_rgba].
You can use pixel value or 3 elements array 
or 4 elements array as color parameter.
Return values are normally pixel values.

=== Details
Not documented yet.

== Video Methods 
%%%
NAME get_video_surface
TYPE .
PURPOSE returns the current display surface
RVAL Screen
OBSOLETE Screen.get

PROTO
get_video_surface
getVideoSurface

%%
NAME get
MOD Screen
TYPE .
PURPOSE returns the current display surface
RVAL Screen

PROTO
get

DESC
This method returns the current display surface.
If SDL is doing format conversion on the display surface, this
method returns the publicly visible surface, not the real
video surface.

RET
Returns the instance of @[Screen].

EXCEPTION *

%%
NAME video_info
TYPE .
PURPOSE returns information about the video hardware
RVAL VideoInfo
OBSOLETE Screen.info

PROTO
video_info
videoInfo

%%
NAME info
MOD Screen
TYPE .
PURPOSE returns information about the video hardware
RVAL VideoInfo

PROTO
info

DESC
This function returns a @[information|VideoInfo] about
the video hardware. If this is called before @[Screen.open],
bpp attribute of the returned object will contain the pixel
format of the "best" video mode.

RET
Returns the instance of @[VideoInfo].

EXCEPTION *

SEEALSO
Screen.open
VideoInfo

%%
NAME video_driver_name
TYPE .
PURPOSE Obtain the name of the video driver
RVAL String
OBSOLETE Screen.driver_name

PROTO
video_driver_name
videoDriverName

%%
NAME driver_name
MOD Screen
TYPE .
PURPOSE Obtain the name of the video driver
RVAL String

PROTO
driver_name
driverName

DESC
The driver name is a simple one
word identifier like "x11" or "windib".

RET
Returns driver name as string.

EXCEPTION
Raises @[Error] if video has not been initialized with 
@[init].

SEEALSO
init

%%
NAME list_modes
TYPE .
PURPOSE Returns an array of available screen dimensions for the given format and video flags
RVAL nil/true/Array of [UINT, UINT]
OBSOLETE Screen.list_modes

PROTO
list_modes(flags)
listModes(flags)

%%
NAME list_modes
MOD Screen
TYPE .
PURPOSE Returns an array of available screen dimensions for the given format and video flags
RVAL nil/true/Array of [UINT, UINT]

PROTO
list_modes(flags)
listModes(flags)

DESC
Return an array of available screen dimensions for
the given format and video flags, sorted largest to smallest.

Returns nil if there are no dimensions available for a
particular format, or true if any dimension is okay for the given
format.
The flag parameter is an OR'd
combination of surface flags. The flags are the same as those
used @[Screen.open] and they play a strong role in deciding
what modes are valid.
For instance, if you pass SDL::HWSURFACE as
a flag only modes that support hardware video surfaces will be
returned.

EXAMPLE
# Get available fullscreen/hardware modes
modes = SDL::Screen.list_modes(SDL::FULLSCREEN|SDL::HWSURFACE)

# Check is there are any modes available
if modes == nil
  puts "No modes available!"
  exit 1
end

# Check is there are any modes available
if modes == true
  puts "All resolutions available."
else
  # Print valid modes
  puts "Available Modes"
  modes.each{|w, h| puts "  #{w} x #{h}"}
end

SEEALSO
Screen.open
Screen.info

%%
NAME check_video_mode
TYPE .
PURPOSE Check to see if a particular video mode is supported.
RVAL Integer
OBSOLETE Screen.check_mode

PROTO
check_video_mode(w,h,bpp,flags)
checkVideoMode(w,h,bpp,flags)

%%
NAME check_mode
MOD Screen
TYPE .
PURPOSE Check to see if a particular video mode is supported.
RVAL Integer

PROTO
check_mode(w,h,bpp,flags)
checkMode(w,h,bpp,flags)

DESC
Returns 0 if the requested mode is not supported
under any bit depth,
or returns the bits-per-pixel of the
closest available mode with the given width, height and
requested surface flags (see @[Screen.open]).

The bits-per-pixel value returned is only a suggested mode. You
can usually request and bpp you want when 
@[setting|Screen.opn] the video mode
and SDL will emulate that color depth with a shadow video
surface.


EXAMPLE
puts "Checking mode 640x480@16bpp."
bpp = SDL::Screen.check_mode(640, 480, 16, SDL::HWSURFACE)
if bpp == 0
  puts "Mode not available."
  exit 1
end

puts "SDL Recomemends 640x480@#{bpp}bpp."
screen = SDL::Screen.open(640, 480, bpp, SDL_HWSURFACE)

SEEALSO
Screen.open
Screen.info

%%
NAME set_video_mode
TYPE .
PURPOSE Set up a video mode with the specified width, height and bits-per-pixel.
RVAL Screen
OBSOLETE Screen.open

PROTO
setVideoMode(w,h,bpp,flags)
set_video_mode(w,h,bpp,flags)

%%
NAME open
MOD Screen
TYPE .
PURPOSE Set up a video mode with the specified width, height and bits-per-pixel.
RVAL Screen

PROTO
open(w,h,bpp,flags)

DESC
Set up a video mode with the specified width, height and
bits-per-pixel.

If bpp is 0, it is treated as the current display bits per
pixel.

The flags parameter is the same as the @[Surface#flags]
OR'd combinations of the following values
are valid.

:SDL::SWSURFACE
  Create the video surface in system memory
:SDL::HWSURFACE
  Create the video surface in video memory
:SDL::ASYNCBLIT
  Enables the use of asynchronous updates of the
  display surface. This will usually slow down
  blitting on single CPU machines, but may
  provide a speed increase on SMP systems.
:SDL::ANYFORMAT
  Normally, if a video surface of the requested
  bits-per-pixel ($[bpp]) is not available, SDL will
  emulate one with a shadow surface. Passing
  SDL_ANYFORMAT prevents this and causes SDL to
  use the video surface, regardless of its pixel
  depth.
:SDL::HWPALETTE
  Give SDL exclusive palette access. Without this
  flag you may not always get the the colors you
  request with @[Surface#set_colors] or @[Surface#set_palette].
:SDL::DOUBLEBUF
  Enable hardware double buffering; only valid
  with SDL::HWSURFACE. Calling @[Screen#flip] will flip
  the buffers and update the screen. All drawing
  will take place on the surface that is not
  displayed at the moment. If double buffering
  could not be enabled then @[Screen#flip] will just
  perform a @[Screen#update_rect] on the entire screen.
:SDL::FULLSCREEN
  SDL will attempt to use a fullscreen mode. If a
  hardware resolution change is not possible (for
  whatever reason), the next higher resolution
  will be used and the display window centered on
  a black background.
:SDL::OPENGL
  Create an OpenGL rendering context. You should
  have previously set OpenGL video attributes
  with @[GL.set_attr].
:SDL::OPENGLBLIT
  Create an OpenGL rendering context, like above,
  but allow normal blitting operations. The
  screen (2D) surface may have an alpha channel,
  and @[Screen.update_rect] must be used for updating
  changes to the screen surface. NOTE: This
  option is kept for compatibility only, and is
  ((*not recommended*)) for new code.

:SDL::RESIZABLE
  Create a resizable window. When the window is
  resized by the user a @[Event::VideoResize] event is
  generated and @[Screen.open] can be called
  again with the new size.
:SDL::NOFRAME
  If possible, SDL::NOFRAME causes SDL to create a
  window with no title bar or frame decoration.
  Fullscreen modes automatically have this flag
  set.

NOTES
Whatever flags @[Screen.open] could satisfy are set
in the $[Surface#flags] of the returned surface.

The $[bpp] parameter is the number of bits per pixel, so
a $[bpp] of 24 uses the packed representation of 3 bytes/pixel.
For the more common 4 bytes/pixel mode, use a $[bpp] of 32.
Somewhat oddly, both 15 and 16 will request a 2 bytes/pixel
mode, but different pixel formats.

RET
Returns the framebuffer surface as instace of @[Screen].

EXCEPTION *
SEEALSO
Surface#lock
Surface#set_colors
Screen#flip
Screen

%%
NAME update_rect
MOD Screen
TYPE #
PURPOSE Makes sure the given area is updated on the given screen.

PROTO
updateRect(x,y,w,h)
update_rect(x,y,w,h)

DESC
Makes sure the given area is updated on the given screen. The
rectangle must be confined within the screen boundaries (no
clipping is done).

If $[x], $[y], $[w] and $[h] are all 0, this method
update the entire screen.

This method should not be called while screen is
$[locked|Surface#lock].

SEEALSO
Surface#lock
Screen#update_rects

%%
NAME update_rects
MOD Screen
TYPE #
PURPOSE Makes sure the given list of rectangles is updated on the given screen

PROTO
update_rects(*rects)
updateRects(*rects)

DESC
Makes sure the given list of rectangles is updated on the given
screen. Each rectangle parameter should be an array
of 4 elements as [x, y, w, h].
The rectangles must all be confined within the screen
boundaries (no clipping is done).

This method should not be called while screen($[self]),
is @[locked|Surface#lock].

SEEALSO
Surface#lock
Screen#update_rect

%%
NAME flip
MOD Screen
TYPE #
PURPOSE Swaps screen buffers

PROTO
flip

DESC
On hardware that supports double-buffering, this function sets
up a flip and returns. The hardware will wait for vertical
retrace, and then swap video buffers before the next video
surface blit or lock will return. On hardware that doesn't
support double-buffering, this is equivalent to calling 
$[self].@[update_rect|Screen#update_rect](0, 0, 0, 0)

EXCEPTION *

SEEALSO
set_video_mode
Screen#update_rect

%%
NAME set_colors
MOD Surface
TYPE #
PURPOSE Sets a portion of the colormap for the given 8-bit surface.
RVAL true/false

PROTO
set_colors(colors,firstcolor)
setColors(colors,firstcolor)

DESC
Sets a portion of the colormap for the given 8-bit surface.

When $[self] is the surface associated with the current display,
the display colormap will be updated with the requested colors.
If SDL::HWPALETTE was set in @[Screen.open] flags,
this method will always return true, and the palette is
guaranteed to be set the way you desire, even if the window
colormap has to be warped or run under emulation.

$[colors] is array of colors, one color has three componets,
R, G, B and each component is 8-bits in size.

Palettized (8-bit) screen surfaces with the SDL::HWPALETTE flag
have two palettes, a logical palette that is used for mapping
blits to/from the surface and a physical palette (that
determines how the hardware will map the colors to the display).
SDL_SetColors modifies both palettes (if present), and is
equivalent to calling @[Surface#set_palette] 
with the flags set to (SDL::OGPAL | SDL::PHYSPAL).

RET
If $[self] is not a palettized surface, this method does
nothing, returning false.
If all of the colors were set as passed to
this method, it will return true.
If not all the color entries
were set exactly as given, it will return false,
and you should look
at the surface palette to determine the actual color palette.

EXAMPLE
# Create a display surface with a grayscale palette

# Fill colors with color information
colors = Array.new(256){|i| [i, i, i]}
# Create display
screen = SDL::Screen.open(640, 480, 8, SDL::HWPALETTE)

# Set palette
screen.set_colors(colors, 0)

SEEALSO
Surface#set_palette
Screen.open

%%
NAME set_palette
MOD Surface
TYPE #
PURPOSE Sets the colors in the palette of an 8-bit surface
RVAL true/false

PROTO
set_palette(flags,colors,firstcolor)
setPalette(flags,colors,firstcolor)

DESC
Sets a portion of the palette for the given 8-bit surface.

Palettized (8-bit) screen surfaces with the SDL::HWPALETTE flag
have two palettes, a logical palette that is used for mapping
blits to/from the surface and a physical palette (that
determines how the hardware will map the colors to the display).
@[Surface.blit] always uses the logical palette when blitting
surfaces (if it has to convert between surface pixel formats).
Because of this, it is often useful to modify only one or the
other palette to achieve various special color effects (e.g.,
screen fading, color flashes, screen dimming).

This method can modify either the logical or physical palette
by specifing SDL::LOGPAL or SDL::PHYSPALthe in the $[flags]
parameter.

When $[self] is the surface associated with the current display,
the display colormap will be updated with the requested colors.
If SDL::HWPALETTE was set in @[Screen.open] flags,
this method will always return true, and the palette is
guaranteed to be set the way you desire, even if the window
colormap has to be warped or run under emulation.

$[colors] is array of colors, one color has three componets,
R, G, B and each component is 8-bits in size.

RET
If surface is not a palettized surface, this function does
nothing, returning false.
If all of the colors were set as passed to
this method, it will return true.
If not all the color entries
were set exactly as given, it will return false,
 and you should look
at the surface palette to determine the actual color palette.

EXAMPLE
# Create a display surface with a grayscale palette

# Fill colors with color information
colors = Array.new(256){|i| [i, i, i]}
# Create display
screen = SDL::Screen.open(640, 480, 8, SDL::HWPALETTE)

# Setpalette
screen.set_palette(SDL::LOGPAL|SDL::PHYSPAL, colors, 0)

SEEALSO
Surface#set_colors
Screen.open

%%
NAME set_gamma
TYPE .
PURPOSE Sets the color gamma function for the display
OBSOLETE Screen.set_gamma

PROTO
set_gamma(redgamma,greengamma,bluegamma)
setGamma(redgamma,greengamma,bluegamma)

%%
NAME set_gamma
MOD Screen
TYPE .
PURPOSE Sets the color gamma function for the display

PROTO
set_gamma(redgamma,greengamma,bluegamma)
setGamma(redgamma,greengamma,bluegamma)

DESC
Sets the "gamma function" for the display of each color
component. Gamma controls the brightness/contrast of colors
displayed on the screen. A gamma value of 1.0 is identity (i.e.,
no adjustment is made).

This function adjusts the gamma based on the "gamma function"
parameter, you can directly specify lookup tables for gamma
adjustment with @[Screen.set_gamma_ramp].


EXCEPTION *
NOTES
Not all display hardware is able to change gamma.

SEEALSO
Screen.get_gamma_ramp
Screen.set_gamma_ramp

%%
NAME get_gamma_ramp
TYPE .
PURPOSE Gets the color gamma lookup tables for the display
RVAL Array of UINT
OBSOLETE Screen.get_gamma_ramp

PROTO
get_gamma_ramp
getGammaRamp

%%
NAME get_gamma_ramp
MOD Screen
TYPE .
PURPOSE Gets the color gamma lookup tables for the display
RVAL Array of UINT

PROTO
get_gamma_ramp
getGammaRamp

DESC
Gets the gamma translation lookup tables currently used by the
display. Each table is an array of 256 16bit unsigned integer
values.

RET
Returns an array of 3 elements of an array of 256 16bit unsigned integer.

NOTES
Not all display hardware is able to change gamma.

EXCEPTION *

SEEALSO
Screen.set_gamma
Screen.set_gamma_ramp

%%
NAME set_gamma_ramp
TYPE .
PURPOSE Sets the color gamma lookup tables for the display
OBSOLETE Screen.set_gamma_ramp
PROTO
set_gamma_ramp(table)
setGammaRamp(table)

%%
NAME set_gamma_ramp
MOD Screen
TYPE .
PURPOSE Sets the color gamma lookup tables for the display

PROTO
set_gamma_ramp(tables)
setGammaRamp(tables)

DESC
Sets the gamma lookup tables for the display for each color
component. 
$[tables] parameter is same as @[Screen.get_gamma_ramp],
representing a mapping between the input and output for that
channel. The input is the index into the array, and the output
is the 16-bit gamma value at that index, scaled to the output
color precision. 

This function adjusts the gamma based on lookup tables, you can
also have the gamma calculated based on a "gamma function"
parameter with @[Screen.set_gamma].

EXCEPTION *

SEEALSO
Screen.set_gamma
Screen.get_gamma_ramp

%%
NAME map_rgb
MOD Surface
TYPE #
PURPOSE Map a RGB color value to a pixel format.
RVAL UINT
OBSOLETE PixelFormat#map_rgb

PROTO
map_rgb(r,g,b)
mapRGB(r,g,b)

%%
NAME map_rgb
MOD PixelFormat
TYPE #
PURPOSE RGB Map a RGB color value to a pixel format.
RVAL UINT

PROTO
map_rgb(r,g,b)
mapRGB(r,g,b)

DESC
Maps the RGB color value to the specified pixel format and
returns the pixel value as a 32-bit integer.
$[r], $[g], $[b] should be more than and equal to 0,
and less than or equal to 255.

If the format has a palette (8-bit) the index of the closest
matching color in the palette will be returned.

If the specified pixel format has an alpha component it will be
returned as all 1 bits (fully opaque).

RET
A pixel value best approximating the given RGB color value for a
given pixel format. If the pixel format bpp (color depth) is
less than 32-bpp then the unused upper bits of the return value
can safely be ignored (e.g., with a 16-bpp format the return
value can be assigned to a 16-bit unsigned integer,
and similarly a 8-bit unsigned integer for an 8-bpp format).

SEEALSO
PixelFormat#get_rgb
PixelFormat#get_rgba
PixelFormat#map_rgba
((<Color, PixelFormat and Pixel value>))

%%
NAME map_rgba
MOD Surface
TYPE #
PURPOSE RGBA Map a RGBA color value to a pixel format.
RVAL UINT
OBSOLETE PixelFormat#map_rgba

PROTO
map_rgba(r,g,b,a)
mapRGBA(r,g,b,a)

%%
NAME map_rgba
MOD PixelFormat
TYPE #
PURPOSE Map a RGBA color value to a pixel format.
RVAL UINT

PROTO
map_rgba(r,g,b,a)
mapRGBA(r,g,b,a)

DESC
Maps the RGBA color value to the specified pixel format and
returns the pixel value as a 32-bit integer.
$[r], $[g], $[b] should be more than and equal to 0,
and less than or equal to 255.

If the format has a palette (8-bit) the index of the closest
matching color in the palette will be returned.

If the specified pixel format has no alpha component the alpha
value will be ignored (as it will be in formats with a palette).

RET
A pixel value best approximating the given RGBA color value for a
given pixel format. If the pixel format bpp (color depth) is
less than 32-bpp then the unused upper bits of the return value
can safely be ignored (e.g., with a 16-bpp format the return
value can be assigned to a 16-bit unsigned integer,
and similarly a 8-bit unsigned integer for an 8-bpp format).

SEEALSO
PixelFormat#get_rgb
PixelFormat#get_rgba
PixelFormat#map_rgb
((<Color, PixelFormat and Pixel value>))

%%
NAME get_rgb
MOD Surface
TYPE #
PURPOSE Get RGB values from a pixel in the specified pixel format.
RVAL [UINT, UINT, UINT]
OBSOLETE PixelFormat#get_rgb
PROTO
get_rgb(pixel)
getRGB(pixel)

%%
NAME get_rgb
MOD PixelFormat
TYPE #
PURPOSE Get RGB values from a pixel in the specified pixel format.
RVAL [UINT, UINT, UINT]

PROTO
get_rgb(pixel)
getRGB(pixel)

DESC
Get RGB component values from a pixel stored in the specified
pixel format. It returns an array of 3 elements.

This function uses the entire 8-bit [0..255] range when
converting color components from pixel formats with less than
8-bits per RGB component (e.g., a completely white pixel in
16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8,
0xfc, 0xf8]).

SEEALSO
PixelFormat#get_rgba
PixelFormat#map_rgb
PixelFormat#map_rgba
((<Color, PixelFormat and Pixel value>))

%%
NAME get_rgba
MOD Surface
TYPE #
PURPOSE Get RGBA values from a pixel in the specified pixel format.
RVAL [UINT, UINT, UINT, UINT]
OBSOLETE PixelFormat#get_rgba

PROTO
get_rgba(pixel)
getRGBA(pixel)

%%
NAME get_rgba
MOD PixelFormat
TYPE #
PURPOSE Get RGBA values from a pixel in the specified pixel format.
RVAL [UINT, UINT, UINT, UINT]

PROTO
get_rgba(pixel)
getRGBA(pixel)

DESC
Get RGBA component values as array of four elements 
from a pixel stored in the specified
pixel format.

This function uses the entire 8-bit [0..255] range when
converting color components from pixel formats with less than
8-bits per RGB component (e.g., a completely white pixel in
16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8,
0xfc, 0xf8]).

If the surface has no alpha component, the alpha will be
returned as 0xff (100% opaque).

SEEALSO
PixelFormat#get_rgba
PixelFormat#map_rgb
PixelFormat#map_rgba
((<Color, PixelFormat and Pixel value>))

%%
NAME new
MOD Surface
TYPE .
PURPOSE Create an empty @[Surface]
RVAL Surface

PROTO
new(flags,w,h,depth,Rmask,Gmask,Bmask,Amask)
new(flags,w,h,format)

DESC
Allocate an empty surface 
(must be called after @[Screen.open])

If depth is 8 bits an empty palette is allocated for the
surface, otherwise a 'packed-pixel' format is created
using the $[RGBAmask]'s provided (see @[PixelFormat]). 
The $[flags]
specifies the type of surface that should be created, it is an
OR'd combination of the following possible values.

:SDL::SWSURFACE
  SDL will create the surface in system memory.
  This improves the performance of pixel level
  access, however you may not be able to take
  advantage of some types of hardware blitting.
:SDL::HWSURFACE
  SDL will attempt to create the surface in
  video memory. This will allow SDL to take
  advantage of Video->Video blits (which are
  often accelerated).
:SDL::SRCCOLORKEY
  This flag turns on colourkeying for blits from
  this surface. If SDL::HWSURFACE is also
  specified and colourkeyed blits are
  hardware-accelerated, then SDL will attempt to
  place the surface in video memory. Use
  @[Surface#set_color_key] to set or clear this flag
  after surface creation.
:SDL::SRCALPHA
  This flag turns on alpha-blending for blits
  from this surface. If SDL::HWSURFACE is also
  specified and alpha-blending blits are
  hardware-accelerated, then the surface will be
  placed in video memory if possible. Use
  @[Surface#set_alpha] to set or clear this flag after
  surface creation.

RET
Returns the instance of @[Surface].

EXCEPTION *

NOTES
  Note: If an alpha-channel is specified (that is, if $[Amask] is
  nonzero), then the SDL::SRCALPHA flag is automatically set.
  You may remove this flag by calling @[Surface#set_alpha] after
  surface creation.

EXAMPLE
# Create a 32-bit surface with the bytes of 
# each pixel in R,G,B,A order,
# as expected by OpenGL for textures

big_endian = ([1].pack("N") == [1].pack("L"))

if big_endian
  rmask = 0xff000000
  gmask = 0x00ff0000
  bmask = 0x0000ff00
  amask = 0x000000ff
else
  rmask = 0x000000ff
  gmask = 0x0000ff00
  bmask = 0x00ff0000
  amask = 0xff000000
end

surface = SDL::Surface.new(SDL::SWSURFACE, width, height, 32,
                           rmask, gmask, bmask, amask);

SEEALSO
Surface.new_from
Screen.oepn
Surface#lock
Surface#set_alpha
Surface#set_color_key

%%
NAME new_from
MOD Surface
TYPE .
PURPOSE Create an @[Surface] object from pixel data
RVAL Surface

PROTO
new_from(pixels,w,h,depth,pitch,Rmask,Gmask,Bmask,Amask)

DESC
Creates an @[Surface] object from the provided pixel data.

The data stored in $[pixels](String object)
 is assumed to be of the depth
specified in the parameter list. 
$[pitch] is the length of each scanline in bytes.

See @[Surface.new] for a more detailed description of the
other parameters.

RET
Returns the created surface.

EXCEPTION *

SEEALSO
Surface.new

%%
NAME lock
MOD Surface
TYPE #
PURPOSE Lock a surface for directly access.

PROTO
lock

DESC
This method sets up a surface for directly accessing the pixels. Between calls to @[Surface#lock] 
and @[Surface#unlock] you can write to and read from surface directly.
Once you are done accessing the surface, you should use @[Surface#unlock] to release it.

Not all surfaces require locking. If @[Surface#must_lock?] returns false, then you can read and write to
the surface at any time, and the pixel format of the surface will not change.

No operating system or library calls should be made between lock/unlock pairs, as critical system locks
may be held during this time.

It should be noted, that since SDL 1.1.8 surface locks are recursive. This means that you can lock a
surface multiple times, but each lock must have a match unlock.
  surface.lock
  # Surface is locked
  # Direct pixel access on surface here
  surface.lock
  # More direct pixel access on surface
  surface.unlock
  # Surface is still locked
  # Note: Is versions < 1.1.8, the surface would have been
  # no longer locked at this stage
  surface.unlock
  # Surface is now unlocked

You shoud lock before colling following methods:
* @[Surface#pixels]
LOCKLIST

NOTES
If @[Surface#auto_lock?] returns true, you need not call this method
because Ruby/SDL automatically locks surface when you call methods that 
need locking.

EXCEPTION
Raises @[Error], if the surface couldn't be locked.

SEEALSO
Surface#unlock
Surface#must_lock?
auto_lock?
auto_lock_on
auto_lock_off
auto_lock=

%%
NAME unlock
MOD Surface
TYPE #
PURPOSE Unlocks a previously locked surface.

PROTO
unlock

DESC
Surfaces that were previously locked using @[Surfaces#lock] must be unlocked with @[Surfaces#unlock].
Surfaces should be unlocked as soon as possible.

It should be noted that since 1.1.8, surface locks are recursive.

SEEALSO
Surface#lock

%%
NAME must_lock?
MOD Surface
TYPE #
PURPOSE Get whether the surface require locking or not.
RVAL true/false

PROTO
must_lock?
mustLock?

DESC
Returns true if $[self] require locking for direct access to the pixels, 
otherwise returns false.

SEEALSO
Surface#lock

%%
NAME load_bmp
MOD Surface
TYPE .
PURPOSE Load a Windows BMP file into an SDL_Surface.
RVAL Surface

PROTO
load_bmp(filename)
loadBMP(filename)

DESC
Loads a surface from a named Windows BMP file.

RET
Returns the new @[Surface] object.

EXCEPTION *

SEEALSO
Surface#save_bmp
Surface.load

%%
NAME load_bmp_from_io
MOD Surface
TYPE .
PURPOSE Load a Windows BMP file into an Surface from IO object.
RVAL Surface

PROTO
load_bmp_from_io(io)
loadBMPFromIO(io)

DESC
Loads a surface from a ruby's IO object.
IO object means the ruby object that has following methods:
* read
* rewind
* tell

For example, instances of IO class, StringIO class and Zlib::GZipReader class
are IO object.

RET
Returns the new @[Surface] object.

EXCEPTION *

SEEALSO
Surface.load_bmp
Surface.load_from_io

%%
NAME save_bmp
MOD Surface
TYPE #
PURPOSE Save an SDL_Surface as a Windows BMP file.

PROTO
save_bmp(filename)
saveBMP(filename)

DESC
Saves the $[self] surface as a Windows BMP file named $[filename].

EXCEPTION *
SEEALSO
Surface.load_bmp

%%
NAME destroy
MOD Surface
TYPE #
PURPOSE Frees a Surface

PROTO
destroy

DESC
Frees the resource used by a Surface.
If a surface is destroyed, all operations are forbidden.

SEEALSO
Surface.new
Surface.new_from
Surface#destroyed?

%%
NAME destroyed?
MOD Surface
TYPE #
PURPOSE Returns whether surface is destoryed or not.
RVAL true/false

PROTO
destroyed?

DESC
Returns whether the surface is destroyed by
@[Surface#destroy].

SEEALSO
Surface#destroy

%%
NAME set_color_key
MOD Surface
TYPE #
PURPOSE Sets the color key (transparent pixel) in a blittable surface and RLE acceleration.

PROTO
set_color_key(flag,key)
setColorKey(flag,key)

DESC
Sets the color key (transparent pixel) in a blittable $[surface|Surface]
and enables or disables RLE blit acceleration.
$[key] parameter should be pixel value or color array.

RLE acceleration can substantially speed up blitting 
of images with large horizontal runs of transparent
pixels (i.e., pixels that match the $[key] value). 
The key must be of the same pixel format as the surface,
if pixel value is used.
In that case, @[PixelFormat#map_rgb]
is often useful for obtaining an acceptable value.

If $[flag] is SDL_SRCCOLORKEY then $[key] is the transparent pixel color in the source image of a blit.

If $[flag] is OR'd with SDL::RLEACCEL then the surface will 
be draw using RLE acceleration when drawn with 
@[Surface.blit]. The surface will actually be encoded 
for RLE acceleration the first time @[Surface.blit]
or @[Surface#display_format] is called on the surface.

If $[flag] is 0, this function clears any current color key.

EXCEPTION *
SEEALSO
Surface.blit
Surface#display_format
Surface#map_rgb
Surface#set_alpha
Surface#colorkey

%%
NAME set_alpha
MOD Surface
TYPE #
PURPOSE Adjust the alpha properties of a surface

PROTO
set_alpha(flags,alpha)
setAlpha(flags,alpha)

DESC
This method is used for setting the per-surface alpha value and/or enabling and disabling alpha
blending.

The surface parameter specifies which surface whose 
alpha attributes you wish to adjust. $[flags] is used to
specify whether alpha blending should be used (SDL::SRCALPHA)
 and whether the surface should use RLE
acceleration for blitting (SDL::RLEACCEL). $[flags] 
can be an OR'd combination of these two options, one of
these options or 0. If SDL::SRCALPHA is not passed as a flag
 then all alpha information is ignored when
blitting the surface. The alpha parameter is the 
per-surface alpha value; a surface need not have an
alpha channel to use per-surface alpha and blitting can still be accelerated with SDL::RLEACCEL.

Alpha effects surface blitting in the following ways:

:RGBA->RGB with SDL::SRCALPHA    
  The source is alpha-blended with the destination, using the alpha channel.
  SDL_SRCCOLORKEY and the per-surface alpha are ignored.

:RGBA->RGB without SDL::SRCALPHA
  The RGB data is copied from the source. The source alpha channel and the per-surface
  alpha value are ignored.

:RGB->RGBA with SDL::SRCALPHA
  The source is alpha-blended with the destination using the per-surface alpha value. If
  SDL::SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied. The
  alpha channel of the copied pixels is set to opaque.

:RGB->RGBA without SDL::SRCALPHA
  The RGB data is copied from the source and the alpha value of the copied pixels is set to
  opaque. If SDL::SRCCOLORKEY is set, only the pixels not matching the colorkey value are
  copied.   
                                                                                                         
:RGBA->RGBA with  SDL::SRCALPHA
  The source is alpha-blended with the destination using the source alpha channel. The     
  alpha channel in the destination surface is left untouched. SDL::SRCCOLORKEY is ignored.  

RGBA->RGBA witout SDL::SRCALPHA
  The RGBA data is copied to the destination surface. If SDL::SRCCOLORKEY is set, only the  
  pixels not matching the colorkey value are copied.

RGB->RGB with SDL_SRCALPHA
  The source is alpha-blended with the destination using the per-surface alpha value. If
  SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

RGB->RGB witout SDL_SRCALPHA
  The RGB data is copied from the source. If SDL_SRCCOLORKEY is set, only the pixels not
  matching the colorkey value are copied.

NOTES
Note: This method and the semantics of SDL alpha blending have changed since version 1.1.4. Up
until version 1.1.5, an alpha value of 0 was considered opaque and a value of 255 was considered
transparent. This has now been inverted: 0 (SDL::ALPHA_TRANSPARENT) is now considered transparent and
255 (SDL::ALPHA_OPAQUE) is now considered opaque.
The per-surface alpha value of 128 is considered a special case and is optimised, so it's much
faster than other per-surface values.

Note that RGBA->RGBA blits (with SDL::SRCALPHA set) keep the alpha of the destination surface.
This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would
expect from "overlaying" them; the destination alpha will work as a mask.

Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used
if available

EXCEPTION *
SEEALSO
Surface#map_rgba
Surface#get_rgba
Surface#display_format
Surface.blit
Surface#alpha

%%
NAME set_clip_rect
MOD Surface
TYPE #
PURPOSE Sets the clipping rectangle for a surface.

PROTO
set_clip_rect(x,y,w,h)
setClipRect(x,y,w,h)

DESC
Sets the clipping rectangle for a surface. 
When this surface is the destination of a blit, only the area
within the clip rectangle will be drawn into.

The rectangle pointed to by rect will be clipped to the edges of the surface so that the clip rectangle
for a surface can never fall outside the edges of the surface.

SEEALSO
Surface#get_clip_rect
Surface.blit

%%
NAME get_clip_rect
MOD Surface
TYPE #
PURPOSE Gets the clipping rectangle for a surface.
RVAL [Integer, Integer, UINT, UINT]

PROTO
get_clip_rect
getClipRect

DESC
Gets the clipping rectangle for a surface. When this surface is the destination of a blit, only the area
within the clip rectangle is drawn into.

RET
Returns 4 element array as [x, y, w, h].

SEEALSO
Surface#set_clip_rect
Surface.blit

%%
NAME blit_surface
TYPE .
PURPOSE Performs a fast blit from the source surface to the destination surface.
RVAL 0/-2
OBSOLETE Surface.blit

PROTO
blit_surface(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)
blitSurface(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)


%%
NAME blit
MOD Surface
TYPE .
PURPOSE This performs a fast blit from the source surface to the destination surface.
RVAL 0

PROTO
blit(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)

DESC
This performs a fast blit from the source surface to the destination surface.

$[src] is source surface, $[dst] is destination surface, 
$[srcX], $[srcY], $[srcW], $[srcH] is source rectangle, 
and $[dstX], $[dstY] is destination point.
If all of $[srcX], $[srcY], $[srcW], $[srcH] is zero, the entire surface is copied.

The blit function should not be called on a locked surface.

The results of blitting operations vary greatly depending on whether SDL::SRCAPLHA is set or not. See 
@[Surface#set_alpha] for an explaination of how this 
affects your results. Colorkeying and alpha attributes also
interact with surface blitting, as the following pseudo-code should hopefully explain.

  if source surface has SDL::SRCALPHA set 
    if source surface has alpha channel (that is, Amask != 0)
      blit using per-pixel alpha, ignoring any colour key
    elsif source surface has SDL::SRCCOLORKEY set
      blit using the colour key AND the per-surface alpha value
    else
      blit using the per-surface alpha value
    end
  elsif source surface has SDL::SRCCOLORKEY se
    blit using the colour key
  else
    ordinary opaque rectangular blit
  end

RET
If the blit is successful, it returns 0.

EXCEPTION
If either of the surfaces were in video memory, 
and the blit raises SDL::Surface::VideoMemoryLost,
the video memory was lost, so it
should be reloaded with artwork and re-blitted.

This happens under DirectX 5.0 when the system switches away from your fullscreen application. Locking
the surface will also fail until you have access to the video memory again.

%%
NAME fill_rect
MOD Surface
TYPE #
PURPOSE This function performs a fast fill of the given rectangle with some color

PROTO
fill_rect(x,y,w,h,color)
fillRect(x,y,w,h,color)

DESC
This method performs a fast fill of the given rectangle with $[color].

Please see ((<Color, PixelFormat and Pixel value>)) to specify $[color].
If the color value contains an alpha value then the destination is simply "filled"
with that alpha information, no blending takes place.

If there is a clip rectangle set on the destination (set via @[Surface#set_clip_rect])
then this function will clip based on the intersection of the clip rectangle 
and the dstrect rectangle and the dstrect rectangle
will be modified to represent the area actually filled.

EXCEPTION *
SEEALSO
Surface#map_rgb
Surface#map_rgba
Surface.blit

%%
NAME display_format
MOD Surface
TYPE #
PURPOSE Convert a surface to the display format
RVAL Surface

PROTO
display_format
displayFormat

DESC
This method copies $[self] to a new surface of the pixel format and colors of the video
framebuffer, suitable for fast blitting onto the display surface.

If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the
colorkey and alpha value before calling this function.

If you want an alpha channel, see @[Surface#display_format_alpha].

RET
Returns converted surface object.

EXCEPTION
Raises @[Error] if the conversion fails or runs out of memory.

SEEALSO
Surface#display_format_alpha
Surface#set_alpha
Surface#set_color_key

%%
NAME display_format_alpha
MOD Surface
TYPE #
PURPOSE Convert a surface to the display format
RVAL Surface

PROTO
display_format_alpha
displaFormatAlpha

DESC
This method copies $[self] to a new surface of the pixel format and colors of the video
framebuffer plus an alpha channel, suitable for fast blitting onto the display surface.

If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the
colorkey and alpha value before calling this function.

This function can be used to convert a colourkey to an alpha channel, if the SDL::SRCCOLORKEY flag is set
on the surface. The generated surface will then be transparent (alpha=0) where the pixels match the
colourkey, and opaque (alpha=255) elsewhere.

RET
Returns converted surface object.

EXCEPTION
Raises @[Error] if the conversion fails or runs out of memory.

SEEALSO
Surface#display_format
Surface#set_alpha
Surface#set_color_key

%%
NAME flags
MOD Surface
TYPE #
PURPOSE Get surface flags
RVAL UINT

PROTO
flags

DESC
Returns the surface flags.
The following are supported:

:SDL::SWSURFACE
  Surface is stored in system memory
:SDL::HWSURFACE
  Surface is stored in video memory
:SDL::ASYNCBLIT
  Surface uses asynchronous blits if possible
:SDL::ANYFORMAT
  Allows any pixel-format (Display surface)
:SDL::HWPALETTE
  Surface has exclusive palette
:SDL::DOUBLEBUF
  Surface is double buffered (Display surface)
:SDL::FULLSCREEN
  Surface is full screen (Display Surface)
:SDL::OPENGL
  Surface has an OpenGL context (Display Surface)
:SDL::OPENGLBLIT
  Surface supports OpenGL blitting (Display Surface)
:SDL::RESIZABLE
  Surface is resizable (Display Surface)
:SDL::HWACCEL
  Surface blit uses hardware acceleration
:SDL::SRCCOLORKEY
  Surface use colorkey blitting
:SDL::RLEACCEL
  Colorkey blitting is accelerated with RLE
:SDL::SRCALPHA
  Surface blit uses alpha blending

RET
Returns OR'd compination of above constants.

SEEALSO
Surface
Screen

%%
NAME format
MOD Surface
TYPE #
PURPOSE Get surface pixel format
RVAL PixelFormat

PROTO
format

DESC
Returns @[PixelFormat] object.

%%
NAME w
MOD Surface
TYPE #
PURPOSE Get surface width
RVAL UINT

PROTO
w

DESC
Returns width of the surface.

SEEALSO
Surface#h

%%
NAME h
MOD Surface
TYPE #
PURPOSE Get surface height
RVAL UINT

PROTO
h

DESC
Returns height of the surface

SEEALSO
Surface#w

%%
NAME pixels
MOD Surface
TYPE #
PURPOSE Get the actual pixel data
RVAL String

PROTO
pixels

DESC
Returns pixel data as String object.
Examine @[Surface#flags], @[Surface#pitch] and @[Surface#format]
to analyze pixel data.

NOTES
You must @[lock|Surface#lock] surface before calling this method.

SEEALSO
Surface#flags
Surface#pitch
Surface#format

%%
NAME Rmask
MOD PixelFormat
TYPE #
PURPOSE Get binary mask used to retrieve red color value
RVAL UINT

PROTO
Rmask

DESC
Returns binary mask allowing us to isolate red component.

%%
NAME Gmask
MOD PixelFormat
TYPE #
PURPOSE Get binary mask used to retrieve green color value
RVAL UINT

PROTO
Gmask

DESC
Returns binary mask allowing us to isolate green component.

%%
NAME Bmask
MOD PixelFormat
TYPE #
PURPOSE Get binary mask used to retrieve blue color value
RVAL UINT

PROTO
Bmask

DESC
Returns binary mask allowing us to isolate blue component.

%%
NAME Amask
MOD PixelFormat
TYPE #
PURPOSE Get binary mask used to retrieve alpla value
RVAL UINT

PROTO
Amask

DESC
Returns binary mask allowing us to isolate alpha component.

%%
NAME Rloss
MOD PixelFormat
TYPE #
PURPOSE Precision loss of red component
RVAL UINT

PROTO
Rloss

DESC
Returns the number of bits lost from red component when packing 8-bit color component in a pixel.

%%
NAME Gloss
MOD PixelFormat
TYPE #
PURPOSE Precision loss of green component
RVAL UINT

PROTO
Gloss

DESC
Returns the number of bits lost from green component when packing 8-bit color component in a pixel.

%%
NAME Bloss
MOD PixelFormat
TYPE #
PURPOSE Precision loss of blue component
RVAL UINT

PROTO
Bloss

DESC
Returns the number of bits lost from blue component when packing 8-bit color component in a pixel.

%%
NAME Aloss
MOD PixelFormat
TYPE #
PURPOSE Precision loss of alpha component
RVAL UINT

PROTO
Aloss

DESC
Returns the number of bits lost from alpha component when packing 8-bit color component in a pixel.

%%
NAME Rshift
MOD PixelFormat
TYPE #
PURPOSE Binary left shift of red component in the pixel value
RVAL UINT

PROTO
Rshift

DESC
Returns the number of bits to the right of red component in the pixel value.

%%
NAME Gshift
MOD PixelFormat
TYPE #
PURPOSE Binary left shift of green component in the pixel value
RVAL UINT

PROTO
Gshift

DESC
Returns the number of bits to the right of green component in the pixel value.

%%
NAME Bshift
MOD PixelFormat
TYPE #
PURPOSE Binary left shift of blue component in the pixel value
RVAL UINT

PROTO
Bshift

DESC
Returns the number of bits to the right of blue component in the pixel value

%%
NAME Ashift
MOD PixelFormat
TYPE #
PURPOSE Binary left shift of alpha component in the pixel value
RVAL UINT

PROTO
Ashift

DESC
Returns the number of bits to the right of alpha component in the pixel value.

%%
NAME colorkey
MOD Surface
TYPE #
PURPOSE Pixel value of transparent pixels
RVAL UINT

PROTO
colorkey

DESC
Returns pixel value of transparent pixels.


SEEALSO
Surface
Surface#set_color_key
((<Color, PixelFormat and Pixel value>))

%%
NAME alpha
MOD Surface
TYPE #
PURPOSE Overall surface alpha value
RVAL UINT

PROTO
alpha

DESC
Returns surface alpha value from 0(transparent) to 255(opaque).

SEEALSO
Surface#set_alpha

%%
NAME colorkey
MOD PixelFormat
TYPE #
PURPOSE Pixel value of transparent pixels.
RVAL UINT

PROTO
colorkey

DESC
Returns pixel value of transparent pixels.

SEEALSO
Surface
Surface#set_color_key
((<Color, PixelFormat and Pixel value>))

%%
NAME alpha
MOD PixelFormat
TYPE #
PURPOSE Overall surface alpha value
RVAL UINT

PROTO
alpha

DESC
Returns surface alpha value from 0(transparent) to 255(opaque).

SEEALSO
Surface#set_alpha


%%
NAME bpp
MOD Surface
TYPE #
PURPOSE The number of bits used to represent each pixel in a surface
RVAL UINT
OBSOLETE PixelFormat#bpp

PROTO
bpp

%%
NAME bpp
MOD PixelFormat
TYPE #
PURPOSE The number of bits used to represent each pixel in a surface
RVAL UINT

PROTO
bpp

DESC
Returns the number of bits used to represent each pixel in a surface.
Usually 8, 16, 24 or 32.

%%
NAME pitch
MOD Surface
TYPE #
PURPOSE The number of bytes used for one scanline in a surface
RVAL UINT

PROTO
pitch

DESC
Returns the number of bytes used for each scanline in a surface.

@[Surface#pixels] returns pitch*@[Surface#h] bytes string.
Normally, this values is equal to @[Surface#bpp]*@[Surface#w]/8, but
in some case the value is more than bpp*w/8 because
some pudding bytes are used.

%%
NAME load
MOD Surface
TYPE .
DEP SDL_image
PURPOSE Load image into an surface
RVAL Surface

PROTO
load(filename)

DESC
Load image into an surface and returns @[surface|Surface] object.
If image format supports transparent color, colorkey is set into new surfafe.

Supoorted formats are
BMP, PNM (PPM/PGM/PBM), XPM,
XCF, PCX, GIF, JPEG, TIFF, TGA, PNG and LBM.

EXCEPTION *

%%
NAME load_from_io
MOD Surface
TYPE .
PURPOSE Load a image file into an Surface from IO object.
RVAL Surface

PROTO
load_from_io(io)
loadFromIO(io)

DESC
Loads a surface from a ruby's IO object.
IO object means the ruby object that has following methods:
* read
* rewind
* tell

If image format supports transparent color, colorkey is set into new surfafe.
Supoorted formats are
BMP, PNM (PPM/PGM/PBM), XPM,
XCF, PCX, GIF, JPEG, TIFF, TGA, PNG and LBM.

EXCEPTION *

SEEALSO
Surface.load
Surface.load_bmp_from_io

%%
NAME put_pixel
MOD Surface
TYPE #
LOCK
PURPOSE Writes a pixel to the specified position

PROTO
put_pixel(x, y, color)
putPixel(x, y, color)
[]=(x, y, color)

DESC
Writes $[color] pixel at ($[x], $[y]).

SEEALSO
Surface#get_pixel
((<Color, PixelFormat and Pixel value>))

%%
NAME get_pixel
MOD Surface
TYPE #
LOCK
PURPOSE Gets the color of the specified pixel.
RVAL UINT

PROTO
get_pixel(x, y)
getPixel(x, y)
[](x, y)

DESC
Returns pixel value at ($[x], $[y]).

SEEALSO
Surface#put_pixel
((<Color, PixelFormat and Pixel value>))

%%
NAME put
MOD Surface
TYPE #
PURPOSE Performs a fast blit from entire surface.

PROTO
put(src, x, y)

DESC
Performs a fast blit from entire $[src] surface to $[self] at ($[x], $[y]).

This means:
  SDL::Surface.blit(src, 0, 0, src.w, src.h, self, x, y)


SEEALSO
Surface.blit

%%
NAME copy_rect
MOD Surface
TYPE #
PURPOSE Copies a part of surface.

PROTO
copy_rect(x,y,w,h)
copyRect(x,y,w,h)

DESC
Copies a ($[x], $[y], $[w], $[h]) rectangle from $[self] and return new $[surface|Surface] object.

NOTES
This method call @[Surface.blit] internally, therefore you must unlock surface before calling it.

EXCEPTION *

%%
NAME auto_lock?
TYPE .
DEP SGE
PURPOSE Get whether surface is automatically locked
RVAL true/false
OBSOLETE Surface.auto_lock?

PROTO
auto_lock?
autoLock?
auto_lock
autoLock

%%
NAME auto_lock?
MOD Surface
TYPE .
DEP SGE
PURPOSE Get whether surface is automatically locked
RVAL true/false

PROTO
auto_lock?
autoLock?

DESC
Returns true if surface is automatically @[locked|Surface#lock]
when necessary, otherwise returns false.

Default is ON(true).

SEEALSO
Surface#lock
Surface#unlock
Surface.auto_lock_on
Surface.auto_lock_off

%%
NAME auto_lock_on
TYPE .
DEP SGE
PURPOSE Switch on auto locking
OBSOLETE Surface.auto_lock_on

PROTO
auto_lock_on
autoLockON

%%
NAME auto_lock_on
MOD Surface
TYPE .
DEP SGE
PURPOSE Switch on auto locking

PROTO
auto_lock_on
autoLockON

DESC
Enables auto surface locking. 

SEEALSO
Surface#lock
Surface.auto_lock?
Surface.auto_lock_off

%%
NAME auto_lock_off
TYPE .
DEP SGE
PURPOSE Switch off auto locking
OBSOLETE Surface.auto_lock_off

PROTO
auto_lock_off
autoLockOFF

%%
NAME auto_lock_off
MOD Surface
TYPE .
DEP SGE
PURPOSE Switch off auto locking.

PROTO
auto_lock_off
autoLockOFF

DESC
Disables auto surface locking. 

SEEALSO
Surface#lock
Surface.auto_lock?
Surface.auto_lock_on

%%
NAME auto_lock=
TYPE .
DEP SGE
PURPOSE Set auto locking
OBSOLETE Surface.auto_lock_on

PROTO
auto_lock=(locking)
autoLock=(locking)

DESC
Enables or disables auto surface locking.
'SDL.auto_lock = true' is same as @[Surface.auto_lock_on]
and 'SDL.auto_lock = false' is same as 
@[Surface.auto_lock_off].

SEEALSO
Surface#lock
auto_lock?
auto_lock_on
auto_lock_off

%%
NAME transform
TYPE .
DEP SGE
PURPOSE Draw a rotated and scaled image.
OBSOLETE Surface.transform_draw

PROTO
transform(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)

%%
NAME transform_draw
MOD Surface
TYPE .
DEP SGE
PURPOSE Draw a rotated and scaled image.

PROTO
transform_draw(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)

DESC
Draws a rotated and scaled version of $[src] on $[dest].
$[angle] the rotation angle in degrees, 
$[xscale] and $[yscale] are x and y scaling factor,
($[px], $[py]) is the pivot point to rotate around in the $[src],
and ($[qx], $[qy]) is the destination point on $[dst] surface.

$[flags] is OR'd combination of follwing values:

:0
  Default
:SDL::Surface::TRANSFORM_SAFE
  Don't asume that the $[src] and $[dst] surfaces has
  the same pixel format. This is the default when the two
  surfaces don't have the same BPP. This is slower but will
  render wierd pixel formats right.
:SDL::Surface::TRANSFORM_AA
  Use the interpolating renderer. Much slower but
  can look better.
:SDL::Surface::TRANSFORM_TMAP
  Use texture mapping. This is a bit faster but
  the result isn't as nice as in the normal mode. This mode
  will also ignore the px/py coordinates and the other flags.

NOTES
To get optimal performance PLEASE make sure that the two
surfaces has the same pixel format (color depth) and doesn't use
24-bpp.

You can set source and destination clipping rectangles with
@[Surface#set_clip_rect].

If you use the interpolated renderer the image will be
clipped 1 pixel in hight and width (to optimize the
performance).

If you want to transform a 32-bpp RGBA (alpha) surface with
the interpolated renderer, please use the 
SDL::TRANSFORM_SAFE flag.

This function will not do any alpha blending, but it will
try to preserve the alpha channel. If you want to rotate and
alpha blend the result, please use @[Surface.transform_blit]
and then blit that surface to its destination.

SEEALSO
Surface.transform_blit
Surface#transform_surface
Surface.new

%%
NAME transform_blit
TYPE .
DEP SGE
PURPOSE Draw a rotated and scaled image with colorkey and blending
OBSOLETE Surface.transform_blit

PROTO
transform_blit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
transformBlit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)

%%
NAME transform_blit
MOD Surface
TYPE .
DEP SGE
PURPOSE Draw a rotated and scaled image with colorkey and blending

PROTO
transform_blit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
transformBlit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)

DESC
Draw a rotated and scaled image. 
This method is same as @[Surface.transform_draw] except
colorkey and blending are enabled. 

SEEALSO
Surface.transform_draw
Surface#transform_surface
Surface#set_color_key
Surface#set_alpha

%%
NAME draw_line
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draw a line

PROTO
draw_line(x1,y1,x2,y2,color, aa=false, alpha=nil)
drawLine(x1,y1,x2,y2,color, aa=false, alpha=nil)

DESC
Draws a $[color] line from ($[x1], $[y1]) to ($[x2], $[y2]).
If $[aa] is true, draws an antialiased line.
If $[alpha] is integer, draws blended line with alpha value
is $[alpha]. 
If $[alpha] is nil, draws a normal line.

SEEALSO
Surface#draw_rect

%%
NAME draw_aa_line
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draw an antialiased line

PROTO
draw_aa_line(x1,y1,x2,y2,color)
drawAALine(x1,y1,x2,y2,color)

OBSOLETE Surface#draw_line
DESC
Draws a $[color] antialiased line from ($[x1], $[y1]) to ($[x2], $[y2]).

SEEALSO
Surface#draw_line

%%
NAME draw_line_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draw a blended line
OBSOLETE Surface#draw_line

PROTO
draw_line_alpha(x1,y1,x2,y2,color,alpha)
drawLineAlpha(x1,y1,x2,y2,color,alpha)

DESC
Draws a $[color] line from ($[x1], $[y1]) to ($[x2], $[y2])
with blending.

SEEALSO
Surface#draw_line

%%
NAME draw_aa_line_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draw an antialiased line with blending.
OBSOLETE Surface#draw_line

PROTO
draw_aa_line_alpha(x1,y1,x2,y2,color,alpha)
drawAALineAlpha(x1,y1,x2,y2,color,alpha)

DESC
Draws a antialiased $[color] line from 
($[x1], $[y1]) to ($[x2], $[y2]) with blending.


SEEALSO
Surface#draw_line

%%
NAME draw_rect
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a rect

PROTO
draw_rect(x,y,w,h,color, fill=false, alpha=nil)
drawRect(x,y,w,h,color, fill=false, alpha=nil)

DESC
Draws a rectangle with color $[color]. 
Draw a filled rectangle if $[fill] is true,
and a blended rectangle if $[alpha] is integer.

SEEALSO
Surface#fill_rect

%%
NAME draw_rect_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a rectangle with blending
OBSOLETE Surface#draw_rect

PROTO
draw_rect_alpha(x,y,w,h,color,alpha)
drawRectAlpha(x,y,w,h,color,alpha)

DESC
Draws a blended rectangle.

SEEALSO
Surface#fill_rect
Surface#draw_rect

%%
NAME draw_filled_rect_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled blended rectangle.
OBSOLETE Surface#draw_rect

PROTO
draw_filled_rect_alpha(x,y,w,h,color,alpha)
drawFilledRectAlpha(x,y,w,h,color,alpha)

DESC
Draws a filled blended rectangle.

SEEALSO
Surface#fill_rect
Surface#draw_rect

%%
NAME draw_circle
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a circle

PROTO
draw_circle(x,y,r,color,fill=false,aa=false,alpha=0)
drawCircle(x,y,r,color,fill=false,aa=false,alpha=0)

DESC
Draws a circle. ($[x],$[y]) is center, 
$[r] is radius and $[color] is drawing color.
If $[fill] is true, draws a filled circle.
If $[aa] is true, draws an antialiased circle.
If $[alpha] is integer, draws a blended circle.

NOTES
You cannot draw a filled antialiased blended circle.

SEEALSO
Surface#draw_ellipse

%%
NAME draw_filled_circle
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled circle.
OBSOLETE draw_circle

PROTO
draw_filled_circle(x,y,r,color)
drawFilledCircle(x,y,r,color)

DESC
Draws a filled circle.

SEEALSO
Surface#draw_circle

%%
NAME draw_aa_circle
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an antialiased circle.
OBSOLETE draw_circle

PROTO
draw_aa_circle(x,y,r,color)
drawAACircle(x,y,r,color)

DESC
Draws an antialiased circle.

SEEALSO
Surface#draw_circle

%%
NAME draw_aa_filled_circle
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled antialiased circle
OBSOLETE draw_circle

PROTO
draw_aa_filled_circle(x,y,r,color)
drawAAFilledCircle(x,y,r,color)

DESC
Draws a filled antialiased circle.

SEEALSO
Surface#draw_circle

%%
NAME draw_circle_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws blended circle
OBSOLETE draw_circle

PROTO
draw_circle_alpha(x,y,r,color,alpha)
drawCircleAlpha(x,y,r,color,alpha)

DESC
Draws blended circle.

SEEALSO
Surface#draw_circle

%%
NAME draw_filled_circle_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled blended circle
OBSOLETE draw_circle

PROTO
draw_filled_circle_alpha(x,y,r,color,alpha)
drawFilledCircleAlpha(x,y,r,color,alpha)

DESC
Draws a filled blended circle.

SEEALSO
Surface#draw_circle

%%
NAME draw_aa_circle_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an antialiased blended circle
OBSOLETE draw_circle

PROTO
draw_aa_circle_alpha(x,y,r,color,alpha)
drawAACircleAlpha(x,y,r,color,alpha)

DESC
Draws an antialiased blended circle

SEEALSO
Surface#draw_circle

%%
NAME draw_ellipse
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an ellipse.

PROTO
draw_ellipse(x,y,rx,ry,color, fill=false, aa=false, alpha=nil)
drawEllipse(x,y,rx,ry,color, fill=false, aa=false, alpha=nil) )

DESC

Draws an ellipse. ($[x],$[y]) is center, 
$[rx] is x-radius, $[ry] is y-radius
and $[color] is drawing color.
If $[fill] is true, draws a filled ellipse.
If $[aa] is true, draws an antialiased ellipse.
If $[alpha] is integer, draws a blended ellipse.

NOTES
You cannot draw a filled antialiased blended ellipse.

SEEALSO
Surface#draw_circle

%%
NAME draw_filled_ellipse
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled ellipse
OBSOLETE Surface#draw_ellipse

PROTO
draw_filled_ellipse(x,y,rx,ry,color)
drawFilledEllipse(x,y,rx,ry,color)

DESC
Draws a filled ellipse.

SEEALSO
Surface#draw_ellipse

%%
NAME draw_aa_ellipse
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an antialiased ellipse
OBSOLETE Surface#draw_ellipse

PROTO
draw_aa_ellipse(x,y,rx,ry,color)
drawAAEllipse(x,y,rx,ry,color)

DESC
Draws an antialiased ellipse.

SEEALSO
Surface#draw_ellipse

%%
NAME draw_aa_filled_ellipse
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled antialiased ellipse
OBSOLETE Surface#draw_ellipse

PROTO
draw_aa_filled_ellipse(x,y,rx,ry,color)
drawAAFilledEllipse(x,y,rx,ry,color)

DESC
Draws a filled antialiased ellipse.

SEEALSO
Surface#draw_ellipse

%%
NAME draw_ellipse_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a blended ellipse
OBSOLETE Surface#draw_ellipse

PROTO
draw_ellipse_alpha(x,y,rx,ry,color,alpha)
drawEllipseAlpha(x,y,rx,ry,color,alpha)

DESC
Draws a blended ellipse.

SEEALSO
Surface#draw_ellipse

%%
NAME draw_filled_ellipse_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a filled blended ellipse
OBSOLETE Surface#draw_ellipse

PROTO
draw_filled_ellipse_alpha(x,y,rx,ry,color,alpha)
drawFilledEllipseAlpha(x,y,rx,ry,color,alpha)

DESC
Draws a filled blended ellipse

SEEALSO
Surface#draw_ellipse

%%
NAME draw_aa_ellipse_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an antialiased blended ellipse
OBSOLETE Surface#draw_ellipse

PROTO
draw_aa_ellipse_alpha(x,y,rx,ry,color,alpha)
drawAAEllipseAlpha(x,y,rx,ry,color,alpha)

DESC
Draws an antialiased blended ellipse.

SEEALSO
Surface#draw_ellipse

%%
NAME draw_bezier
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a bezier curve

PROTO
draw_bezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color,aa=false,alpha=nil)
drawBezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color,aa=false,alpha=nil)

DESC
Draws a bezier curve from ($[x1], $[y1]) to ($[x4], $[y4])
with the control points ($[x2], $[y2]) and ($[x3], $[y3]).
$[level] indicates how
good precision the function should use, 4-7 is normal.
If $[aa] is true, draws an antialiased curve.
If $[alpha] is integer, draws blended curve.

%%
NAME draw_aa_bezier
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an antialiased bezier curve.
OBSOLETE Surface#draw_bezier

PROTO
draw_aa_bezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
drawAABezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)

DESC
Draws an antialiased bezier curve.

SEEALSO
Surface#draw_bezier

%%
NAME draw_bezier_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws a blended bezier curve.
OBSOLETE Surface#draw_bezier

PROTO
draw_bezier_alpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
drawBezierAlpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)

DESC
Draws a blended bezier curve.

SEEALSO
Surface#draw_bezier

%%
NAME draw_aa_bezier_alpha
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Draws an antialiased blended bezier curve
OBSOLETE Surface#draw_bezier

PROTO
draw_aa_bezier_alpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
drawAABezierAlpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)

DESC
Draws an antialiased blended bezier curve.

SEEALSO
Surface#draw_bezier

%%
NAME transform_surface
MOD Surface
TYPE #
DEP SGE
LOCK
PURPOSE Creates an rotated an scaled surface
RVAL Surface

PROTO
transform_surface(bgcolor,angle,xscale,yscale,flags)
transformSurface(bgcolor,angle,xscale,yscale,flags)

DESC
Returns a rotated and scaled version of $[self].
See $[Surface.transform_draw] for more information.
$[bgcolor] is background color that new surface have.

The new surface object will have the same depth 
and pixel format as $[self].

EXCEPTION *

SEEALSO
Surface.transform_draw
Surface.transform_blit