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 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023
|
<html><head><title></title></head>
<body>
<a name="349951">
<h1>1.0 </a>Introduction</h1>
</a>
<a name="349963">
One of the biggest headaches for </a>portability is graphics. The objective evidence is that the field is immature. One cannot exactly say that there are no </a>graphics </a>standards. The real problem is that there are too many standards. Until such time that the world settles down, there will be the need for a tool like PGS.<p>
</a>
<a name="349964">
</a>PGS is an </a>application program interface (</a>API) that is independent of the underlying </a>host graphics system. All of the graphics portability headaches are confined to PGS and applications which use PGS are completely portable. PGS currently sits on top of </a>X Windows on </a>UNIX platforms, </a>Quickdraw on </a>Macintoshes, and Microsoft’s graphics library on </a>DOS platforms.<p>
</a>
<a name="349965">
PGS takes a least common denominator approach regarding what graphics functionality it supports. The goal is to run on the widest variety of machines. This lets out high level graphics capabilities such as real time 3D rotations which depend on specific hardware. On the other hand, any rendering capability that can be implemented with reasonable efficiency in software is fair game for PGS. This model will almost certainly change in time as both graphics hardware and software evolve and become ubiquitous across platforms.<p>
</a>
<a name="349966">
PGS adopts a </a>model in which </a>graphics </a>devices such as display windows and </a>PostScript files are represented by a structure which contains all of their state information. Then PGS can manage an arbitrary number of devices simultaneously and any picture can be drawn to any device.<p>
</a>
<a name="349967">
PGS also structures display surfaces with a </a>viewport defined in </a>normalized coordinates, an enclosing boundary where axes are drawn which is defined as a set of offsets from the viewport window, and a </a>world coordinate system attached to the viewport. The enclosing boundary is useful for obtaining a </a>standoff between rendered data such as line plots and the axes used to measure the rendering.<p>
</a>
<a name="349968">
</a>PGS supports both </a>line and </a>text drawing primitives, </a>line and </a>text attributes, and </a>bit maps for handling images and other </a>cell array data. Most functionality in PGS is either </a>primitive operations such as moves and draws or at a very </a>high level such as axis drawing and the rendering algorithms that it supports. These </a>rendering algorithms have two interfaces: one for “raw” data; and one for PML type </a>mappings. This gives a great deal of flexibility to the application developer.<p>
</a>
<a name="349969">
PGS has the following </a>rendering algorithms currently: 1D</a> line plots; 2D </a>contour plots; 2D </a>vector plots; 2D</a> image plots; 3D </a>wire frame mesh plots (for 2D data sets); and </a>Grotrian diagram plots.<p>
</a>
<a name="349970">
<h1>2.0 </a>Overview of PGS</h1>
</a>
<a name="349971">
</a>PGS has two main goals: to provide a </a>portable interface to various </a>host graphics systems; and to provide </a>high level functionality to applications which most host graphics systems do not provide. To meet these goals it was necessary to develop a model of the kinds of devices which the various host graphics systems support so that the functional interface could be defined and implemented.<p>
</a>
<a name="349972">
It was also necessary to identify which </a>graphics primitives to support. Some host graphics systems have a very rich supply of graphics primitives. In fact, some go way beyond supplying primitive graphics functionality and provide high level rendering capabilities. Other host graphics systems have a relatively small set of primitive graphics operations. The decision was made to design PGS so as to depend on as small a subset of graphics primitives as possible. This makes PGS extremely portable. It also forces PGS to either implement or forego higher level graphics functionality. Hopefully, a useful balance has been struck on this issue.<p>
</a>
<a name="349973">
As the above discussion implies, PGS has two obvious layers. The first layer is a </a>low level one that communicates directly with the host graphics system. The other layer is oriented more toward the application and includes the </a>high level rendering and axis drawing functions. This layer actually breaks down into several layers. The details of this breakdown will be discussed as appropriate.<p>
</a>
<a name="349974">
The remainder of this section discusses the PGS device model and the PGS drawing model.<p>
</a>
<a name="349975">
<h2>2.1 The </a>PGS </a>Device Model</h2>
</a>
<a name="349976">
To provide the maximum degree of </a>portability in what is an inherently </a>platform dependent field, the attempt has been made to isolate all of the platform dependencies behind </a>abstraction barriers. The </a>functional interface provides one set of abstraction barriers. This however does not help with the problem of the notion of </a>graphics state. Graphics state consists of information such as the current default line attributes, default text attributes, coordinate systems, and so on. Furthermore, in a general purpose setting, an application may wish to manage multiple independent devices each with its own separate graphics state.<p>
</a>
<a name="349977">
First, PGS defines a </a>graphics device as an abstract entity containing a logical two dimensional drawing surface and a set of parameters which describe how and where all drawing functions are to be performed on the drawing surface.<p>
</a>
<a name="349978">
Nearly all host graphics systems have their own abstraction barrier wrapped around their drawing surface(s). However, they almost all provide a pointer or index to applications to specify which drawing surface is intended for a particular operation. This latter point is most relevant to windows on display screens, although a file indicator is the correct analog for PostScript or CGM type devices. In any case, PGS handles the interface to the host graphics system and hides it from applications. In the place of the host graphics device indicator, PGS supplies a structure called a </a>PG_device. Applications open and manipulate PG_device’s only. This way all PGS based applications have a single portable interface to all devices supported by PGS.<p>
</a>
<a name="349979">
The </a>PG_device not only contains the host graphics </a>device indicators, it also contains the </a>graphics state for each device. In this way each PG_device is independent of every other PG_device. This gives applications the ability to draw the same picture on every device by simply changing the PG_device passed to the drawing functions. No device conditional logic is required of applications.<p>
</a>
<a name="349980">
The </a>host graphics systems supported by PGS currently are:<p>
</a>
<A NAME="349981"><PRE> </a>X Windows
</PRE><A NAME="349982"><PRE> </a>PostScript
</PRE><A NAME="349983"><PRE> </a>CGM (Computer Graphics Metafile)
</PRE><A NAME="349984"><PRE> </a>Quickdraw (Apple Macintosh)
</PRE><A NAME="349985"><PRE> </a>Microsoft Graphics Library
</PRE><a name="349986">
<p>
</a>
<a name="349987">
<h2>2.2 The </a>PGS </a>Drawing Model</h2>
</a>
<a name="349988">
Almost all </a>host graphics systems employ a drawing model. This specifies information such as coordinate systems and their origins, how clipping is done, and so on. PGS has a somewhat more difficult time coming up with a drawing model since it must present a drawing model that is compatible with all host graphics systems even when the various host graphics systems are in conflict with one another. PGS accomplishes this task by using the least common denominator of the host systems, defining as much of the drawing model as possible, and mapping host graphics systems models into the PGS model.<p>
</a>
<a name="349989">
A PG_device can be thought of as a window on the display area of the host graphics system. In that view, a PGS window can be defined as the region of the host graphics system display surface controlled by PGS during drawing operations. PGS windows then map naturally onto the kinds of windows associated with such host graphics systems as </a>X Windows and </a>Quickdraw. This idea also has application to a </a>PostScript or </a>CGM device.<p>
</a>
<a name="349990">
<h3>2.2.1 </a>PGS </a>Window Placement</h3>
</a>
<a name="349991">
In placing a PGS window which contains the drawing surface on a display screen or a PostScript page, the position of the upper left corner of the PGS window is given in </a>normalized coordinates relative to a coordinate origin in the upper left corner of the </a>host graphics system device.<p>
</a>
<a name="349992">
<p>
</a>
<a name="349993">
<p>
</a>
<a name="349994">
<p>
</a>
<a name="349995">
<p>
</a>
<a name="349996">
<p>
</a>
<a name="349997">
<p>
</a>
<a name="349998">
<p>
</a>
<a name="349999">
<p>
</a>
<a name="350000">
<p>
</a>
<a name="350001">
<p>
</a>
<a name="350002">
<p>
</a>
<a name="350003">
<h3>2.2.2 </a>Frames, </a>Viewports, and </a>View Boundaries</h3>
</a>
<a name="350004">
Any part of the interior of a </a>PGS </a>window may be drawn on by PGS routines. Windows do have some additional structure to help applications conveniently handle high level plotting constructs.<p>
</a>
<a name="350470">
A window may be </a>partitioned into frames with a view to drawing more than one plot at a time. Within each frame there is a preferred drawing area called the </a>viewport. The viewport is defined relative to its enclosing frame and by default each window has a single frame which is the same size as the window. PGS supports </a>clipping which can render it impossible to draw to any part of the window but the current viewport.<p>
</a>
<a name="350005">
In addition to the viewport there is a bounding region of the viewport which is used to offset axes from the viewport so that there is a nice, application controllable separation between the axes and whatever is drawn in the viewport. This bounding region is called the view boundary.<p>
</a>
<a name="350006">
<p>
</a>
<a name="350007">
<p>
</a>
<a name="350008">
<p>
</a>
<a name="350009">
<p>
</a>
<a name="350010">
<p>
</a>
<a name="350011">
<p>
</a>
<a name="350012">
<p>
</a>
<a name="350013">
<p>
</a>
<a name="350014">
<p>
</a>
<a name="350015">
<p>
</a>
<a name="350016">
<p>
</a>
<a name="350017">
<p>
</a>
<a name="350018">
<p>
</a>
<a name="350019">
<p>
</a>
<a name="350020">
<p>
</a>
<a name="350021">
<p>
</a>
<a name="350022">
The </a>viewport and </a>view boundary are tied together. When an application defines the viewport, the view boundary is implicitly defined in terms of offsets from the viewport. These are referred to as </a>topspace, </a>leftspace, </a>rightspace, and </a>botspace.<p>
</a>
<a name="350023">
The application can move the frame or viewport around in the PGS window at any time as well as altering its size.<p>
</a>
<a name="350024">
<h3>2.2.3 </a>Coordinate Systems</h3>
</a>
<a name="350025">
Inside a </a>PGS </a>window there are three coordinate systems: </a>world coordinates, </a>normalized coordinates, and </a>pixel coordinates. World coordinates are application defined and have whatever meaning the application requires. The lower left corner of the </a>viewport corresponds to the minium x and y values of the world coordinate domain. Normalized coordinates represent the fraction of the PGS window width and height that a point is from the origin which is in the lower left corner of the PGS window. Pixel coordinates represent the integer number of pixels that a point is from the origin which is in the lower left corner of the PGS window.<p>
</a>
<a name="350026">
PGS supplies a set of macros to convert between all of the coordinate systems which a PGS window may have.<p>
</a>
<a name="350027">
<h1>3.0 </a>The PGS User Interface Model</h1>
</a>
<a name="350028">
The subject of user interfaces can be a rather complicated one. For many applications the most natural interface is a graphical one. However, some systems make the mistake of insisting that a graphical interface is the only interface which an application may have. PGS supports a model of user interfaces that permits the application developer to seek the natural interface for his or her application. This means that PGS supports development of </a>textual interfaces, </a>graphical interfaces, and hybrids. In the following sections, we will discuss the concepts underlying user interfaces from PGS’s point of view (PGS emphasizes portability and flexibility especially).<p>
</a>
<a name="350029">
<h2>3.1 </a>A Textual Interface</h2>
</a>
<a name="350030">
Consider the following program fragment which is typical of an application with a textual interface:<p>
</a>
<A NAME="350031"><PRE> char s[MAXLINE], *t;
</PRE><A NAME="350032"><PRE> char *dispatch(char *s);
</PRE><A NAME="350033"><PRE>
</PRE><A NAME="350034"><PRE> printf(“-> “);
</PRE><A NAME="350035"><PRE> while (fgets(s, MAXLINE, stdin) != NULL)
</PRE><A NAME="350036"><PRE> {t = dispatch(s);
</PRE><A NAME="350037"><PRE> printf(“%s\n-> “, t);};
</PRE><A NAME="350038"><PRE>
</PRE><a name="350039">
This code prints a prompt, gets some input (</a>fgets), processes it (dispatch), and prints the result. It does this in a loop until something ends the program.<p>
</a>
<a name="350040">
For a program so simple and ordinary, it is astonishing how difficult some systems make it to run this code. One of the peg points of PGS is that it must be “easy” to run such an application whether the system wants to make it easy or hard. Some of the graphical user interface models can be ported with some careful abstraction barriers (and PGS does this too), but this example is something of a lowest common denominator. So we will start with this and build up a model that supports this simple text driven style and the most elaborate graphical application.<p>
</a>
<a name="350041">
<h2>3.2 </a>Adding Abstraction Barriers</h2>
</a>
<a name="350042">
By adding two macros and two function pointers we can make an enormous shift in the portability of this program:<p>
</a>
<A NAME="350043"><PRE> #define </a>GETLN (*getln)
</PRE><A NAME="350044"><PRE> #define </a>PRINT (*putln)
</PRE><A NAME="350045"><PRE> char *(*</a>getln)(char *s, int n, FILE *fp)
</PRE><A NAME="350046"><PRE> int (*</a>putln)(FILE *fp, char *fmt, ...)
</PRE><a name="350047">
These items are defined in </a>score.h which is #included by </a>pgs.h<p>
</a>
<a name="350048">
With these elements we can modify the original example as follows:<p>
</a>
<A NAME="350049"><PRE> char s[MAXLINE], *t;
</PRE><A NAME="350050"><PRE> char *dispatch(char *s);
</PRE><A NAME="350051"><PRE>
</PRE><A NAME="350052"><PRE> getln = fgets;
</PRE><A NAME="350053"><PRE> putln = fprintf;
</PRE><A NAME="350054"><PRE>
</PRE><A NAME="350055"><PRE> PRINT(stdout, “-> “);
</PRE><A NAME="350056"><PRE> while (GETLN(s, MAXLINE, stdin) != NULL)
</PRE><A NAME="350057"><PRE> {t = dispatch(s);
</PRE><A NAME="350058"><PRE> PRINT(stdout, “%s\n-> “, t);};
</PRE><A NAME="350059"><PRE>
</PRE><a name="350060">
This doesn’t look like much at all, but the impact of this change is enormous! Now we can insert other functions which are call compatible with the standard C library functions, </a>fgets and </a>fprintf. PGS supplies two such functions: </a>PG_wind_fgets and </a>PG_fprintf. In fact, when a call to </a>PG_open_device or </a>PG_open_console is made these functions are connected to </a>getln and </a>putln for you!<p>
</a>
<a name="350061">
PG_wind_fgets, in addition to looking for input from the terminal as </a>fgets does, also looks for events from the windowing system under which the application is running. </a>PG_fprintf prints your formatted text to a terminal or to a screen window depending on what is appropriate to the system on which the application is running.<p>
</a>
<a name="350062">
This example can be filled out to a complete program (modulo the definition of the dispatch function) which is completely portable:<p>
</a>
<A NAME="350063"><PRE> #include <pgs.h>
</PRE><A NAME="350064"><PRE> main(int c, char **v)
</PRE><A NAME="350065"><PRE> {char s[MAXLINE], *t;
</PRE><A NAME="350066"><PRE> char *dispatch(char *s);
</PRE><A NAME="350067"><PRE>
</PRE><A NAME="350068"><PRE> PG_open_console(“test”, “COLOR”, TRUE, 0.1, 0.7, 0.5, 0.3);
</PRE><A NAME="350069"><PRE> PRINT(stdout, “-> “);
</PRE><A NAME="350070"><PRE> while (GETLN(s, MAXLINE, stdin) != NULL)
</PRE><A NAME="350071"><PRE> {t = dispatch(s);
</PRE><A NAME="350072"><PRE> PRINT(stdout, “%s\n-> “, t);};
</PRE><A NAME="350073"><PRE> return(0);}
</PRE><a name="350074">
There is an important issue remaining here and that is the subject of the next section.<p>
</a>
<a name="350075">
<h2>3.3 </a>Multiplexed I/O and Interrupt Driven I/O</h2>
</a>
<a name="350076">
In the program we have been discussing, input is gathered from either the terminal or the windowing system. This is an example of </a>multiplexed I/O. Many applications use multiplexed I/O. It is common in networking programs for example. With multiplexed I/O a variety of input sources are polled to see whether there is any input ready. Depending on the device that has input, the application takes the appropriate action as it becomes available. In the more efficient applications the operating system is usually involved since it is better able to control machine resources than any application.<p>
</a>
<a name="350077">
Our sample program doesn’t necessarily need to do multiplexed I/O (on the other hand we haven’t said what the dispatch function does!). If it were a graphical application however the chances are that it would have to handle input from both the terminal and from the windowing system. </a>GETLN, more specifically </a>PG_wind_fgets, does just that. If the specified FILE pointer is stdin, it obtains input from either source, and copies terminal input into the buffer passed in as an argument or dispatches input from the windowing system (also referred to as events) to functions which are registered with PGS to handle specific kinds of events. If the specified FILE pointer is in fact something beside stdin it simple performs an “fgets” on that file. </a>PG_wind_fgets only returns when a newline or an end of file condition is encountered. For terminal input this means typing a carriage return.<p>
</a>
<a name="350078">
It appears that input can only be handled when </a>GETLN is called. However, it is often desirable to have input handled whenever it comes in. Some operating systems support this through the use of assignable interrupts. Input handled this way is said to be interrupt driven. In PGS, when a screen window is opened all of the machinery is put into place to allow interrupt driven I/O. The application switches interrupt handling on and off through the macro </a>PG_IO_INTERRUPTS which take a value of TRUE to turn it on and FALSE to turn it off. When I/O interrupts are on input from the terminal is saved in a buffer to be copied into the buffer of the next </a>GETLN call, and input from the windowing system is dispatched to the appropriate event handler. After the input is processed the interrupt handler returns and execution resumes from the point where the interrupt occurred.<p>
</a>
<a name="350079">
With </a>interrupt driven I/O activated, our simple program has all the capabilities of a vastly more complicated application written for certain specific operating environments which enforce a graphical interface only mode of programming. The fact that PGS runs on such systems as wells as those that support text only or </a>hybrid interfaces should give some idea of the idea of portability and flexibility which PGS aims to provide.<p>
</a>
<a name="350080">
<h2>3.4 </a>Event Handling</h2>
</a>
<a name="350081">
Now that we have seen how input is handled in the broadest terms and how PGS presents a portable application interface for input handling, let’s turn to an closer examination of the way in which input from a windowing system is dealt with. Generically, window input is said to consist of sequences of </a>events. Events can be such things as key presses when the mouse or locator is in a window, mouse button presses and releases, or the locator entering or leaving a window.<p>
</a>
<a name="350082">
Different windowing system define varying sets of events. PGS supports the following set of </a>events everywhere:<p>
</a>
<A NAME="350083"></a>KEY_DOWN_EVENT a </a>key on the </a>keyboard is </a>pressed
<P><A NAME="350084"></a>KEY_UP_EVENT a key on the keyboard is </a>released
<P><A NAME="350085"></a>MOUSE_DOWN_EVENT a </a>mouse button is pressed
<P><A NAME="350086"></a>MOUSE_UP_EVENT a mouse button is released
<P><A NAME="350087"></a>UPDATE_EVENT the window system says that the window has changed
<P><A NAME="350088"> in some way
<P><A NAME="350089"></a>EXPOSE_EVENT the window has become fully visible (is no longer
<P><A NAME="350090"> obscured by another window
<P><A NAME="350091"></a>MOTION_EVENT the mouse has moved in the window
<P><a name="350092">
It should be understood that all events have a context. They all happen in or relate to a particular screen window. So when PGS get notified by the windowing system that there is an event present, it determines which window is effected. It then passes both the pointer to the effected window and the event on to the function which is going to handle the event.<p>
</a>
<a name="350093">
<h3>3.4.1 Event Handling Functions</h3>
</a>
<a name="350094">
Given the above list of recognized events, PGS defines a function pointer (hook) associated with each type of event so that applications may control what is done with specific events. The following functions let applications assign their function to these hooks.<p>
</a>
<A NAME="350095><I>C Binding: </I></a>PFByte </a>PG_set_key_down_event_handler(PG_device *d, void
(*fnc)())
<BR><A NAME="352504"><I>F77 Binding: </I>integer </a>pgsekd(integer d, fnc)
<BR><A NAME="352505"><I>SX Binding: </I>
<P><A NAME="352524"><PRE>
</PRE><A NAME="350096><I>C Binding: </I></a>PFByte </a>PG_set_key_up_event_handler(PG_device *d, void (*fnc)())
<BR><A NAME="352517"><I>F77 Binding: </I>integer </a>pgseku(integer d, fnc)
<BR><A NAME="352516"><I>SX Binding: </I>
<P><A NAME="352523"><PRE>
</PRE><A NAME="350097><I>C Binding: </I></a>PFByte </a>PG_set_mouse_down_event_handler(PG_device *d, void
(*fnc)())
<BR><A NAME="352515"><I>F77 Binding: </I>integer </a>pgsemd(integer d, fnc)
<BR><A NAME="352514"><I>SX Binding: </I>
<P><A NAME="352522"><PRE>
</PRE><A NAME="350098><I>C Binding: </I></a>PFByte </a>PG_set_mouse_up_event_handler(PG_device *d, void
(*fnc)())
<BR><A NAME="352513"><I>F77 Binding: </I>integer </a>pgsemu(integer d, fnc)
<BR><A NAME="352512"><I>SX Binding: </I>
<P><A NAME="352521"><PRE>
</PRE><A NAME="350099><I>C Binding: </I></a>PFByte </a>PG_set_update_event_handler(PG_device *d, void (*fnc)())
<BR><A NAME="352511"><I>F77 Binding: </I>integer </a>pgseup(integer d, fnc)
<BR><A NAME="352510"><I>SX Binding: </I>
<P><A NAME="352520"><PRE>
</PRE><A NAME="350100><I>C Binding: </I></a>PFByte </a>PG_set_expose_event_handler(PG_device *d, void (*fnc)())
<BR><A NAME="352508"><I>F77 Binding: </I>integer </a>pgseex(integer d, fnc)
<BR><A NAME="352509"><I>SX Binding: </I>
<P><A NAME="352519"><PRE>
</PRE><A NAME="350101><I>C Binding: </I></a>PFByte </a>PG_set_default_event_handler(PG_device *d, void (*fnc)())
<BR><A NAME="352506"><I>F77 Binding: </I>integer </a>pgsedf(integer d, fnc)
<BR><A NAME="352507"><I>SX Binding: </I>
<P><A NAME="352518"><PRE>
</PRE><a name="350102">
These assign the specified function fnc to be the event handler for the device, d. The function fnc is a pointer to a function returning nothing which takes a PG_device pointer and a PG_event pointer as arguments.The C routines all return the old value of the hook and the following typedef applies:<p>
</a>
<A NAME="350103"><PRE> typedef void (*</a>PFByte)();
</PRE><a name="350104">
To explicitly call these functions in a generic way (i.e. regardless of the specific function attached to the hook) use the following macros:<p>
</a>
<A NAME="350105"><BR><B>void </a>PG_handle_key_down_event(PG_device *d, PG_event *ev)
</B><BR><A NAME="350106"><BR><B>void </a>PG_handle_key_up_event(PG_device *d, PG_event *ev)
</B><BR><A NAME="350107"><BR><B>void </a>PG_handle_mouse_down_event(PG_device *d, PG_event *ev)
</B><BR><A NAME="350108"><BR><B>void </a>PG_handle_mouse_up_event(PG_device *d, PG_event *ev)
</B><BR><A NAME="350109"><BR><B>void </a>PG_handle_update_event(PG_device *d, PG_event *ev)
</B><BR><A NAME="350110"><BR><B>void </a>PG_handle_expose_event(PG_device *d, PG_event *ev)
</B><BR><A NAME="350111"><BR><B>void </a>PG_handle_default_event(PG_device *d, PG_event *ev)
</B><BR><a name="350112">
These simply call the specified event handler with the PG_device and PG_event. The default event handler is an additional way to handle events. The application can have a single handler for all events. For example, when PGS gets a mouse down event it first checks to see whether there is a mouse down handler. If so it is called. If not it then checks to see whether there is a default handler and if so calls it.<p>
</a>
<a name="350113">
<h3>3.4.2 Event Related Macros</h3>
</a>
<a name="350114">
In addition to the above which have to do with routing events off to handlers, there are some other macros which the event handlers or user call-back functions can use to access event information.<p>
</a>
<a name="352529">
<p>
</a>
<A NAME="350115><I>C Binding: </I>void </a>PG_GET_NEXT_EVENT(PG_event ev)
<BR><A NAME="352525"><I>F77 Binding: </I>
<BR><A NAME="352526"><I>SX Binding: </I>
<P><a name="350116">
Does a blocking read of the next event from the windowing system and fills in the specified PG_event structure, ev.<p>
</a>
<a name="352541">
<p>
</a>
<A NAME="352536><I>C Binding: </I>void </a>PG_KEY_EVENT_INFO(PG_device *d, PG_event ev, int *x, int
*y, char *bf, int *n, int *mod)
<BR><A NAME="352537"><I>F77 Binding: </I>integer </a>pgqkbd(integer d, integer x, integer y, integer c, integer mod)
<BR><A NAME="352538"><I>SX Binding: </I>
<P><a name="352539">
Return the state of the </a>keyboard for the specified window, d. The x and y coordinates of the mouse or locator, which key is pressed, and which modifiers are present are returned in x, y, c, and mod respectively. In the F77 binding this is associated only with one specific keyboard event. It should be called only a single time from a </a>key-down-event handler. In the C binding the actual keyboard event is supplied in ev.<p>
</a>
<a name="352540">
<p>
</a>
<A NAME="350117><I>C Binding: </I>void </a>PG_query_pointer(PG_device *d, int *px, int *py, int *pb, int
*pq)
<BR><A NAME="352527"><I>F77 Binding: </I>integer </a>pgqptr(integer d, integer x, integer y, integer b, integer q)
<BR><A NAME="352528"><I>SX Binding: </I>
<P><a name="350118">
Return the state of the </a>mouse </a>locator or pointer for the specified window, d. The x and y coordinates, which button is pressed, and with modifiers are present are returned in px, py, pb, and pq respectively. <p>
</a>
<a name="350119">
The buttons are:<p>
</a>
<A NAME="350120"></a>MOUSE_LEFT
<P><A NAME="350121"></a>MOUSE_MIDDLE
<P><A NAME="350122"></a>MOUSE_RIGHT
<P><a name="350123">
The modifiers are:<p>
</a>
<A NAME="350124"></a>KEY_SHIFT
<P><A NAME="350125"></a>KEY_CNTL
<P><A NAME="350126"></a>KEY_ALT
<P><A NAME="350127"></a>KEY_LOCK
<P><A NAME="352530">
<P><A NAME="350128><I>C Binding: </I>PG_device *</a>PG_get_event_device(PG_event ev)
<BR><A NAME="352531"><I>F77 Binding: </I>
<BR><A NAME="352532"><I>SX Binding: </I>
<P><a name="350129">
Return a pointer to the PG_device (screen window) in which the event, ev, occurred or to which it relates.<p>
</a>
<a name="352535">
<p>
</a>
<A NAME="350130><I>C Binding: </I>int </a>PG_get_char(PG_device *d)
<BR><A NAME="352533"><I>F77 Binding: </I>
<BR><A NAME="352534"><I>SX Binding: </I>
<P><a name="350131">
Return the ASCII code of the next character entered from the keyboard into the specified PG_device, d.<p>
</a>
<a name="350132">
<h2>3.5 </a>Interface Objects</h2>
</a>
<a name="350133">
As it stands we have explained the basic machinery by which PGS provides applications with the capability to get input from the terminal or from the windowing system and how various events may be handled. This is a foundation upon which graphical user interfaces may be built. PGS also provides more machinery (which is layered on top of what we have already discussed) to support the construction and editing of graphical user interfaces. The goal goes beyond portability and flexibility to that of enabling the design, construction, testing, and modification of graphical interfaces. This is done in a way that is extremely compact to implement and to use. It lets application developers pass on to their users the ability to modify user interfaces to suit their own individual needs. This can even be done at run time! It is also portable!!!<p>
</a>
<a name="350134">
The principal notion underlying this facility is the abstraction called an interface object. It identifies and encapsulates the fundamental interactions of a user with the windowing system which underlies everything and the “atoms” of such a system. An interface object is a structure which contains the following information and methods:<p>
</a>
<A NAME="350135">Type a string which identifies and differentiates interface objects
<P><A NAME="350136">Region a polygonal region in the window defining the context of the object
<P><A NAME="350137">Visible flag specifies whether the object is to be drawn or not
<P><A NAME="350138">Selectable flag specifies whether the object can be selected or not
<P><A NAME="350139">Active flag specifies whether the object is currently active or not
<P><A NAME="350140">Draw method how to draw the object if it is visible
<P><A NAME="350141">Select method how to select the object if it is selectable
<P><A NAME="350142">Action method what action to take when the object is active or activated
<P><A NAME="350143">Parent interface object of which this is a child
<P><A NAME="350144">Children array of child interface objects
<P><a name="350145">
Each PG_device has a tree of interface objects associated with it. Interface objects are created by calls to </a>PG_make_interface_object. These objects individually and by virtue of their relationship in a hierarchy allow one to define the conventional graphical interface tools such as buttons, slider bars, and text boxes. The mechanism is very open ended and extensible. By defining the draw, select, and action methods and building trees of interface objects, application developers can generate virtually any kind of graphical interface functionality they wish.<p>
</a>
<a name="350146">
The window region defines a place on the screen to which to assign certain interpretations of mouse events, most notably button press and motion events. Keeping in mind such elements of a graphical interface as “dialog boxes”, it is clear that an object may or may not be drawn at all times. That is left to the interface designer to decide. So a flag and a method control the visibility of an interface object. Similarly depending on the context, an interface object may or may not be selectable. Selection is the process in which mouse events are associated with the designated window region. If an interface object is not selectable, no association is made between a mouse event and the region of the object. The action associated with an interface object can be very nebulous indeed. It can range from a function call when the object is selected to a value to be assigned to an associated variable when the object is selected. Here again, it is up to the application designer to decide.<p>
</a>
<a name="350147">
When defining one interface object to be the child of another, the region of the child is defined in coordinates normalized with respect to the enclosing rectangle of the parent. This makes for a much more flexible and intuitive design in that deeply nested objects only refer to their parents not to the entire outer context. Changing subtrees is much easier since the children are specified relative to the parents.<p>
</a>
<a name="350148">
In addition, interface objects have a border width, a foreground and background color, and a pointer to which anything can be assigned (e.g. a variable or some other structure). These items may be used in fairly arbitrary ways by applications. PGS uses them for the pre-defined objects as discussed in the next section.<p>
</a>
<a name="350149">
<h3>3.5.1 </a>Event Handling and Interface Objects</h3>
</a>
<a name="350150">
The event handler embedded in </a>PG_wind_fgets treats events from the windowing system in following order fashion:<p>
</a>
<A NAME="350151"><PRE> </PRE>Checks to see whether a mouse down or key down event occurred inside any selectable
interface object.
<BR><A NAME="350152"><PRE> </PRE>If inside an interface object that has an action, then that action is called.
<BR><A NAME="350153"><PRE> </PRE>Otherwise if there is a handler for the event type, it is called.
<BR><a name="350154">
<h3>3.5.2 </a>Portable User Interface Description</h3>
</a>
<a name="350155">
PGS has an ASCII representation of interface objects so that interface designers can simply write text files, called </a>portable user interface files, that describe the interface and have PGS read and interpret them at run time, modify them interactively, and write them back out again. Thus the interfaces can be edited graphically at run time or textually with your favorite text editor. At this writing the only option which PGS supplies for graphical editing is moving objects around. Creation, deletion, duplication, and resizing are planned for future releases. However, these options can all be accomplished by editing the interface file or by application supplied editing routines.<p>
</a>
<a name="350156">
<h4>3.5.2.1 </a>Syntax for Interface Description</h4>
</a>
<a name="350157">
The syntax for describing an interface object is:<p>
</a>
<A NAME="350158">type [operator(parameters)]* BND(parameter) points [{ children }]
<P><a name="350159">
Valid operators are:<p>
</a>
<A NAME="350160">ACT names function that does object action when active
<P><A NAME="350161">BND boundary specifier
<P><A NAME="350162">CLR specifies fore and background colors (by index)
<P><A NAME="350163">DRW names function that draws object when visible
<P><A NAME="350164">FLG state flags
<P><A NAME="350165">NAME object name
<P><A NAME="350166">SEL names function that identifies object as selected when selectable
<P><a name="350167">
Valid BND parameters are:<p>
</a>
<A NAME="350168">n an integer number of NDC points (x, y) follow
<P><A NAME="350169">RECT 2 NDC points specifying the lower left and upper right limits of a boundary
rectangle follow
<P><a name="350170">
Valid FLG parameters are:<p>
</a>
<A NAME="350171">IsVis object is visible
<P><A NAME="350172">IsSel object is selectable
<P><A NAME="350173">IsAct object is active
<P><a name="350174">
Valid CLR parameters are (using the standard color table):<p>
</a>
<A NAME="350175">0 logical </a>BLACK
<P><A NAME="350176">1 logical </a>WHITE
<P><A NAME="350177">2 </a>LGHT_WHITE
<P><A NAME="350178">3 </a>GRAY
<P><A NAME="350179">4 </a>BLUE
<P><A NAME="350180">5 </a>GREEN
<P><A NAME="350181">6 </a>CYAN
<P><A NAME="350182">7 </a>RED
<P><A NAME="350183">8 </a>MAGENTA
<P><A NAME="350184">9 </a>BROWN
<P><A NAME="350185">10 </a>LGHT_BLUE
<P><A NAME="350186">11 </a>LGHT_GREEN
<P><A NAME="350187">12 </a>LGHT_CYAN
<P><A NAME="350188">13 </a>LGHT_RED
<P><A NAME="350189">14 </a>YELLOW
<P><A NAME="350190">15 </a>LGHT_MAGENTA
<P><a name="350191">
The default for FLG parameters is IsVis and IsSel. You only need use the FLG operator if you wish to change this setting. Each parameter specified turns on its corresponding flag. To turn all flags off use FLG( ) (one space between the parentheses).<p>
</a>
<a name="350192">
A line break may occur between operator specifications. The descriptions of children of an object are delimited by curly braces.<p>
</a>
<a name="350193">
To make this text driven representation work, it is necessary to have a mechanism to register functions and variables with PGS so that a function or variable can be looked up by name. The functions </a>PG_register_callback and </a>PG_register_variable do just this.<p>
</a>
<a name="350194">
This is a very general mechanism for assigning events to actions and generically handling common activities on behalf of applications. PGS goes one step further and supplies a number of specific interface objects.<p>
</a>
<a name="350195">
<h2>3.6 PGS Interface Objects</h2>
</a>
<a name="350196">
The specific objects which PGS supplies are: CONTAINER, BUTTON, TEXT, and VARIABLE. With these objects and some defined relationships between them it is possible to build most of the common “widgets” found in the sets supplied with various systems.<p>
</a>
<a name="350197">
With all of the objects which PGS defines the following hold true: if an object is not visible, then its children are not visible either; if an object is not selectable then its children are not selectable either; if the border width is not zero, a black border is drawn around the object; and if the background color of an object is -1 the closest ancestor with a background color other than -1 supplies the background color.<p>
</a>
<a name="350198">
PGS interface objects have two kinds of containment associations: visual containment in which child objects appear visually (on the screen) within the region defined by their parents; and logical containment in which only the position in the hierarchy defines the containment association relationship, that is children are logically contained within their parents.<p>
</a>
<a name="350199">
The </a></a>CONTAINER object is defined simply to specify logical containment of objects. When looking up a hierarchy it is a natural breakpoint to identify groups of objects which may have to collectively respond to events (we’ll see examples of this later). It also can be used just to ensure that a border is drawn around a group of other objects (these would have to be children of the container).<p>
</a>
<a name="350200">
The </a>BUTTON object is defined as a trigger. When a mouse down event happens in a button object a chain of events is set off. This covers initiation of call back functions, setting the value of a VARIABLE object, or moving a slider around. It depends on what the button means (as defined by context in a hierarchy or by its action method).<p>
</a>
<a name="350201">
A </a></a>TEXT object is an encapsulation of a PG_text_box structure and the methods which accompany it. The text box is a collection of text and editing functions. The editing functions supply an EMACS-like text manipulation facility for any quantity of text from one line to as much text as can be loaded into memory. Text boxes with a single line of text have the text centered in the box and multi-line text boxes have their text left justified.<p>
</a>
<a name="350202">
A </a></a>VARIABLE object binds a variable to an interface object. The parent, siblings, and children of the VARIABLE object define its actual behavior.<p>
</a>
<a name="350203">
PGS predefines the following methods using </a>PG_register_callback:<p>
</a>
<A NAME="350204"><CENTER><B></B></CENTER><A NAME="350205"></a>draw-text draw a text object (default for TEXT objects)
<P><A NAME="350206"></a>draw-variable draw a variable object (default for VARIABLE objects)
<P><A NAME="350207"></a>draw-container draw a container object (default for CONTAINER objects)
<P><A NAME="350208"></a>draw-button draw a button object (default for BUTTON objects)
<P><A NAME="350209"></a>draw-slider draw a slider button
<P><A NAME="350210"><CENTER><B></B></CENTER><A NAME="350211"></a>select-visual select based on visual containment
<P><A NAME="350212"></a>select-logical select based on logical containment
<P><A NAME="350213"><CENTER><B></B></CENTER><A NAME="350214"></a>slider action function for slider buttons
<P><A NAME="350215"></a>toggle action function to toggle visibility and selectability of objects
<P><a name="350216">
With these building blocks in hand we will look at some common widgets found in many graphical user interface kits. It is very important to note that much of the behavior of these objects derives from their relative positions in the hierarchy of interface objects. This position relationship contributes as much as the atomic properties of the individual objects to the functioning of these combinations. This is a key feature in the flexibility of the PGS design.<p>
</a>
<a name="350217">
<h3>3.6.1 </a>Buttons</h3>
</a>
<a name="350218">
The intended functionality is a “button” on the screen which when selected by a mouse click invokes a function. For example, consider an “End” button to terminate an applications:<p>
</a>
<A NAME="350219"><CODE>Button CLR(3,2) DRW(draw-button) ACT(End) BND(RECT) (0.1,0.9) (0.2,0.95)
</CODE><BR><A NAME="350220"><CODE> {Text NAME(End) CLR(10,-1) FLG(IsVis) DRW(draw-text) BND(RECT) (0.05,0.3) (0.95,0.7)}
</CODE><BR><a name="350221">
The action method of the button is the function associated with the string “End” in the callback table. The text “End” appears in the button and is visible but not selectable.<p>
</a>
<a name="350222">
<h3>3.6.2 </a>Enumerable Variables</h3>
</a>
<a name="350223">
Certain variables have a small number of possible values and it is convenient and pleasing to present buttons for each possible value and have the user select the desired one. This situation might look like this:<p>
</a>
<A NAME="350224"><CODE>Container CLR(0,0) BND(RECT) (0.1,0.82) (0.25,0.87)
</CODE><BR><A NAME="350225"><CODE> {Variable NAME(Output) CLR(10,0) BND(RECT) (0.0,0.49) (1.0,1.0)
</CODE><BR><A NAME="350226"><CODE> {Button CLR(3,2) ACT(1) BND(RECT) (0.0,-1.0) (0.5,0.0)
</CODE><BR><A NAME="350227"><CODE> {Text NAME(On) CLR(10,-1) FLG(IsVis) BND(RECT) (0.05,0.05) (0.95,0.95)}
</CODE><BR><A NAME="350228"><CODE> Button CLR(3,2) ACT(0) BND(RECT) (0.5,-1.0) (1.0,0.0)
</CODE><BR><A NAME="350229"><CODE> {Text NAME(Off) CLR(10,-1) FLG(IsVis) BND(RECT) (0.05,0.05) (0.95,0.95)}}}
</CODE><BR><a name="350230">
The children of the variable registered using </a>PG_register_variable under the name “Output” are buttons which when selected set the value of the variable to the value taken from the action of the button (1 for the “On” button and 0 for the “Off” button). A second more elaborate example shows this same principle:<p>
</a>
<A NAME="350231"><CODE>Container CLR(0,0) BND(RECT) (0.85,0.88) (1.0,1.0)
</CODE><BR><A NAME="350232"><CODE> {Variable NAME(Direction) CLR(10,0) BND(RECT) (0.2,0.0) (0.8,0.2)
</CODE><BR><A NAME="350233"><CODE> {Button CLR(3,2) ACT(“n”)
</CODE><BR><A NAME="350234"><CODE> BND(5) (0.51,3.12) (0.64,3.53) (0.51,3.88) (0.36,3.53) (0.51,3.12)
</CODE><BR><A NAME="350235"><CODE> {Text NAME(N) CLR(10,0) FLG(IsVis) BND(RECT) (0.0,1.0) (1.0,2.0)}
</CODE><BR><A NAME="350236"><CODE> Button CLR(3,2) ACT(“e”)
</CODE><BR><A NAME="350237"><CODE> BND(5) (0.55,3.0) (0.7,2.59) (0.9,3.0) (0.7,3.41) (0.55,3.0)
</CODE><BR><A NAME="350238"><CODE> {Text NAME(E) CLR(10,0) FLG(IsVis) BND(RECT) (1.0,0.0) (2.0,1.0)}
</CODE><BR><A NAME="350239"><CODE> Button CLR(3,2) ACT(“s”)
</CODE><BR><A NAME="350240"><CODE> BND(5) (0.51,2.88) (0.36,2.53) (0.51,2.12) (0.64,2.53) (0.51,2.88)
</CODE><BR><A NAME="350241"><CODE> {Text NAME(S) CLR(10,0) FLG(IsVis) BND(RECT) (0.0,-1.0) (1.0,0.0)}
</CODE><BR><A NAME="350242"><CODE> Button CLR(3,2) ACT(“w”)
</CODE><BR><A NAME="350243"><CODE> BND(5) (0.45,3.0) (0.3,3.41) (0.1,3.0) (0.3,2.59) (0.45,3.0)
</CODE><BR><A NAME="350244"><CODE> {Text NAME(W) CLR(10,0) FLG(IsVis) BND(RECT) (-1.0,0.0) (0.0,1.0)}}}
</CODE><BR><a name="350245">
Here a variable registered under the name “Direction” has four buttons (which are not rectangles), “N”, “E”, “S”, and “W” which take values that are strings and the text of the buttons is outside of the buttons at the points.<p>
</a>
<a name="350246">
<h3>3.6.3 </a>Nonenumerable Variables</h3>
</a>
<a name="350247">
Sometimes variables do not take a small set of discrete values. In such a case a reasonably natural way for a graphical interface to set the variable is to enter the text representation of the value and have it converted to the appropriate binary form. PGS currently only supports ints, longs, floats, doubles, and strings in this way. Here is an example of this:<p>
</a>
<A NAME="350248"><CODE>Container CLR(0,0) BND(RECT) (0.26,0.82) (0.39,0.87)
</CODE><BR><A NAME="350249"><CODE> {Variable NAME(Theta) CLR(10,0) BND(RECT) (0.0,0.49) (1.0,1.0)
</CODE><BR><A NAME="350250"><CODE> {Text NAME(30) CLR(10,-1) BND(RECT) (0.05,-0.95) (0.95,-0.05)}}
</CODE><BR><a name="350251">
The text “30” might be the initial value for the variable registered using </a>PG_register_variable under the name “Theta”. PGS uses the actual current value of the variable in the code for all display purposes. To change the value, you place the cursor in the region of the text, edit it to show the correct value, and hit a carriage return. The value of the variable is then set to that show in the text box. Note that the VARIABLE object must be selectable in order for the text box which actually controls the value to be selectable.<p>
</a>
<a name="350252">
<h3>3.6.4 </a>Sliders</h3>
</a>
<a name="350253">
Another way to set numeric variables is to use a button which can move within some limits and whose position within those bounds determines the value of the variable. This is what we call a slider. PGS supports both one dimensional sliders in which there is only one degree of freedom and controls one variable and two dimensional sliders in which there are two degrees of freedom and two variables are controlled simultaneously.<p>
</a>
<a name="350254">
An example of the one dimensional slider is:<p>
</a>
<A NAME="350255"><CODE>Container CLR(0,0) BND(RECT) (0.41,0.82) (0.54,0.88)
</CODE><BR><A NAME="350256"><CODE> {Variable NAME(Phi) CLR(10,0) BND(RECT) (0.0,0.67) (1.0,1.0)
</CODE><BR><A NAME="350257"><CODE> {Text NAME(-60) CLR(10,-1) BND(RECT) (0.05,-0.93) (0.95,-0.067)}
</CODE><BR><A NAME="350258"><CODE> Container CLR(2,2) BND(RECT) (0.0,0.0) (1.0,0.3)
</CODE><BR><A NAME="350259"><CODE> {Button CLR(0,0) DRW(draw-slider) ACT(slider) BND(RECT) (0.28,0.0) (0.43,1.0)}}
</CODE><BR><a name="350260">
What makes this a one dimensional slider is that the BUTTON with the slider action takes up the entire span in the y direction of the parent CONTAINER. The text is not strictly necessary here. It is nice to see the value, however, and you can also change the value by entering it in the text box. Either mode of setting the values causes both indicators to show the same value.<p>
</a>
<a name="350261">
An example of the two dimensional slider is:<p>
</a>
<A NAME="350262"><CODE>Container CLR(0,0) BND(RECT) (0.65,0.82) (0.8,0.97)
</CODE><BR><A NAME="350263"><CODE> {Variable NAME(Theta) CLR(10,0) BND(RECT) (0.05,0.88) (0.45,0.99)
</CODE><BR><A NAME="350264"><CODE> {Text NAME(45) CLR(10,-1) BND(RECT) (0.05,-0.95) (0.95,-0.05)}
</CODE><BR><A NAME="350265"><CODE> Variable NAME(Phi) CLR(10,0) BND(RECT) (0.55,0.88) (0.95,0.99)
</CODE><BR><A NAME="350266"><CODE> {Text NAME(0) CLR(10,-1) BND(RECT) (0.05,-0.95) (0.95,-0.05)}
</CODE><BR><A NAME="350267"><CODE> Container CLR(2,2) BND(RECT) (0.0,0.0) (1.0,0.72)
</CODE><BR><A NAME="350268"><CODE> {Button CLR(0,0) DRW(draw-slider) ACT(slider) BND(RECT) (0.0,0.0) (0.1,0.1)}}
</CODE><BR><a name="350269">
This is a two dimensional slider because the BUTTON with the slider action does not span either the entire x or y direction of the CONTAINER parent. The first VARIABLE, “Theta”, associates with the x direction and the second VARIABLE, “Phi”, with the y direction. The text boxes work the same way as for the one dimensional slider.<p>
</a>
<a name="350270">
<h3>3.6.5 </a>Transients</h3>
</a>
<a name="350271">
Certain interface objects may be visible only transiently in routine use. Pull down menus and dialog boxes are examples of such constructs. Here is an example of an object whose visibility and selectability are toggled when a button is selected.<p>
</a>
<A NAME="350272"><CODE>Container NAME(Menu) CLR(0,0) FLG( ) BND(RECT) (0.349,0.021) (0.551,0.121)
</CODE><BR><A NAME="350273"><CODE> {Text NAME(A) CLR(10,-1) FLG(IsVis) BND(RECT) (0.052,0.014) (0.948,0.333)
</CODE><BR><A NAME="350274"><CODE> Text NAME(B) CLR(10,-1) FLG(IsVis) BND(RECT) (0.052,0.333) (0.948,0.667)
</CODE><BR><A NAME="350275"><CODE> Text NAME(C) CLR(10,-1) FLG(IsVis) BND(RECT) (0.052,0.667) (0.948,0.986)}
</CODE><BR><A NAME="350276"><CODE>
</CODE><BR><A NAME="350277"><CODE>Button CLR(3,2) DRW(draw-button) ACT(toggle,Menu) BND(RECT) (0.101,0.05) (0.200,0.10)
</CODE><BR><A NAME="350278"><CODE> {Text NAME(Menu) CLR(10,-1) FLG(IsVis) DRW(draw-text)
</CODE><BR><A NAME="350279"><CODE> BND(RECT) (0.053,0.286) (0.947,0.714)}
</CODE><BR><a name="350280">
The container “Menu” forms the subtree which is to be summoned and dismissed by actuating the button. Notice how the connection works. The action specifies both the toggle method and an interface object whose visibility and selectability are to be toggled. Compare this with the next example below.<p>
</a>
<A NAME="350281"><CODE>Container NAME(Rendering) CLR(0,0) FLG( ) BND(RECT) (0.399,0.051) (0.601,0.151)
</CODE><BR><A NAME="350282"><CODE> {Text NAME(Rend) CLR(10,-1) FLG(IsVis) BND(RECT) (0.052,0.014) (0.948,0.333)}
</CODE><BR><A NAME="350283"><CODE>
</CODE><BR><A NAME="350284"><CODE>Container NAME(Axis) CLR(0,0) FLG( ) BND(RECT) (0.449,0.101) (0.651,0.201)
</CODE><BR><A NAME="350285"><CODE> {Text NAME(Ax) CLR(10,-1) FLG(IsVis) BND(RECT) (0.052,0.014) (0.948,0.333)}
</CODE><BR><A NAME="350286"><CODE>
</CODE><BR><A NAME="350287"><CODE>Container CLR(0,0) BND(RECT) (0.101,0.100) (0.200,0.18)
</CODE><BR><A NAME="350288"><CODE> {Variable NAME(Which-Panel) CLR(0,0) ACT(toggle) BND(RECT) (0.0,0.0) (1.0,1.0)
</CODE><BR><A NAME="350289"><CODE> {Button CLR(3,2) DRW(draw-button) ACT(Rendering) BND(RECT) (0.0,0.5) (1.0,1.0)
</CODE><BR><A NAME="350290"><CODE> {Text NAME(Render) CLR(10,-1) FLG(IsVis) DRW(draw-text)
</CODE><BR><A NAME="350291"><CODE> BND(RECT) (0.05,0.3) (0.95,0.95)}
</CODE><BR><A NAME="350292"><CODE> Button CLR(3,2) DRW(draw-button) ACT(Axis) BND(RECT) (0.0,0.0) (1.0,0.5)
</CODE><BR><A NAME="350293"><CODE> {Text NAME(Axis) CLR(10,-1) FLG(IsVis) DRW(draw-text)
</CODE><BR><A NAME="350294"><CODE> BND(RECT) (0.05,0.3) (0.95,0.95)}}}
</CODE><BR><a name="350295">
In this case a variable is defined with the toggle method. The value of the variable is a string which is the name of the container to be toggled. That is, if the “Render” button is pressed, the “Rendering” container becomes visible and selectable. If the “Axis” button is now pressed, the “Rendering” container becomes invisible and unselectable while the “Axis” container becomes visible and selectable. A key feature here is that the variable “Which-Panel” does not and should not be registered by the application. PGS implicitly defines and registers undefined variables like this as strings and uses them as described above.<p>
</a>
<a name="352126">
<h1>4.0 Rendering Model</h1>
</a>
<a name="352128">
This section describes the model used in PGS to do various high level renderings of data for the purposes of scientific visualization. High level renderings refer to the notion of carrying out a large number of graphical operations to generate a “plot” or “rendering” of a set of data. To make this as easy as possible, PGS supplies a set of routines which will give “one picture for one call”. These routines have the flexibility to produce plots which fit the needs of the user who can set rendering attributes to control the output in detail. The attributes all have a reasonable default value so that it is possible to make reasonable plots with a single call.<p>
</a>
<a name="352287">
Visualization does not exist in a vacuum. It is strongly coupled to analysis and to data storage. </a>PACT, of which PGS is a part, has extensive facilities in all of these areas. To communicate among them a common representation of data sets is used and instances of these data sets are passed around. Data sets are organized into two mathematically motivated structures: </a>PM_set and </a>PM_mapping. These are described in more detail in the </a>PML Users Manual. A third data structure called a PG_graph is used to contain and associate rendering information with the PM_mapping which only contains the data that a simulation or observation would yield or that an analysis program would need. A picture of how these parts fit together is:<p>
</a>
<a name="352288">
<p>
</a>
<a name="352289">
<p>
</a>
<a name="352290">
<p>
</a>
<a name="352291">
<p>
</a>
<a name="352292">
<p>
</a>
<a name="352293">
<p>
</a>
<a name="352294">
<p>
</a>
<a name="352295">
<p>
</a>
<a name="352296">
<p>
</a>
<a name="352297">
<p>
</a>
<a name="352298">
<p>
</a>
<A NAME="352299"><B>Relationship between PG_graphs, PM_mappings, and PM_sets
</B><HR><a name="352129">
<h2>4.1 Data Structures</h2>
</a>
<a name="352300">
The data structures employed in PGS for the purposes of visualization come from PGS itself and PML, the math library for PACT. The interested user should consult the </a>PML Users Manual for more complete information as well as descriptions of routines which manipulate these structures.<p>
</a>
<A NAME="352301"><CENTER><B></B></CENTER><a name="352306">
The PM_set or set represents a collection of objects (primarily but not exclusively numbers). It also describes the dimensionality of the set, the dimensionality of the elements, and the connectivity of the elements.<p>
</a>
<A NAME="352302"><CENTER><B></B></CENTER><a name="352307">
The PM_mapping or mapping represents the relationship between two sets of elements. In mathematics this is the generalization of a function. A mapping consists of two sets, a domain and range set, and a rule for associating elements of the two sets. Generally in numerical applications the rule is based on the order of the elements of the two sets with a specification of centering and strides through the elements.<p>
</a>
<A NAME="352308"><CENTER><B></B></CENTER><a name="352309">
The PM_mesh_topology defines the connectivity of elements in a set if the trivial logical array ordering is not to be used. The logical array ordering is referred to as </a>logical rectangular and is used in many simulations. However, many applications today cannot represent their data in this way and the means for a completely general specfication of neighbor relations is provided by the PM_mesh_topology structure. Such relationships are referred to as </a>arbitrarily connected.<p>
</a>
<A NAME="352303"><CENTER><B></B></CENTER><a name="352310">
To visualize data requires two ingredients: data; and rendering specifications. The mapping described above takes care of the first part and a list of rendering attributes does the rest. The PG_graph contains these part in one convenient package.<p>
</a>
<A NAME="352304"><CENTER><B></B></CENTER><a name="352311">
A simple but extremely useful data representation is a raster image or cell array. PGS provides a structure to contain such information and visualize it.<p>
</a>
<A NAME="352305"><CENTER><B></B></CENTER><a name="352312">
The specification of color maps is handled with the PG_palette structure. This information tells PGS how to match 3 dimensional RGB color space with n dimensional data sets. The most common situation is that of a single dimension data in a range set or image, but PGS supports multidimensional palettes for higher dimensional ranges.<p>
</a>
<a name="352130">
<h2>4.2 </a>Rendering Modes</h2>
</a>
<a name="352325">
PGS currently features several rendering modes. They are listed here along with a brief description.<p>
</a>
<A NAME="352327"><CENTER><B></B></CENTER><a name="352352">
Line plots is a generic term referring to graphs with 1 dimensional domains and ranges. When a graph has 1d domain and a 1d range </a>PG_draw_graph will render the data in any of the following ways depending on the value of the </a>PLOT-TYPE attribute.<p>
</a>
<A NAME="352350"></a>CARTESIAN Canonical x vs y plot.
<P><A NAME="352333"></a>POLAR Polar plot with r vs theta.
<P><A NAME="352334"></a>INSEL Inselberg plot with parallel axes and (x, y) points represented as
lines connecting the values on the axes.
<P><A NAME="352335"></a>HISTOGRAM Cartesian histogram plot with the steps starting with the </a>LEFT
value, the </a>RIGHT value, or the averaged or </a>CENTER value.
<P><A NAME="352336"></a>SCATTER Scatter plot where points are a plotted with a </a>marker character
but not connected by line segments (Cartesian)
<P><A NAME="352337"></a>LOGICAL Plot y values versus their array index. The x values are ignored.
<P><A NAME="352338"></a>ERROR_BAR Like a scatter plot but instead of marker characters being used
error bars are drawn. Requires 2 arrays for x error and y error or 4 arrays for
positive and negative going x error and positive or negative going y error.
<P><A NAME="352339"><CENTER><B></B></CENTER><a name="352340">
Two dimensional plot is a generic term referring to graphs with 2 dimensional domains. The most common situation features a 1 dimensional range but higher dimensions may be used. When a graph has a 2d domain </a>PG_draw_graph will render the data in any of the following ways depending on the value of the </a>PLOT-TYPE attribute.<p>
</a>
<A NAME="352341"></a>PLOT_CONTOUR A traditional iso contour plot. Can be done with either
logical or </a>arbitrary connectivity.
<P><A NAME="352342"></a>PLOT_IMAGE A rasterized image plot. Can only be done with logical
connectivity.
<P><A NAME="352343"></a>PLOT_WIRE_MESH The domain values are x and y and the range values are
z in a 3 dimensional space. Line segments connect neighboring points. The
data can be examined from any specified </a>view angle. The algorithm is a z buffered scan line technique. Can be done with either logical or arbitrary connectivity.
<P><A NAME="352345"></a>PLOT_SURFACE The domain values are x and y and the range values are
z in a 3 dimensional space. In addition to showing the connecting line segments, the faces bounded by the segments are shaded. Two dimensional ranges
are handled by taking the first component to be the z value and the second
component as the color value. The data can be examined from any specified
</a>view angle. The algorithm is a z buffered scan line technique. Can be done
with either logical or arbitrary connectivity.
<P><A NAME="352344"></a>PLOT_FILL_POLY The facets bounded by segments connecting
neighbors are filled with a single color determined by the range value. Can be
done with either logical or arbitrary connectivity.
<P><A NAME="352347"><CENTER><B></B></CENTER><a name="352353">
Vector plot refers to a plot in which the range has at least two dimensions. Currently PGS can only render 2 dimensional vectors but in the long term will render higher dimensional vectors as well. Also currently vector plots may only be done with 2 dimensional domains. They are requesed by setting the </a>PLOT-TYPE attribute of the graph to </a>PLOT_VECTOR.<p>
</a>
<A NAME="352349"><CENTER><B></B></CENTER><a name="352348">
Mesh plots are graphical renderings of the connectivity of a domain set. In PGS lines are drawn connecting neighboring points. They can be either 2 dimensional or 3 dimensional. If 3 dimensional they may be viewed from any angle similarly to the </a>PLOT_WIRE_MESH plots discussed above. If a NULL range is specified only the mesh is drawn. If a range is supplied the range values are printed at their corresponding nodes. They are requesed by setting the </a>PLOT-TYPE attribute of the graph to </a>PLOT_MESH.<p>
</a>
<a name="350983">
<h2>4.3 </a>Rendering Attributes</h2>
</a>
<a name="352215">
By default PGS assumes a “look and feel” for the various renderings that it can do. This look can be reduced to a list of characteristic or attribute values. Realizing that applications need to control their own look and feel, they are given a mechanism to change these attributes.<p>
</a>
<a name="352240">
Generally speaking, attributes are managed as association lists, that is lists of key-value pairs. Attribute list are associated with graphs (PG_graph) and sets (PM_set). That is to say that some rendering attributes belong naturally with a set (for example, the plotting limits) and others with a graph (for example, the number of contour levels). The PGS rendering routines query the attribute lists for specific attribute values and use their defaults if they are not found.<p>
</a>
<a name="352241">
Modifying attribute lists is done with the following functions (summarized from the </a>SCORE User’s Manual):<p>
</a>
<a name="352265">
<p>
</a>
<A NAME="352242"><BR><B>void *SC_assoc(pcons *alist, char *s)
</B><BR><A NAME="352266"><PRE> Return the attribute value if present
</PRE><A NAME="352243"><BR><B>pcons *SC_add_alist(pcons *alist, char *name, char *type, void *val)
</B><BR><A NAME="352267"><PRE> Add an attribute value to a list
</PRE><A NAME="352245"><BR><B>pcons *SC_rem_alist(pcons *alist, char *name)
</B><BR><A NAME="352268"><PRE> Remove an attribute value from a list
</PRE><A NAME="352244"><BR><B>pcons *SC_change_alist(pcons *alist, char *name, char *type, void *val)
</B><BR><A NAME="352269"><PRE> Change an attribute value and add it if it is not there
</PRE><A NAME="352246"><BR><B>void SC_free_alist(pcons *alist, int level)
</B><BR><A NAME="352270"><PRE> Release an association list. Use level 2.
</PRE><a name="352131">
<h3>4.3.1 Attributes</h3>
</a>
<a name="352132">
This is the list of attributes currently understood by PGS. In use these all appear as quoted strings.<p>
</a>
<a name="352247">
<p>
</a>
<A NAME="352133"></a>AXIS-TYPE
<P><A NAME="352205"><PRE> Flag specifying an axis type of </a>CARTESIAN, </a>POLAR, or </a>INSEL (int). The
default is CARTESIAN.
</PRE><A NAME="352134"></a>CHI
<P><A NAME="352210"><PRE> Value specifying the chi component of the three </a>Euler angles (double). The
default is 0.0.
</PRE><A NAME="352135"></a>CORNER
<P><A NAME="352214"><PRE> Value indicating the node of a logical rectangle which is associated with the
zone center (int). 1 associates lower right, 2 upper right, 3 upper left,
and 4 lower left. This applies to logical rectangular mappings only. The
default is 2.
</PRE><A NAME="352261"></a>DRAW-AXIS
<P><A NAME="352396"><PRE> If TRUE a high level rendering routine will draw a set of axes.
</PRE><A NAME="352156"></a>DRAW-LABEL
<P><A NAME="352258"><PRE> If TRUE a high level rendering routine will draw the graph label.
</PRE><A NAME="352136"></a>DRAW-LEGEND
<P><A NAME="352395"><PRE> If TRUE the contour plotting routine will draw the legend of contour values.
</PRE><A NAME="352394"></a>DX-MINUS
<P><A NAME="352218"><PRE> For </a>PLOT_ERROR_BAR type renderings this is the array of negative going
errors on the x values (double *). This must have the same number of
entries as the x values.
</PRE><A NAME="352137"></a>DX-PLUS
<P><A NAME="352233"><PRE> For </a>PLOT_ERROR_BAR type renderings this is the array of positive going
errors on the x values (double *). This must have the same number of
entries as the x values.
</PRE><A NAME="352138"></a>DY-MINUS
<P><A NAME="352229"><PRE> For </a>PLOT_ERROR_BAR type renderings this is the array of negative going
errors on the y values (double *). This must have the same number of
entries as the y values.
</PRE><A NAME="352139"></a>DY-PLUS
<P><A NAME="352231"><PRE> For </a>PLOT_ERROR_BAR type renderings this is the array of positive going
errors on the y values (double *). This must have the same number of
entries as the y values.
</PRE><A NAME="352140"> </a>EXISTENCE
<P><A NAME="352232"><PRE> An existence map array specifiying missing zones in a logical rectangular
mesh (char *). This prevents plotting of information which would be
associated with non-existent zones in a domain mesh.
</PRE><A NAME="352141"></a>HIST-START
<P><A NAME="352234"><PRE> Flag specifying whether a PLOT_HISTOGRAM rendering starts with the
value on the LEFT, CENTER, or RIGHT side of the bar (int).
</PRE><A NAME="352393"><PRE>
</PRE><A NAME="352391"></a>LEVELS
<P><A NAME="352392"><PRE> The array of contour levels which must be N-LEVELS long (double *). This is
only used when an application wants more control over contour levels
than the contour plotting routines in PGS already provide.
</PRE><A NAME="352142"></a>LIMITS
<P><A NAME="352238"><PRE> Array of minimum and maximum values (one pair per dimension) specifying
the plotting limits of a domain or range set (double *). The length must
be twice the number of dimensions of the set.
</PRE><A NAME="352143"></a>LINE-COLOR
<P><A NAME="352239"><PRE> The line color index (int). The default is </a>BLUE.
</PRE><A NAME="352144"></a>LINE-STYLE
<P><A NAME="352248"><PRE> The line style index </a>SOLID, </a>DOTTED, </a>DASHED, </a>DOTDASHED (int). The
default is SOLID.
</PRE><A NAME="352145"></a>LINE-WIDTH
<P><A NAME="352249"><PRE> The line width (double). The default is 0.0.
</PRE><A NAME="352146"></a>MARKER-INDEX
<P><A NAME="352250"><PRE> The index into the marker array (int). This depends on how many markers have
been defined with </a>PG_def_marker. The default is 0.
</PRE><A NAME="352147"></a>MARKER-SCALE
<P><A NAME="352251"><PRE> The scale factor applied to a marker when drawn (double). The default is 0.01.
</PRE><A NAME="352148"></a>N-LEVELS
<P><A NAME="352252"><PRE> The number of isocontour levels used in a contour plot (int). The default is 10.
</PRE><A NAME="352149"></a>NORMAL-DIRECTION
<P><A NAME="352253"><PRE> A flag specifying the normal direction of surface elements in hidden surface
plot (int). The default is 1.
</PRE><A NAME="352150"></a>PALETTE
<P><A NAME="352254"><PRE> The name of the </a>palette to use in those plots which need color palettes (char *).
The default is the current palette of the device.
</PRE><A NAME="352151"></a>PHI
<P><A NAME="352255"><PRE> Value specifying the phi component of the </a>Euler angles defining the viewing
angle (double). The default is 0.0.
</PRE><A NAME="352152"></a>PHI-LIGHT
<P><A NAME="352256"><PRE> Value specifiying the phi angle of a light source illuminating a surface plot
(double). The default is 45.0 degrees.
</PRE><A NAME="352153"></a>PLOT-TYPE
<P><A NAME="352257"><PRE> Flag specifying the plot type </a>CARTESIAN, </a>POLAR, or </a>INSEL (int). The
default is CARTESIAN.
</PRE><A NAME="352154"></a>RATIO
<P><A NAME="352260"><PRE> Isocontour spacing ratio (double). The default is 1.0.
</PRE><A NAME="352157"></a>SCATTER
<P><A NAME="352262"><PRE> Flag specifying that a rendering be done as a scatter plot if TRUE (int). The
default is FALSE.
</PRE><A NAME="352155"></a>THETA
<P><A NAME="352259"><PRE> Value specifying the theta component of the </a>Euler angles defining the viewing
angle (double). The default is 0.0.
</PRE><A NAME="352397"></a>THETA-LIGHT
<P><A NAME="352398"><PRE> Value specifiying the theta angle of a light source illuminating a surface plot
(double). The default is 45.0 degrees.
</PRE><A NAME="352158"></a>VIEW-PORT
<P><A NAME="352263"><PRE> An array of values in </a>normalized coordinates (xmin, xmax, ymin, and ymax)
specifying a </a>viewport to be for a plot (double *). The default is defined
by each rendering routine to maximize the area of the plot.
</PRE><a name="352264">
<p>
</a>
<a name="352161">
<h3>4.3.2 Plots and associated attributes</h3>
</a>
<a name="352162">
This section tells which rendering attributes are meaningful to which renderings.<p>
</a>
<a name="352163">
<h4>4.3.2.1 Contour Plot Attributes</h4>
</a>
<A NAME="352164"></a>DRAW-AXIS
<P><A NAME="352422"></a>DRAW-LABEL
<P><A NAME="352423"></a>DRAW-LEGEND
<P><A NAME="352421"></a>LEVELS
<P><A NAME="352420"></a>LIMITS
<P><A NAME="352165"></a>LINE-COLOR
<P><A NAME="352166"></a>LINE-WIDTH
<P><A NAME="352167"></a>LINE-STYLE
<P><A NAME="352168"></a>N-LEVELS
<P><A NAME="352390"></a>LEVELS
<P><A NAME="352169"></a>RATIO
<P><A NAME="352170"></a>VIEW-PORT
<P><a name="352171">
<h4>4.3.2.2 Domain Plot Attributes</h4>
</a>
<A NAME="352172"></a>CHI
<P><A NAME="352173"></a>CORNER
<P><A NAME="352424"></a>DRAW-AXIS
<P><A NAME="352425"></a>DRAW-LABEL
<P><A NAME="352174"></a>EXISTENCE
<P><A NAME="352175"></a>LIMITS
<P><A NAME="352176"></a>LINE-COLOR
<P><A NAME="352177"></a>LINE-STYLE
<P><A NAME="352178"></a>LINE-WIDTH
<P><A NAME="352179"></a>MARKER-INDEX
<P><A NAME="352180"></a>MARKER-SCALE
<P><A NAME="352181"></a>PALETTE
<P><A NAME="352182"></a>PHI
<P><A NAME="352183"></a>PHI-LIGHT
<P><A NAME="352184"></a>PLOT-TYPE
<P><A NAME="352185"></a>THETA
<P><A NAME="352186"></a>THETA-LIGHT
<P><A NAME="352187"></a>SCATTER
<P><a name="352189">
<h4>4.3.2.3 Line Plot Attributes</h4>
</a>
<A NAME="352190"></a>AXIS-TYPE
<P><A NAME="352191"></a>DX-MINUS
<P><A NAME="352192"></a>DX-PLUS
<P><A NAME="352193"></a>DY-MINUS
<P><A NAME="352194"></a>DY-PLUS
<P><A NAME="352195"></a>HIST-START
<P><A NAME="352196"></a>LINE-COLOR
<P><A NAME="352197"></a>LINE-STYLE
<P><A NAME="352198"></a>LINE-WIDTH
<P><A NAME="352199"></a>MARKER-INDEX
<P><A NAME="352200"></a>PLOT-TYPE
<P><A NAME="352201"></a>SCATTER
<P><a name="352203">
<h4>4.3.2.4 Hidden Surface Attributes</h4>
</a>
<A NAME="352204"></a>NORMAL-DIRECTION
<P><a name="352206">
<h4>4.3.2.5 Image Plot Attributes</h4>
</a>
<A NAME="352207"></a>CORNER
<P><A NAME="352426"></a>DRAW-AXIS
<P><A NAME="352427"></a>DRAW-LABEL
<P><A NAME="352208"></a>EXISTENCE
<P><A NAME="352209"></a>LIMITS
<P><a name="352211">
<h4>4.3.2.6 Fill Poly Plot Attributes</h4>
</a>
<A NAME="352212"></a>CORNER
<P><A NAME="352428"></a>DRAW-AXIS
<P><A NAME="352429"></a>DRAW-LABEL
<P><A NAME="352213"></a>EXISTENCE
<P><A NAME="352216"></a>LIMITS
<P><A NAME="352217"></a>VIEW-PORT
<P><a name="352219">
<h4>4.3.2.7 Surface Plot Attributes</h4>
</a>
<A NAME="352220"></a>CHI
<P><A NAME="352221"></a>CORNER
<P><A NAME="352430"></a>DRAW-AXIS
<P><A NAME="352431"></a>DRAW-LABEL
<P><A NAME="352222"></a>EXISTENCE
<P><A NAME="352223"></a>LIMITS
<P><A NAME="352224"></a>LINE-COLOR
<P><A NAME="352225"></a>LINE-STYLE
<P><A NAME="352226"></a>LINE-WIDTH
<P><A NAME="352227"></a>PHI
<P><A NAME="352228"></a>THETA
<P><a name="352230">
<h4>4.3.2.8 Vector Plot Attributes</h4>
</a>
<A NAME="352159"></a>CORNER
<P><A NAME="352432"></a>DRAW-AXIS
<P><A NAME="352433"></a>DRAW-LABEL
<P><A NAME="352160"></a>EXISTENCE
<P><A NAME="352188"></a>LIMITS
<P><A NAME="352202"></a>LINE-COLOR
<P><A NAME="352235"></a>LINE-STYLE
<P><A NAME="352236"></a>LINE-WIDTH
<P><A NAME="352237"></a>VIEW-PORT
<P><a name="350296">
<h1>5.0 The </a>PGS API</h1>
</a>
<a name="350297">
The </a>application program interface (API) for PGS is presented in this section. There are three language bindings for most functions in PGS: C; Fortran; and SX. SX is a part of PACT as is PGS. It is an extended dialect of the Scheme programming language. What you get using SX is like what you get using C and loading with the PGS library. Keep in mind however that SX is an interpreted language and lends itself to certain applications which are not suitable for C or Fortran. For more on SX see the SX User’s Manual.<p>
</a>
<a name="350298">
Each language has its own particular features and consequently there are differences in how the PGS functions are used. We have tried to keep consistency between the bindings in order to help users who are familiar with one or more of the languages involved to be able to use any of them. Some discussion of the language differences is given below and the reader is STRONGLY urged to READ this material before proceeding.<p>
</a>
<a name="352314">
The following short hand makes for easier explanations:<p>
</a>
<A NAME="352315">ON and TRUE mean 1 in all languages
<P><A NAME="352316">OFF and FALSE mean 0 in all languages
<P><A NAME="350299"><CENTER><B></B></CENTER><a name="350300">
C is the language in which PGS is implemented. This means that the C bindings traffic in the data structures and pointers of the implementation. The other languages require various devices to obtain a functional equivalent to the C functionality. In this sense the C bindings are fundamental and the reader should keep this in mind at times when attempting to understand some of the more abstruse PGS calls.<p>
</a>
<a name="352313">
A note to C users: PGS is portable to a wide variety of platforms, operating systems, and compilers. Older C compilers do not support the </a>void type well. To smooth over that difference PACT supplies a #define’d constant called </a>byte. On an ANSI system byte is defined to be void, but on an older system, byte is defined to be char. This works extremely well and provides a relatively small bit of confusion.<p>
</a>
<A NAME="350301"><CENTER><B></B></CENTER><a name="350302">
For Fortran functions the type designator </a>REAL indicates arguments which must be </a>floating point numbers. Whether the actual </a>type declaration in the calling FORTRAN program should be </a>real or </a>double precision is </a>platform dependent. In all cases PGS expects a </a>64 bit quantity. <p>
</a>
<a name="350303">
Since there is no accepted standard for how C and Fortran communicate, it is necessary for PGS (and all of PACT) to observe one rule regarding string arguments: two variables are passed. The first is the number of meaningful characters in the string and the second is the string itself.<p>
</a>
<a name="350304">
All functions in the FORTRAN API return TRUE (1) if PGS detects no error (some host systems are better than others about reporting error conditions) and FALSE (0) otherwise unless otherwise noted.<p>
</a>
<A NAME="350305"><CENTER><B></B></CENTER><a name="350306">
In SX as in all LISP dialects two features must be noted and understood. First, values have types not variables. This means that the description of the SX bindings don’t show types associated with the formal parameters. The types of the arguments must match those in the corresponding C calls with the exception of numeric values (they are coerced to the needed type). Second, there are no pointers in the C sense and the language uses pass by value procedure calls. What this means is that nothing is returned to the caller via the argument list. Instead a list of the return values is made and returned. The number and order of the values in the list matches those that are returned via the argument list in the C and Fortran calls.<p>
</a>
<a name="350307">
<h2>5.1 </a>Compiling and Loading</h2>
</a>
<a name="350308">
To compile your C programs you must use the following<p>
</a>
<A NAME="350309"><PRE> #include <pgs.h>
</PRE><a name="350310">
in the source files which deal with PGS graphics.<p>
</a>
<a name="350311">
FORTRAN programs have no special requirements of the sources. It is however important to remember that the PGS FORTRAN routines all begin with “p” and would be implicitly typed as real when in fact they all return integers. You should take care to declare the routines which you use.<p>
</a>
<a name="350312">
To link your application you must use the following libraries in the order specified.<p>
</a>
<A NAME="350313">-lpgs [-lX11] -lppc -lpdb -lpml -lscore [-lm ...]
<P><a name="350314">
Although this is expressed as if for a UNIX linker, the order would be the same for any system with a single pass linker. The items in [] are optional or system dependent.<p>
</a>
<a name="350315">
Each system has different naming conventions for its libraries and the reader is assumed to understand the appropriate naming conventions as well as knowing how to tell the linker to find the installed PACT libraries on each system that they use.<p>
</a>
<a name="350316">
<h2>5.2 </a>PGS </a>Functions</h2>
</a>
<a name="350317">
PGS has a wide variety of functionality. The functionality is broken down into related groups which are listed together in sections and alphabetically in each section.<p>
</a>
<a name="350318">
<h3>5.2.1 </a>Global State Setting Routines</h3>
</a>
<a name="350319">
These routines set state that is global in scope as opposed to device or graph level control.<p>
</a>
<a name="350320">
<p>
</a>
<A NAME="350321><I>C Binding: </I>int </a>PG_def_marker(int n_seg, REAL *x1, REAL *y1, REAL *x2,
REAL *y2)
<BR><A NAME="350322"><I>F77 Binding: </I>integer </a>pgdmrk(integer n_seg, real x1, real y1, real x2, real y2)
<BR><A NAME="350323"><I>SX Binding: </I>(</a>pg-define-marker x1 y1 x2 y2 ...)
<P><a name="350324">
This routine defines a new marker in terms of a set of line segments. The arguments are the number of segments, n_seg, and arrays specifying the x and y values of the endpoints of each segment. Each array must be n_seg elements long. The values in the arrays must be between -1.0 and 1.0. The marker can be scaled to any size and rotated by using the macros PG_set_marker_scale</a> and </a>PG_set_marker_orientation. The index of the new marker is returned and should be used as values for the </a>MARKER-INDEX attribute where called for.<p>
</a>
<a name="350325">
<p>
</a>
<A NAME="352480><I>C Binding: </I>void </a>PG_set_clear_mode(int mode)
<BR><A NAME="352481"><I>F77 Binding: </I>integer </a>pgsclm(integer mode)
<BR><A NAME="352482"><I>SX Binding: </I>
<P><a name="352483">
Set a global mode which the high level rendering routines use to interpret what it means to </a>clear the current picture. There are three interpretations which PGS supports: 1) is to clear the entire PGS window (</a>CLEAR_SCREEN); 2) is to clear only the viewport (</a>CLEAR_VIEWPORT) this leaves axes and labels which have already been drawn intact; and 3) clear only the current frame (</a>CLEAR_FRAME) which leaves still more elements of a picture untouched. Any other value results in no action being taken by the high level renderers to clear anything.<p>
</a>
<a name="352484">
<p>
</a>
<A NAME="350326><I>C Binding: </I>
<BR><A NAME="350327"><I>F77 Binding: </I>
<BR><A NAME="350328"><I>SX Binding: </I>(</a>pg-set-view-angle! theta phi chi)
<P><a name="350329">
Set a global default </a>viewing angle for 3D plots. From the observer’s point of view: phi is a clockwise rotation about the positive z axis; theta is a clockwise rotation about the positive x axis; and chi is a counter-clockwise rotation about the line of sight which is the same as the z axis after the theta and phi rotations have been applied. The theta rotation is done so that a view looking down the z axis (x, y) is turned into a view looking down the y axis (x, z) in the most economical manner - that is with theta equal to 90 degrees.<p>
</a>
<a name="350330">
<h3>5.2.2 </a>Global State Query Routines</h3>
</a>
<a name="352490">
<p>
</a>
<A NAME="352486><I>C Binding: </I>void PG_get_clear_mode(int mode)
<BR><A NAME="352487"><I>F77 Binding: </I>integer pggclm(integer mode)
<BR><A NAME="352488"><I>SX Binding: </I>
<P><a name="352489">
Get the current value of the global mode which the high level rendering routines use to interpret what it means to </a>clear the current picture. See </a>PG_set_clear_mode for a fuller discussion.<p>
</a>
<a name="352485">
<p>
</a>
<a name="350331">
<h3>5.2.3 </a>Memory Management Routines</h3>
</a>
<a name="350332">
These routines allocate and initialize or release instances of PGS data structures.<p>
</a>
<a name="350333">
<p>
</a>
<A NAME="350334><I>C Binding: </I>PG_device *</a>PG_make_device(char *name, char *type, char *title)
<BR><A NAME="350335"><I>F77 Binding: </I>integer </a>pgmkdv(integer ncn, char *name, integer nct, char *type,
integer ncl, char *title)
<BR><A NAME="350336"><I>SX Binding: </I>(</a>pg-make-device name type title)
<P><a name="350337">
Allocate and initialize a new PG_device structure. Name specifies the kind of device wanted (</a>WINDOW, </a>PS, </a>CGM, </a>RASTER). Type specifies whether the device is COLOR or MONOCHROME. Title is either the text of a title bar or the name of an output file as in the case of PS or CGM devices. In the case of PS or CGM devices the title is used as the base of the file name and “.ps” or “.cgm” is added as the suffix appropriately. In addition, with PS devices the EPS conformance level can be specified as follows:<p>
</a>
<A NAME="350342">base_name [PS-level [EPS-level]]
<P><a name="350338">
where PS-level and EPS-level specify the level of conformance. PGS writes very highly conforming files but some applications which would import them cannot recognize standards which are higher or lower than the ones for which they are programmed. This method lets PGS based applications target their applications. Values of 2.0 or 3.0 are most common.<p>
</a>
<a name="352286">
<p>
</a>
<A NAME="350339><I>C Binding: </I>PG_graph *</a>PG_make_graph_from_mapping(PM_mapping *f, char
*info_type, void *info, int id, PG_graph *next)
<BR><A NAME="350340"><I>F77 Binding: </I>
<BR><A NAME="350341"><I>SX Binding: </I>
<P><a name="350347">
Setup and return a PG_graph using a PM_mapping, f, and rendering information in the alist info. The id is a character which will be used as a starting data-id on a contour plot or as the data-id of a line plot. To chain graphs together so that they may be plotted together next is used to point to the next graph in a chain.<p>
</a>
<a name="350343">
<p>
</a>
<A NAME="350344><I>C Binding: </I>PG_graph *</a>PG_make_graph_from_sets(char *label, PM_set
*domain, PM_set *range, int centering, char *info_type,
void *info, int id, PG_graph *next)
<BR><A NAME="350345"><I>F77 Binding: </I>integer </a>pgmgfs(integer nl, char *label, integer domid, integer ranid,
integer centering, integer id, integer next)
<BR><A NAME="350346"><I>SX Binding: </I>(</a>pg-make-graph domain range [centering color width style emap name])
<P><a name="352285">
Setup a new instance of a PG_graph and return it. The arguments are: the domain and range sets of the mapping part of the graph; the relative of the centering of the range and domain data; and rendering information in the form of an alist, info, or line color, width and style and an existence map, emap, for the mesh. The label is a string used to label the entire plot and may be plotted in some circumstances. The id is a character which will be used as a starting data-id on a contour plot or as the data-id of a line plot. To chain graphs together so that they may be plotted together next is used to point to the next graph in a chain.<p>
</a>
<a name="350348">
<p>
</a>
<A NAME="350349><I>C Binding: </I>PG_graph *</a>PG_make_graph_r2_r1(int id, char *label, int cp, int
kmax, int lmax, int centering, REAL *x, REAL *y,
REAL *r, char *dname, char *rname)
<BR><A NAME="350350"><I>F77 Binding: </I>integer </a>pgmg21(integer id, integer nl, char *label, integer cp, integer
kmax, integer lmax, integer centering, real x, real y, real
r, integer nd, char *dname, integer nr, char *rname)
<BR><A NAME="350351"><I>SX Binding: </I>
<P><a name="352284">
Setup and return a specific kind of graph containing a 2d rectangular domain from arrays x and y and a matching 1d range from array r. The size of the arrays is kmax by lmax. If cp is TRUE the x, y, and r arrays will be copied for the domain and range sets. It is sometimes necessary for the sets to have dynamically allocated spaces or to have spaces which they can safely free when they are released. The id is a character which will be used as a starting data-id on a contour plot. The dname and rname are strings used a labels for the domain and range sets respectively. They are never printed on a plot but would be written out to a data file. The label is a string used to label the entire plot and may be plotted in some circumstances.<p>
</a>
<a name="350352">
<p>
</a>
<a name="350353">
<p>
</a>
<A NAME="350354><I>C Binding: </I>PG_graph *</a>PG_make_graph_1d(int id, char *label, int cp, int n,
REAL *x, REAL *y, char *xname, char *yname)
<BR><A NAME="350355"><I>F77 Binding: </I>integer </a>pgmg11(integer id, integer nl, char *label, integer cp, integer n,
real x, real y, integer nx, char *xname, integer ny, char
*yname)
<BR><A NAME="350356"><I>SX Binding: </I>
<P><a name="350357">
Setup and return a specific kind of graph containing a 1d domain from array x and a matching 1d range from array y. The size of the arrays is n. If cp is TRUE the x, y, and r arrays will be copied for the domain and range sets. The reason for this is that it is sometimes necessary for the sets to have dynamically allocated spaces or to have spaces which they can safely free when they are released. The id is a character which will be used as a data-id on a plot. The xname and yname are strings used a labels for the domain and range sets respectively. They are never printed on a plot but would be written out to a data file. The label is a string used to label the entire plot and may be plotted in some circumstances.<p>
</a>
<a name="350358">
<p>
</a>
<A NAME="350363><I>C Binding: </I>void </a>PG_rl_graph(PG_graph *g, int rld, int rlr)
<BR><A NAME="350364"><I>F77 Binding: </I>integer </a>pgrlgr(integer g, integer rld, integer rlr)
<BR><A NAME="350365"><I>SX Binding: </I> automatically garbage collected
<P><a name="350366">
This function releases an instance of a PG_graph. If rld is TRUE the data arrays in the domain set will be freed and if rlr is TRUE the data arrays in the range set will be freed.<p>
</a>
<a name="350367">
<p>
</a>
<A NAME="350359><I>C Binding: </I>PG_image *</a>PG_make_image(char *label, char *type, double xmn,
double xmx, double ymn, double ymx, double zmn,
double zmx, int k, int l, int bits_pix, PG_palette *palette)
<BR><A NAME="350360"><I>F77 Binding: </I>
<BR><A NAME="350361"><I>SX Binding: </I>(</a>pg-build-image dev data k l [name xmn xmx ymn ymx zmn zmx])
<P><a name="350362">
The arguments to this function are:<p>
</a>
<A NAME="350690">label a label string for the image
<P><A NAME="350691">type the data type used in the image
<P><A NAME="350692">(xmn, xmx) the minimum and maximum extent in the x direction
<P><A NAME="350693">(ymn, ymx) the minimum and maximum extent in the y direction
<P><A NAME="350694">(zmn, zmx) the minimum and maximum extent in the image data
<P><A NAME="352281">(k, l) the number of pixels in the x and y direction respectively
<P><A NAME="352282">bits_pix the number of image bits per pixel (1 for MONOCHROME and typically 8 for COLOR)
<P><A NAME="352283">palette the palette to be used in rendering the image
<P><A NAME="350368><I>C Binding: </I>void </a>PG_rl_image(PG_image *im)
<BR><A NAME="350369"><I>F77 Binding: </I>
<BR><A NAME="350370"><I>SX Binding: </I> automatically garbage collected
<P><a name="350371">
These two functions create and release PG_image instances. The images are k by l pixels. They have world coordinate extents from xmin to xmax and ymin to ymax. The data ranges from zmin to zmax and is of type type. A palette may be supplied along with a label for a plot.<p>
</a>
<a name="350372">
<p>
</a>
<a name="350373">
<h3>5.2.4 </a>Device Control Routines</h3>
</a>
<a name="350374">
These routines provide for high level control of PGS devices. They also permit applications to set various aspects of the state of devices.<p>
</a>
<a name="350375">
<p>
</a>
<A NAME="350376><I>C Binding: </I>void </a>PG_clear_page(PG_device *dev, int i)
<BR><A NAME="350377"><I>F77 Binding: </I> integer </a>pgclpg(integer devid, int i)
<BR><A NAME="350378"><I>SX Binding: </I>
<P><a name="350379">
Clear the page for a text window such as the console. Leave the current line at line i in the PGS window.<p>
</a>
<a name="350380">
<p>
</a>
<A NAME="350381><I>C Binding: </I>void </a>PG_clear_region_NDC(PG_device *dev, double xmn, double
xmx, double ymn, double ymx, int pad)
<BR><A NAME="350382"><I>F77 Binding: </I>integer </a>pgclrg(integer devid, real xmn, real xmx, real ymn, real ymx,
integer pad)
<BR><A NAME="350383"><I>SX Binding: </I>(</a>pg-clear-region dev xmn xmx ymn ymx pad)
<P><a name="350384">
Clear the rectangular region, specified in normalized coordinates, of the given device. The limits of the rectangle are xmn, xmx, ymn, and ymx. The pad is a number of pixels to inset the cleared region. This facilitates clearing a region without removing a border line around the region.<p>
</a>
<a name="350385">
<p>
</a>
<A NAME="350386><I>C Binding: </I>void </a>PG_clear_window(PG_device *dev)
<BR><A NAME="350387"><I>F77 Binding: </I>integer </a>pgclsc(integer devid)
<BR><A NAME="350388"><I>SX Binding: </I>(</a>pg-clear-window dev)
<P><a name="350389">
Clear the entire PGS window on the specified device.<p>
</a>
<a name="350390">
<p>
</a>
<A NAME="350391><I>C Binding: </I>void </a>PG_clear_viewport(PG_device *dev)
<BR><A NAME="350392"><I>F77 Binding: </I>integer </a>pgclvp(integer devid)
<BR><A NAME="350393"><I>SX Binding: </I>(</a>pg-clear-viewport dev)
<P><a name="350394">
Clear the current viewport region only on the specified device.<p>
</a>
<a name="350395">
<p>
</a>
<A NAME="350396><I>C Binding: </I>void </a>PG_close_console(void)
<BR><A NAME="350397"><I>F77 Binding: </I>
<BR><A NAME="350398"><I>SX Binding: </I>
<P><a name="350399">
Close the console device.<p>
</a>
<a name="350400">
<p>
</a>
<A NAME="350401><I>C Binding: </I>void </a>PG_close_device(PG_device *dev)
<BR><A NAME="350402"><I>F77 Binding: </I>integer </a></a>pgclos(integer dev)
<BR><A NAME="350403"><I>SX Binding: </I>(</a>pg-close-device dev)
<P><a name="350404">
Close the specified device, dev.<p>
</a>
<a name="350405">
<p>
</a>
<A NAME="350406><I>C Binding: </I>void </a>PG_finish_plot(PG_device *dev)
<BR><A NAME="350407"><I>F77 Binding: </I>integer </a>pgfnpl(integer devid)
<BR><A NAME="350408"><I>SX Binding: </I>(</a>pg-finish-plot dev)
<P><a name="350409">
Finish the picture on the specified device. Once a picture is finished, nothing more can be drawn to the device until a call to </a>PG_clear_window is done without serious consequences. This is especially necessary for devices such as PS and CGM devices.<p>
</a>
<a name="350410">
<p>
</a>
<A NAME="352475><I>C Binding: </I>void </a>PG_get_axis_log_scale(PG_device *dev, int *xls, int *yls)
<BR><A NAME="352476"><I>F77 Binding: </I>integer </a>pggaxl(integer devid, integer xls, integer yls)
<BR><A NAME="352477"><I>SX Binding: </I>
<P><a name="352478">
Get the x-axis or y-axis</a> log scale flags in the specified device. The argument xls contains the value of the x-axis log flag and yls contains the value of the y-axis log flag on return,<p>
</a>
<a name="352479">
<p>
</a>
<A NAME="350411><I>C Binding: </I>void </a>PG_make_device_current(PG_device *dev)
<BR><A NAME="350412"><I>F77 Binding: </I>integer </a>pgmdvc(integer devid)
<BR><A NAME="350413"><I>SX Binding: </I>(</a>pg-make-device-current dev)
<P><a name="350414">
Make the specified device the current device for drawing.<p>
</a>
<a name="350415">
<p>
</a>
<A NAME="350416><I>C Binding: </I>void </a>PG_open_console(char *title, char *type, int bckgr, double xf,
double yf, double dxf, double dyf)
<BR><A NAME="350417"><I>F77 Binding: </I>
<BR><A NAME="350418"><I>SX Binding: </I>
<P><a name="350419">
Open a console device at the specified point (xf, yf) with the specified width, dxf, and height, dyf (these are all in normalized coordinates). The console window will have title in the title bar, type, type, and the indicated background color. Type, the window type is one of “COLOR” or “MONOCHROME”. Bckgr should be TRUE for white background and FALSE for black background.<p>
</a>
<a name="350420">
<p>
</a>
<A NAME="350421><I>C Binding: </I>PG_device *</a>PG_open_device(PG_device *dev, double xf, double yf,
double dxf, double dyf)
<BR><A NAME="350422"><I>F77 Binding: </I>integer </a>pgopen(integer devid, REAL xf, REAL yf, REAL dxf, REAL
dyf)
<BR><A NAME="350423"><I>SX Binding: </I>(</a>pg-open-device dev xf yf dxf dyf)
<P><a name="350424">
Open the specified device at the specified point (xf, yf) with the specified width, dxf, and height, dyf. These values are all normalized to the physical device dimensions. NOTE: to make it easy to create a square window, the actual pixel height of the PGS window is computed as dyf*display_pixel_width!<p>
</a>
<a name="350425">
<p>
</a>
<A NAME="350426><I>C Binding: </I>void </a>PG_release_current_device(PG_device *dev)
<BR><A NAME="350427"><I>F77 Binding: </I>integer </a>pgrdvc(integer devid)
<BR><A NAME="350428"><I>SX Binding: </I>(</a>pg-release-current-device dev)
<P><a name="350429">
Release the specified device as the current drawing device. (A few host graphics systems need this functionality).<p>
</a>
<a name="350430">
<p>
</a>
<A NAME="352470><I>C Binding: </I>void </a>PG_set_attributes(PG_device *dev, PG_dev_attributes *attr)
<BR><A NAME="352471"><I>F77 Binding: </I>
<BR><A NAME="352472"><I>SX Binding: </I>
<P><a name="352473">
Set the collection of attributes from the PG_dev_attributes structure attr in the specified device.<p>
</a>
<a name="352474">
<p>
</a>
<A NAME="350431><I>C Binding: </I>void </a>PG_set_axis_log_scale(PG_device *dev, int xls, int yls)
<BR><A NAME="350432"><I>F77 Binding: </I>integer </a>pgsaxl(integer devid, integer xls, integer yls)
<BR><A NAME="350433"><I>SX Binding: </I>
<P><a name="350434">
Set the x-axis or y-axis</a> log scale flags in the specified device. The argument xls causes the x-axis to be plotted with a log scale if TRUE and yls causes the y-axis to be plotted with a log scale if TRUE.<p>
</a>
<a name="350435">
<p>
</a>
<A NAME="350436><I>C Binding: </I>void </a>PG_set_border_width(PG_device *dev, int t)
<BR><A NAME="350437"><I>F77 Binding: </I>integer </a>pgsbwd(integer devid, integer t)
<BR><A NAME="350438"><I>SX Binding: </I>(</a>pg-set-border-width dev t)
<P><a name="350439">
Set the </a>width of the </a>window </a>border in pixels.<p>
</a>
<a name="350440">
<p>
</a>
<A NAME="350441><I>C Binding: </I>void </a>PG_set_clipping(PG_device *dev, int flag)
<BR><A NAME="350442"><I>F77 Binding: </I>integer </a>pgsclp(integer devid, integer c)
<BR><A NAME="350443"><I>SX Binding: </I>(</a>pg-set-clipping! dev flag)
<P><a name="350444">
Turn on clipping to the current viewport if flag is TRUE and turn off clipping to the current viewport if flag is FALSE on the specified device. NOTE: moving the viewport after turning on the clipping does NOT move the clipping rectangle. To do this turn clipping off and back on again.<p>
</a>
<a name="350445">
<p>
</a>
<A NAME="350446><I>C Binding: </I>void </a>PG_set_fill_color(PG_device *dev, int color)
<BR><A NAME="350447"><I>F77 Binding: </I>integer pgsfcl(integer devid, integer color)
<BR><A NAME="350448"><I>SX Binding: </I>(</a>pg-set-fill-color dev color)
<P><a name="350449">
Set the fill color for the device to color. The color index is mapped through the current palette.<p>
</a>
<a name="350450">
<p>
</a>
<A NAME="350451><I>C Binding: </I>void </a>PG_set_finish_state(PG_device *dev, int fin)
<BR><A NAME="350452"><I>F77 Binding: </I>integer </a>pgsfin(integer dev, integer fin)
<BR><A NAME="350453"><I>SX Binding: </I>(</a>pg-set-finish-state! dev fin)
<P><a name="350454">
Set the state of the flag that tells the high level rendering routines whether or not to assume a plot is finished and issue a call to </a>PG_finish_plot. This is crucial when doing multiple plots or adding to a plot after the high level renderer returns.<p>
</a>
<a name="350455">
<p>
</a>
<A NAME="352375><I>C Binding: </I>void </a>PG_set_marker_orientation(PG_device *dev, double theta)
<BR><A NAME="352376"><I>F77 Binding: </I>integer </a>pgsmko(integer devid, real theta)
<BR><A NAME="352377"><I>SX Binding: </I>(</a>pg-set-marker-orientation! dev theta)
<P><a name="352378">
Set the </a>orientation angle to be applied when drawing markers. Markers can be drawn at any angle. The angle, theta, is a uniform rotation from the positive x axis in the counter-clockwise direction of all the segments comprising the </a>marker.<p>
</a>
<a name="352379">
<p>
</a>
<A NAME="351644><I>C Binding: </I>void </a>PG_set_marker_scale(PG_device *dev, double v)
<BR><A NAME="351647"><I>F77 Binding: </I>integer pgsms(integer devid, real v)
<BR><A NAME="351648"><I>SX Binding: </I>(</a>pg-set-marker-scale! dev v)
<P><a name="351650">
Set the </a>scale factor to be applied when drawing </a>markers. Markers can be drawn to any size since they are defined in normalized units (see </a>PG_def_marker). The scale factor sets the actual size. A reasonable value might be 0.01.<p>
</a>
<a name="352370">
<p>
</a>
<A NAME="350456><I>C Binding: </I>void </a>PG_set_max_intensity(PG_device *dev, double osc)
<BR><A NAME="350457"><I>F77 Binding: </I>
<BR><A NAME="350458"><I>SX Binding: </I>(</a>pg-set-maximum-intensity! dev osc rsc gsc bsc)
<P><a name="350459">
To better match the characteristics of varying output devices (especially conventional video) this function scales the overall intensity as well as the intensity of the RGB values down from their maximum of unity. The overall, red, green, and blue values are controlled by osc, rsc, gsc, and bsc respectively.<p>
</a>
<a name="350460">
<p>
</a>
<A NAME="350461><I>C Binding: </I>PG_palette *</a>PG_set_palette(PG_device *dev, char *name)
<BR><A NAME="350462"><I>F77 Binding: </I>integer </a>pgspal(integer devid, integer nc, char *name)
<BR><A NAME="350463"><I>SX Binding: </I>(</a>pg-set-palette! dev name)
<P><a name="350464">
Set the </a>current palette to be the named one. The built-in palettes are named: standard, </a>spectrum, </a>rainbow, </a>bw, </a>wb, </a>rgb, </a>cym, </a>hc, </a>bgy, </a>tri, </a>iron, </a>thresh, </a>rand, </a>reds, </a>yellows, </a>greens, </a>cyans, </a>blues, and </a>magentas. Additional palettes may be read in with </a>PG_rd_palette or created with </a>PG_make_palette. The available palettes may be viewed with </a>PG_show_palettes.<p>
</a>
<a name="350465">
<p>
</a>
<A NAME="350471><I>C Binding: </I>void </a>PG_set_res_scale_factor(PG_device *dev, double f)
<BR><A NAME="350472"><I>F77 Binding: </I>
<BR><A NAME="350473"><I>SX Binding: </I>(</a>pg-set-resolution-scale-factor! dev sf)
<P><a name="350474">
Set the value of the hardcopy resolution scale factor. Hardcopy devices can be very high resolution devices which can lead to enormous image files. This control lets the application scale down the resolution of the device to keep image files a reasonable size. The default value is 8, that is by default the resolution is a factor of 8 less than could be obtained for the device. This means a factor of 64 in size for raster images.<p>
</a>
<a name="350475">
<p>
</a>
<A NAME="350476><I>C Binding: </I>void </a>PG_set_viewport_pos(PG_device *dev, REAL x, REAL y)
<BR><A NAME="350477"><I>F77 Binding: </I>integer </a>pgsvps(integer devid, real x, real y)
<BR><A NAME="350478"><I>SX Binding: </I>
<P><a name="350479">
Set the position of the </a>viewport in the window. The specifications are normalized.<p>
</a>
<a name="350480">
<p>
</a>
<A NAME="350481><I>C Binding: </I>void </a>PG_set_viewport_shape(PG_device *dev, REAL width, REAL
height, REAL aspect)
<BR><A NAME="350482"><I>F77 Binding: </I>integer </a>pgsvsh(integer devid, real width, real height, real aspect)
<BR><A NAME="350483"><I>SX Binding: </I>
<P><a name="350484">
Set the shape of the </a>viewport in the window. The specifications are normalized. The aspect ratio is used iff the height is given as 0.0.<p>
</a>
<a name="350485">
<p>
</a>
<A NAME="350486><I>C Binding: </I>void </a>PG_turn_</a>autodomain(PG_device *dev, int n)
<BR><A NAME="350487"><I>F77 Binding: </I>integer </a>pgsadm(integer dev, integer dm)
<BR><A NAME="350488"><I>SX Binding: </I>(</a>pg-set-autodomain! dev n)
<P><a name="350489">
Determine the </a>domain interval from the data iff n or dm is ON.<p>
</a>
<a name="350490">
<p>
</a>
<A NAME="350491><I>C Binding: </I>void </a>PG_turn_</a>autoplot(PG_device *dev, int n)
<BR><A NAME="350492"><I>F77 Binding: </I>
<BR><A NAME="350493"><I>SX Binding: </I>(</a>pg-set-autoplot! dev n)
<P><a name="350494">
Set flag to applications to automatically </a>replot iff n is ON. This is simply a global variable provided by PGS which applications may use to control plotting.<p>
</a>
<a name="350495">
<p>
</a>
<A NAME="350496><I>C Binding: </I>void </a>PG_turn_</a>autorange(PG_device *dev, int n)
<BR><A NAME="350497"><I>F77 Binding: </I>integer </a>pgsarn(integer dev, integer rn)
<BR><A NAME="350498"><I>SX Binding: </I>(</a>pg-set-autorange! dev n)
<P><a name="350499">
Determine the </a>range interval from the data iff n or rn is ON.<p>
</a>
<a name="350500">
<p>
</a>
<A NAME="350501><I>C Binding: </I>void </a>PG_turn_data_id(PG_device *dev, int n)
<BR><A NAME="350502"><I>F77 Binding: </I>
<BR><A NAME="350503"><I>SX Binding: </I>(</a>pg-set-data-id-flag! dev n)
<P><a name="350504">
Draw </a>data identifiers on plots iff n is ON.<p>
</a>
<a name="350505">
<p>
</a>
<A NAME="350506><I>C Binding: </I>void </a>PG_turn_grid(PG_device *dev, int n)
<BR><A NAME="350507"><I>F77 Binding: </I>
<BR><A NAME="350508"><I>SX Binding: </I>(</a>pg-set-grid-flag! dev n)
<P><a name="350509">
Turn the full </a>axis </a>grid ON or OFF.<p>
</a>
<a name="350510">
<p>
</a>
<A NAME="350511><I>C Binding: </I>void </a>PG_turn_scatter(PG_device *dev, int n)
<BR><A NAME="350512"><I>F77 Binding: </I>
<BR><A NAME="350513"><I>SX Binding: </I>(</a>pg-set-scatter-flag! dev n)
<P><a name="350514">
Draw 1D data sets as </a>scatter plots iff n is ON.<p>
</a>
<a name="350515">
<p>
</a>
<A NAME="350516><I>C Binding: </I>void </a>PG_update_vs(PG_device *dev)
<BR><A NAME="350517"><I>F77 Binding: </I>integer </a>pgupvs(integer devid)
<BR><A NAME="350518"><I>SX Binding: </I>(</a>pg-update-view-surface dev)
<P><a name="350519">
Update the view surface of the specified device. This flushes any buffered graphics to the output medium of the device.<p>
</a>
<a name="350520">
<p>
</a>
<A NAME="350521><I>C Binding: </I>void </a>PG_white_background(PG_device *dev, int n)
<BR><A NAME="350522"><I>F77 Binding: </I>
<BR><A NAME="350523"><I>SX Binding: </I>(</a>pg-set-white-background! dev n)
<P><a name="350524">
If n is TRUE use a white </a>background otherwise use a black background.<p>
</a>
<a name="350525">
<h3>5.2.5 Device Query Routines</h3>
</a>
<a name="350526">
<p>
</a>
<A NAME="350527><I>C Binding: </I>int </a>COLOR_POSTSCRIPT_DEVICE(PG_device *dev)
<BR><A NAME="350528"><I>F77 Binding: </I>
<BR><A NAME="350529"><I>SX Binding: </I>
<P><a name="350530">
TRUE iff dev is a color PostScript device.<p>
</a>
<a name="350531">
<p>
</a>
<A NAME="350532><I>C Binding: </I>
<BR><A NAME="350533"><I>F77 Binding: </I>
<BR><A NAME="350534"><I>SX Binding: </I>(</a>pg-device-properties dev)
<P><a name="350535">
Return the name, type, and title of the device as given in the </a>PG_make_device call which created the device.<p>
</a>
<a name="350536">
<p>
</a>
<A NAME="350537><I>C Binding: </I>PG_dev_attributes *</a>PG_get_attributes(PG_device *dev)
<BR><A NAME="350538"><I>F77 Binding: </I>
<BR><A NAME="350539"><I>SX Binding: </I>
<P><a name="350540">
Collect and return the selection of attributes from the specified device in a newly allocated PG_dev_attributes structure.<p>
</a>
<a name="350541">
<p>
</a>
<A NAME="350542><I>C Binding: </I>void </a>PG_get_clipping(PG_device *dev, int *flag)
<BR><A NAME="350543"><I>F77 Binding: </I>integer </a>pggclp(integer devid, integer flag)
<BR><A NAME="350544"><I>SX Binding: </I>(</a>pg-clipping? dev)
<P><a name="350545">
Get the current </a>clipping state for the specified device in flag.<p>
</a>
<a name="350546">
<p>
</a>
<A NAME="350547><I>C Binding: </I>
<BR><A NAME="350548"><I>F77 Binding: </I>integer </a>pggfin(integer dev, integer fin)
<BR><A NAME="350549"><I>SX Binding: </I>(</a>pg-finish-state dev)
<P><a name="350550">
Return the state of the flag that tells the high level rendering routines whether or not to assume a plot is finished and issue a call to </a>PG_finish_plot.<p>
</a>
<a name="350551">
<p>
</a>
<A NAME="352380><I>C Binding: </I>void </a>PG_get_marker_orientation(PG_device *dev, REAL *v)
<BR><A NAME="352381"><I>F77 Binding: </I>integer </a>pggmko(integer dev, real v)
<BR><A NAME="352382"><I>SX Binding: </I>(</a>pg-marker-orientation dev)
<P><a name="352383">
Get the current </a>marker orientation angle of the device. Markers can be drawn at any angle. The angle returned in v is a uniform rotation from the positive x axis in the counter-clockwise direction of all the segments comprising the marker.<p>
</a>
<a name="352384">
<p>
</a>
<A NAME="352385><I>C Binding: </I>void </a>PG_get_marker_scale(PG_device *dev, REAL *s)
<BR><A NAME="352386"><I>F77 Binding: </I>integer </a>pggmks(integer devid, real s)
<BR><A NAME="352387"><I>SX Binding: </I>(</a>pg-marker-scale dev)
<P><a name="352388">
Get the current </a>marker scale factor of the device. Markers can be drawn to any size since they are defined in normalized units (see </a>PG_def_marker). The scale factor returned in s controls the actual size.<p>
</a>
<a name="352389">
<p>
</a>
<A NAME="350552><I>C Binding: </I>
<BR><A NAME="350553"><I>F77 Binding: </I>
<BR><A NAME="350554"><I>SX Binding: </I>(</a>pg-maximum-intensity dev)
<P><a name="350555">
Return the maximum intensity aggregate value and the individual values for red, green, and blue colors in the specified device. The values are normalized (0.0 to 1.0).<p>
</a>
<a name="350556">
<p>
</a>
<A NAME="350557><I>C Binding: </I>PG_palette *</a>PG_get_palette(PG_device *dev, char *name)
<BR><A NAME="350558"><I>F77 Binding: </I> not applicable
<BR><A NAME="350559"><I>SX Binding: </I>(</a>pg-palette->list dev name)
<P><a name="350560">
Returns a pointer to the palette specified by name.<p>
</a>
<a name="350561">
<p>
</a>
<A NAME="350562><I>C Binding: </I>
<BR><A NAME="350563"><I>F77 Binding: </I>
<BR><A NAME="350564"><I>SX Binding: </I>(</a>pg-palettes dev)
<P><a name="350565">
Return a list of palettes available for the specified device.<p>
</a>
<a name="350566">
<p>
</a>
<A NAME="350567><I>C Binding: </I>int </a>POSTSCRIPT_DEVICE(PG_device *dev)
<BR><A NAME="350568"><I>F77 Binding: </I>
<BR><A NAME="350569"><I>SX Binding: </I>
<P><a name="350570">
TRUE iff dev is a PostScript device.<p>
</a>
<a name="350571">
<p>
</a>
<A NAME="352968><I>C Binding: </I>void </a>PG_query_screen(PG_device *dev, int *pdx, int *pdy, int *pnc)
<BR><A NAME="352970"><I>F77 Binding: </I>integer </a>pgqdev(integer devid, integer dx, integer dy, integer nc)
<BR><A NAME="352972"><I>SX Binding: </I>(</a>pg-query-device dev)
<P><a name="352973">
Query the device for size in pixels and color planes. The number of colors which a device supports is 2nplanes.<p>
</a>
<a name="352974">
<p>
</a>
<A NAME="350572><I>C Binding: </I>void </a>PG_query_window(PG_device *dev, int *pdx, int *pdy)
<BR><A NAME="350573"><I>F77 Binding: </I>integer </a>pgqwin(integer devid, integer dx, integer dy)
<BR><A NAME="350574"><I>SX Binding: </I>(</a>pg-query-window dev)
<P><a name="350575">
Query the shape of the window on the device.<p>
</a>
<a name="350576">
<p>
</a>
<A NAME="350577><I>C Binding: </I>
<BR><A NAME="350578"><I>F77 Binding: </I>
<BR><A NAME="350579"><I>SX Binding: </I>(</a>pg-show-markers)
<P><a name="350580">
Temporarily spawn a window to display the available marker characters on the specified device.<p>
</a>
<a name="350581">
<h3>5.2.6 Coordinate Transformation Routines</h3>
</a>
<a name="350582">
These routines transform points from one coordinate system to another. The three coordinate systems are: pixel coordinates referring to the integer coordinates of pixels in a device; normalized coordinates whose values range from 0.0 to 1.0 and are device independent; and world coordinates which are user defined coordinates (see </a>PG_set_window) tailored to the particular application at hand.<p>
</a>
<a name="350583">
<p>
</a>
<A NAME="350584><I>C Binding: </I>void </a>PtoS(PG_device *dev, int ix, int iy, REAL x, REAL y)
<BR><A NAME="350585"><I>F77 Binding: </I>integer </a>pgptos(integer devid, integer ix, integer iy, REAL x, REAL y)
<BR><A NAME="350586"><I>SX Binding: </I>(</a>pg-pixel->normalized dev ix iy)
<P><a name="350587">
Converts (ix, iy) from </a>pixel coordinates to </a>NDC/</a>Screen coordinates (x, y).<p>
</a>
<a name="350588">
<p>
</a>
<A NAME="350589><I>C Binding: </I>void </a>StoP(PG_device *dev, REAL x, REAL y, int ix, int iy)
<BR><A NAME="350590"><I>F77 Binding: </I>integer </a>pgstop(integer devid, REAL x, REAL y, integer ix, integer iy)
<BR><A NAME="350591"><I>SX Binding: </I>(</a>pg-normalized->pixel dev x y)
<P><a name="350592">
Converts (x, y) from </a>NDC/</a>Screen coordinates to </a>pixel coordinates (ix, iy).<p>
</a>
<a name="350593">
<p>
</a>
<A NAME="350594><I>C Binding: </I>void </a>StoW(PG_device *dev, REAL x, REAL y)
<BR><A NAME="350595"><I>F77 Binding: </I>integer </a>pgstow(integer devid, REAL x, REAL y)
<BR><A NAME="350596"><I>SX Binding: </I>(</a>pg-normalized->world dev x y)
<P><a name="350597">
Converts (x, y) from </a>screen coordinates to </a>world coordinates.<p>
</a>
<a name="350598">
<p>
</a>
<A NAME="350599><I>C Binding: </I>void </a>WtoS(PG_device *dev, REAL x, REAL y)
<BR><A NAME="350600"><I>F77 Binding: </I>integer </a>pgwtos(integer devid, REAL x, REAL y)
<BR><A NAME="350601"><I>SX Binding: </I>(</a>pg-world->normalized dev x y)
<P><a name="350602">
Converts (x, y) from </a>world coordinates to </a>screen coordinates.<p>
</a>
<a name="350603">
<p>
</a>
<a name="350604">
<h3>5.2.7 </a>Coordinate System and </a>Viewport Control Routines</h3>
</a>
<a name="350605">
These routines provide access to the coordinate system and viewport of a PGS window.<p>
</a>
<a name="350606">
<p>
</a>
<A NAME="350607><I>C Binding: </I>void </a>PG_get_frame(PG_device *dev, REAL *x1, REAL *x2, REAL
*y1, REAL *y2)
<BR><A NAME="350608"><I>F77 Binding: </I>
<BR><A NAME="350609"><I>SX Binding: </I>(</a>pg-frame dev)
<P><a name="350610">
Get the frame of the specified device. The x and y intervals are specified in NDC by (x1, x2) and (y1, y2) respectively.<p>
</a>
<a name="350611">
<p>
</a>
<A NAME="350612><I>C Binding: </I>void </a>PG_get_viewport(PG_device *dev, REAL *x1, REAL *x2, REAL
*y1, REAL *y2)
<BR><A NAME="350613"><I>F77 Binding: </I>integer </a>pggvwp(integer devid, REAL x1, REAL x2, REAL y1, REAL
y2)
<BR><A NAME="350614"><I>SX Binding: </I>(</a>pg-viewport dev)
<P><a name="350615">
Get the viewport of the specified device. The x and y intervals are specified in NDC by (x1, x2) and (y1, y2) respectively.<p>
</a>
<a name="350616">
<p>
</a>
<A NAME="350617><I>C Binding: </I>void </a>PG_get_window(PG_device *dev, REAL *xmn, REAL *xmx,
REAL *ymn, REAL *ymx)
<BR><A NAME="350618"><I>F77 Binding: </I>integer </a>pggwcs(integer devid, REAL x1, REAL x2, REAL y1, REAL
y2)
<BR><A NAME="350619"><I>SX Binding: </I>(</a>pg-world-coordinate-system dev)
<P><a name="350620">
Get the world coordinate system defined relative to the viewport for the specified device. The x and y intervals are specified in WC by (x1, x2) and (y1, y2) respectively.<p>
</a>
<a name="350621">
<p>
</a>
<A NAME="350622><I>C Binding: </I>
<BR><A NAME="350623"><I>F77 Binding: </I>integer </a>pgrvpa(integer devid, integer n)
<BR><A NAME="350624"><I>SX Binding: </I>
<P><a name="350625">
Restore the current viewport, coordinate transformations, and related graphical state. A previously saved state (see pgsvpa) is referenced by the index n.<p>
</a>
<a name="350626">
<p>
</a>
<A NAME="350627><I>C Binding: </I>
<BR><A NAME="350628"><I>F77 Binding: </I>integer </a>pgsvpa(integer devid, integer n)
<BR><A NAME="350629"><I>SX Binding: </I>
<P><a name="350630">
Save the current viewport, coordinate transformations, and related graphical state. If n < 0, a new space is internally allocated. Otherwise n is interpreted as an existing state whose space will be reused. Returns an index in n which is to be used with a corresponding call to pgrvpa.<p>
</a>
<a name="350631">
<p>
</a>
<A NAME="350632><I>C Binding: </I>void </a>PG_set_frame(PG_device, double x1, double x2, double y1,
double y2)
<BR><A NAME="350633"><I>F77 Binding: </I>
<BR><A NAME="350634"><I>SX Binding: </I>(</a>pg-set-frame! dev x1 x2 y1 y2)
<P><a name="350635">
Set the frame of the specified device. The x and y intervals are specified in NDC by (x1, x2) and (y1, y2) respectively.<p>
</a>
<a name="350636">
<p>
</a>
<A NAME="350637><I>C Binding: </I>void </a>PG_set_limits(PG_device *dev, REAL *x, REAL *y, int n, int
type)
<BR><A NAME="350638"><I>F77 Binding: </I>
<BR><A NAME="350639"><I>SX Binding: </I>
<P><a name="350640">
Set the world coordinate system (defined relative to the viewport) for the specified device finding the limits of the n points in the supplied data arrays. The x and y arrays are specified in WC. Type is the plot type (INSEL, HISTOGRAM, POLAR, CARTESIAN).<p>
</a>
<a name="350641">
<p>
</a>
<A NAME="350642><I>C Binding: </I>void </a>PG_set_viewport(PG_device *dev, double x1, double x2, double
y1, double y2)
<BR><A NAME="350643"><I>F77 Binding: </I>integer </a>pgsvwp(integer devid, REAL x1, REAL x2, REAL y1, REAL
y2)
<BR><A NAME="350644"><I>SX Binding: </I>(</a>pg-set-viewport! dev x1 x2 y1 y2)
<P><a name="350645">
Set the viewport of the specified device. The x and y intervals are specified in NDC by (x1, x2) and (y1, y2) respectively.<p>
</a>
<a name="350646">
<p>
</a>
<A NAME="350647><I>C Binding: </I>void </a>PG_set_window(PG_device *dev, double x1, double x2, double y1,
double y2)
<BR><A NAME="350648"><I>F77 Binding: </I>integer </a>pgswcs(integer devid, REAL x1, REAL x2, REAL y1, REAL
y2)
<BR><A NAME="350649"><I>SX Binding: </I>(</a>pg-set-world-coordinate-system! dev x1 x2 y1 y2)
<P><a name="350650">
Set the world coordinate system defined relative to the viewport for the specified device. The x and y intervals are specified in WC by (x1, x2) and (y1, y2) respectively.<p>
</a>
<a name="350651">
<p>
</a>
<a name="350652">
<h3>5.2.8 </a>Line </a>Attribute Control Routines</h3>
</a>
<a name="350653">
These routines provide control over how lines appear when drawn.<p>
</a>
<a name="350654">
<p>
</a>
<A NAME="350655><I>C Binding: </I>void </a>PG_get_line_color(PG_device *dev, int *plc)
<BR><A NAME="350656"><I>F77 Binding: </I>integer </a>pgglnc(integer devid, integer lc)
<BR><A NAME="350657"><I>SX Binding: </I>(</a>pg-line-color dev)
<P><a name="350658">
<p>
</a>
<A NAME="352096><I>C Binding: </I>void </a>PG_get_line_style(PG_device *dev, int *pls)
<BR><A NAME="350659"><I>F77 Binding: </I>integer </a>pgglns(integer devid, integer ls)
<BR><A NAME="350660"><I>SX Binding: </I>(</a>pg-line-style dev)
<P><a name="352097">
<p>
</a>
<A NAME="350661><I>C Binding: </I>void </a>PG_get_line_width(PG_device *dev, REAL *plw)
<BR><A NAME="350662"><I>F77 Binding: </I>integer </a>pgglnw(integer devid, REAL lw)
<BR><A NAME="350663"><I>SX Binding: </I>(</a>pg-line-width dev)
<P><a name="352098">
<p>
</a>
<A NAME="350664><I>C Binding: </I>void </a>PG_set_line_color(PG_device *dev, int lc)
<BR><A NAME="350665"><I>F77 Binding: </I>integer </a>pgslnc(integer devid, integer lc)
<BR><A NAME="350666"><I>SX Binding: </I>(</a>pg-set-line-color! dev lc)
<P><a name="352099">
<p>
</a>
<A NAME="350667><I>C Binding: </I>void </a>PG_set_line_style(PG_device *dev, int ls)
<BR><A NAME="350668"><I>F77 Binding: </I>integer </a>pgslns(integer devid, integer ls)
<BR><A NAME="350669"><I>SX Binding: </I>(</a>pg-set-line-style! dev ls)
<P><a name="352100">
<p>
</a>
<A NAME="350670><I>C Binding: </I>void </a>PG_set_line_width(PG_device *dev, double lw)
<BR><A NAME="350671"><I>F77 Binding: </I>integer </a>pgslnw(integer devid, REAL lw)
<BR><A NAME="350672"><I>SX Binding: </I>(</a>pg-set-line-width! dev lw)
<P><a name="350674">
These routines access the state contained in a PG_device pertaining to lines. Specifically color, width, or style. The set routines take the device and the new value, while the get routines take a device and the address where the current line attribute value is to be put. Line widths go from 0.0 (thinnest) on up with 3.0 being a very thick line. Line styles are: </a>SOLID, </a>DOTTED, </a>DASHED, </a>DOTDASHED.<p>
</a>
<a name="350675">
<h3>5.2.9 </a>Text </a>Attribute Control Routines</h3>
</a>
<a name="350676">
The following provide control over text properties. A good deal of this is either unsupported by many host graphics systems or is superceded by the font based approach common in more modern host graphics systems. Users should preferentially use routines addressing themselves to font and type faces.<p>
</a>
<a name="350677">
<p>
</a>
<A NAME="350678"><CENTER><B></B></CENTER><A NAME="350679"><CENTER><B></B></CENTER><A NAME="350680><I>C Binding: </I>
<BR><A NAME="350681"><I>F77 Binding: </I>integer </a>pgscpw(integer devid, REAL x, REAL y)
<BR><A NAME="350682"><I>SX Binding: </I>(</a>pg-set-char-path! dev x y)
<P><a name="350683">
This routine sets the direction along which text will be written.<p>
</a>
<a name="350684">
<p>
</a>
<A NAME="350685><I>C Binding: </I>void </a>PG_set_char_size_NDC(PG_device *dev, double w, double h)
<BR><A NAME="350686"><I>F77 Binding: </I>
<BR><A NAME="350687"><I>SX Binding: </I>
<P><a name="350688">
Set the current character size in normalized coordinates.<p>
</a>
<a name="350689">
<p>
</a>
<A NAME="350695><I>C Binding: </I>void </a>PG_set_char_space(PG_device *dev, double s)
<BR><A NAME="350696"><I>F77 Binding: </I>
<BR><A NAME="350697"><I>SX Binding: </I>
<P><a name="350698">
This routine sets the spacing between characters in world coordinates.<p>
</a>
<a name="350699">
<p>
</a>
<A NAME="350700><I>C Binding: </I>void </a>PG_set_char_up(PG_device *dev, double x, double y)
<BR><A NAME="350701"><I>F77 Binding: </I>integer </a>pgscuw(integer devid, REAL x, REAL y)
<BR><A NAME="350702"><I>SX Binding: </I>(</a>pg-set-char-up! dev x y)
<P><a name="350703">
This routine sets the direction along which characters will be oriented. This is usually orthogonal to the direction along which characters are written.<p>
</a>
<a name="350704">
<p>
</a>
<A NAME="350705><I>C Binding: </I>void </a>PG_set_font(PG_device *dev, char *face, char *style, int size)
<BR><A NAME="350706"><I>F77 Binding: </I>integer </a>pgstxf(integer devid, integer ncf, char *face, integer ncs, char
*style, integer size)
<BR><A NAME="350707"><I>SX Binding: </I>(</a>pg-set-text-font! dev face style size)
<P><a name="350708">
This routine sets the font in the specified device. Face refers generically to the type face. PGS always supports helvetica, courier, and times. Style refers to the type style and the options are: medium, bold, italic, and bold-italic. Size refers to type size in points.<p>
</a>
<a name="350709">
<p>
</a>
<A NAME="350710><I>C Binding: </I>void </a>PG_set_text_color(PG_device *dev, int tc)
<BR><A NAME="350711"><I>F77 Binding: </I>integer </a>pgstxc(integer devid, integer tc)
<BR><A NAME="350712"><I>SX Binding: </I>(</a>pg-set-text-color! dev tc)
<P><a name="350713">
Set the text color for the specified device.<p>
</a>
<a name="350714">
<p>
</a>
<A NAME="350715"><CENTER><B></B></CENTER><A NAME="350716"><CENTER><B></B></CENTER><A NAME="350717><I>C Binding: </I>
<BR><A NAME="350718"><I>F77 Binding: </I>integer </a>pggcpw(integer devid, REAL x, REAL y)
<BR><A NAME="350719"><I>SX Binding: </I>(</a>pg-character-path dev)
<P><a name="350720">
This routine returns the direction along which text will be written.<p>
</a>
<a name="350721">
<p>
</a>
<A NAME="350722><I>C Binding: </I>
<BR><A NAME="350723"><I>F77 Binding: </I>integer </a>pggcss(integer devid, REAL w, REAL h)
<BR><A NAME="350724"><I>SX Binding: </I>(</a>pg-character-size-ndc dev)
<P><a name="350725">
Return the current character size in normalized coordinates.<p>
</a>
<a name="350726">
<p>
</a>
<A NAME="350727><I>C Binding: </I>
<BR><A NAME="350728"><I>F77 Binding: </I>integer </a>pggcsw(integer devid, REAL w, REAL h)
<BR><A NAME="350729"><I>SX Binding: </I>
<P><a name="350730">
Get the current character size in world coordinates.<p>
</a>
<a name="350731">
<p>
</a>
<A NAME="350732><I>C Binding: </I>void </a>PG_get_char_space(PG_device *dev, REAL *pcsp)
<BR><A NAME="350733"><I>F77 Binding: </I>
<BR><A NAME="350734"><I>SX Binding: </I>
<P><a name="350735">
This routine returns the spacing between characters in world coordinates.<p>
</a>
<a name="350736">
<p>
</a>
<A NAME="350737><I>C Binding: </I>void </a>PG_get_char_up(PG_device *dev, REAL *px, REAL *py)
<BR><A NAME="350738"><I>F77 Binding: </I>integer </a>pggcuw(integer devid, REAL x, REAL y)
<BR><A NAME="350739"><I>SX Binding: </I>(</a>pg-character-up dev)
<P><a name="350740">
This routine returns the direction along which characters will be oriented. This is usually orthogonal to the direction along which characters are written.<p>
</a>
<a name="350741">
<p>
</a>
<A NAME="350742><I>C Binding: </I>void </a>PG_get_font(PG_device *dev, char **face, char **style, int *size)
<BR><A NAME="350743"><I>F77 Binding: </I>integer </a>pggtxf(integer devid, integer ncf, char *face, integer ncs, char
*style, integer size)
<BR><A NAME="350744"><I>SX Binding: </I>(</a>pg-text-font dev)
<P><a name="350745">
This routine queries the font in the specified device. Face refers generically to the type face. PGS always supports helvetica, courier, and times. Style refers to the type style and the options are: medium, bold, italic, and bold-italic. Size refers to type size in points. The FORTRAN binding has some extra behavior. The string lengths here are both input and output variables. On input they contain the lengths of the string buffers, face and style. On output they contain the number of actual characters in their respective strings. If the buffers are not long enough pggtxf returns FALSE and does nothing but return the lengths of the strings. The application can then make a second call with larger buffers.<p>
</a>
<a name="350746">
<p>
</a>
<A NAME="350747><I>C Binding: </I>void </a>PG_get_text_color(PG_device *dev, int *ptc)
<BR><A NAME="350748"><I>F77 Binding: </I>integer </a>pggtxc(integer devid, integer tc)
<BR><A NAME="350749"><I>SX Binding: </I>(</a>pg-text-color dev)
<P><a name="350750">
Query the text color for the specified device.<p>
</a>
<a name="350751">
<p>
</a>
<A NAME="350752><I>C Binding: </I>void </a>PG_get_text_ext(PG_device *dev, char *s, REAL *px, REAL
*py)
<BR><A NAME="350753"><I>F77 Binding: </I>integer </a>pggtew(integer devid, integer nc, char *s, REAL dx, REAL dy)
<BR><A NAME="350754"><I>SX Binding: </I>(</a>pg-text-extent dev s)
<P><a name="350755">
This routine returns the world coordinate extent of the character string s as a width in px and height in py.<p>
</a>
<a name="350756">
<p>
</a>
<A NAME="350757><I>C Binding: </I>
<BR><A NAME="350758"><I>F77 Binding: </I>integer </a>pggtes(integer devid, integer nc, char *s, REAL dx, REAL dy)
<BR><A NAME="350759"><I>SX Binding: </I>
<P><a name="350760">
This routine returns the normalized coordinate extent of the character string s as a width in px and height in py.<p>
</a>
<a name="350761">
<p>
</a>
<a name="350762">
<h3>5.2.10 </a>Graphical </a>Text </a>I/O Routines</h3>
</a>
<a name="350763">
These routines provide the control over terminal or file I/O in graphical applications. The first two are directed at the special device, PG_console_device, which is opened with </a>PG_open_console.<p>
</a>
<a name="350764">
<p>
</a>
<A NAME="350765><I>C Binding: </I>void </a>PG_center_label(PG_device *dev, double sy, char *label)
<BR><A NAME="350766"><I>F77 Binding: </I>integer </a>pgwrcl(integer dev, real sy, integer nc, char *label)
<BR><A NAME="350767"><I>SX Binding: </I>(</a>pg-center-label dev sy label)
<P><a name="350768">
This routine prints a text string, label, on the specified device and centered horizontally with a normalized vertical position specified by sy.<p>
</a>
<a name="350769">
<p>
</a>
<A NAME="350770><I>C Binding: </I>char *</a>PG_fgets(char *buffer, int maxlen, FILE *stream)
<BR><A NAME="350771"><I>F77 Binding: </I> integer </a>pggtln(integer maxlen, char *buffer, integer stream)
<BR><A NAME="350772"><I>SX Binding: </I>
<P><a name="350773">
This function is call compatible with the standard C library </a>fgets call. It gets input from the console device, PG_console_device, window if stream is stdin and from a file otherwise. In the FORTRAN binding using 0 for stream results in the use of stdin.<p>
</a>
<a name="350774">
<p>
</a>
<A NAME="350775><I>C Binding: </I>int </a>PG_fprintf(FILE *fp, char *fmt, ...)
<BR><A NAME="350776"><I>F77 Binding: </I> not applicable
<BR><A NAME="350777"><I>SX Binding: </I>
<P><a name="350778">
This function is call compatible with the standard C library </a>fprintf call. It prints to the console device, PG_console_device, window if fp is stdout and to a file otherwise.<p>
</a>
<a name="350779">
<p>
</a>
<A NAME="350780><I>C Binding: </I>int </a>PG_write_abs(PG_device *dev, double x, double y, char *fmt, ...)
<BR><A NAME="350781"><I>F77 Binding: </I>integer </a>pgwrta(integer devid, REAL x, REAL y, integer nc, char *txt)
<BR><A NAME="350782"><I>SX Binding: </I>(</a>pg-draw-text-abs dev x y txt)
<P><a name="350783">
This routine does an </a>sprintf style print to the specified device, dev, and at the world coordinate point specified by (x, y).<p>
</a>
<a name="350784">
<p>
</a>
<a name="350785">
<h3>5.2.11 </a>Point </a>Move Routines</h3>
</a>
<a name="350786">
PGS maintains two “points”, a text point and a drawing point, at which the next text and line drawing operations will start.<p>
</a>
<a name="350787">
<p>
</a>
<A NAME="350788><I>C Binding: </I>void </a>PG_move_gr_abs(PG_device *dev, double x, double y)
<BR><A NAME="350789"><I>F77 Binding: </I>
<BR><A NAME="350790"><I>SX Binding: </I>
<P><a name="352101">
<p>
</a>
<A NAME="350791><I>C Binding: </I>void </a>PG_move_tx_abs(PG_device *dev, double x, double y)
<BR><A NAME="350792"><I>F77 Binding: </I>
<BR><A NAME="350793"><I>SX Binding: </I>
<P><a name="352102">
<p>
</a>
<A NAME="350794><I>C Binding: </I>void </a>PG_move_tx_rel(PG_device *dev, double x, double y)
<BR><A NAME="350795"><I>F77 Binding: </I>
<BR><A NAME="350796"><I>SX Binding: </I>
<P><a name="350797">
These move the line drawing point (gr) or the text drawing point (tx) to an absolute world coordinate point or relative to the current world coordinate point.<p>
</a>
<a name="350798">
<p>
</a>
<a name="350799">
<h3>5.2.12 </a>Primitive </a>Drawing Routines</h3>
</a>
<a name="350800">
These routines are fundamental drawing routines. Some of these are primitive in the sense that the host graphics systems all seem to supply them. The others are trivial applications of the primitive ones. However, these are termed fundamental in that most other PGS drawing routines are expressed directly in terms of them.<p>
</a>
<a name="350801">
<p>
</a>
<A NAME="350802><I>C Binding: </I>void </a>PG_draw_line(PG_device *dev, double x1, double y1, double x2,
double y2)
<BR><A NAME="350803"><I>F77 Binding: </I>integer </a>pgdrln(integer devid, REAL x1, REAL y1, REAL x2, REAL
y2)
<BR><A NAME="350804"><I>SX Binding: </I>(</a>pg-draw-line dev x1 y1 x2 y2)
<P><a name="350805">
This routine draws a line between two world coordinate points specified by (x1, y1) and (x2, y2).<p>
</a>
<a name="350806">
<p>
</a>
<A NAME="350807><I>C Binding: </I>void </a>PG_draw_to_abs(PG_device *dev, double x, double y)
<BR><A NAME="350808"><I>F77 Binding: </I>
<BR><A NAME="350809"><I>SX Binding: </I>
<P><a name="352103">
<p>
</a>
<A NAME="350810><I>C Binding: </I>void </a>PG_draw_to_rel(PG_device *dev, double x, double y)
<BR><A NAME="350811"><I>F77 Binding: </I>
<BR><A NAME="350812"><I>SX Binding: </I>
<P><a name="350813">
These draw a line segment on the specified device to the absolute world coordinate point specified or relative to the current world coordinate point. These both reset the current drawing point to the destination endpoint.<p>
</a>
<a name="350814">
<p>
</a>
<A NAME="350815><I>C Binding: </I>void </a>PG_draw_polyline(PG_device *dev, REAL *x, REAL *y, int n,
int clp)
<BR><A NAME="350816"><I>F77 Binding: </I>integer </a>pgdpl2(integer devid, REAL x, REAL y, integer n, integer clp)
<BR><A NAME="350817"><I>SX Binding: </I>(</a>pg-draw-polyline-2d dev clp x1 y1 x2 y2 ...)
<P><a name="350818">
This routine draws a connected line on the device, dev, starting with the first point and ending with the last point. The n points are specified in world coordinates and are contained in the x and y arrays. Clp causes the polyline to be clipped to the current viewport if TRUE.<p>
</a>
<a name="350819">
<p>
</a>
<A NAME="350820><I>C Binding: </I>void </a>PG_draw_disjoint_polyline_2(PG_device *dev, REAL *x, REAL
*y, long n, int flag, int coord)
<BR><A NAME="350821"><I>F77 Binding: </I>integer </a>pgsddp2(integer devid, REAL *x, REAL *y, integer n, integer
flag, integer coord)
<BR><A NAME="350822"><I>SX Binding: </I>(</a>pg-draw-disjoint-polyline-2d dev flag coord x1 y1 x2 y2 x3 y3 x4 y4 ...)
<P><a name="350823">
This routine draws n unconnected line segments whose 2n endpoints are specified in the x and y arrays (NOTE: x and y are 2n long!). If flag is TRUE and the device has either range or domain autoranging on, the limits of the points in x and y will be used to reset the world coordinate system. If coord is TRUE the points are taken to be in world coordinates and otherwise in normalized coordinates.<p>
</a>
<a name="350824">
<p>
</a>
<A NAME="350825><I>C Binding: </I>void </a>PG_shade_poly(PG_device *dev, REAL *x, REAL *y, int n)
<BR><A NAME="350826"><I>F77 Binding: </I>integer </a>pgfply(integer devid, REAL *px, REAL *py, integer n, integer
c)
<BR><A NAME="350827"><I>SX Binding: </I>(</a>pg-fill-polygon dev c x1 y1 x2 y2 ...)
<P><a name="350828">
This routine draws a polygon specified by the n world coordinate points in the x and y arrays and fills it with the current fill color (see </a>PG_set_fill_color).<p>
</a>
<a name="350829">
<p>
</a>
<a name="350830">
<h3>5.2.13 </a>Basic </a>Line Drawing Routines</h3>
</a>
<a name="350831">
These routines add some creature comforts to PGS line drawing. They are still low level routines, but they handle some fairly common situations.<p>
</a>
<a name="350832">
<p>
</a>
<A NAME="350833><I>C Binding: </I>void </a>PG_draw_arc(PG_device *dev, double r, double a1, double a2,
double x, double y, int unit)
<BR><A NAME="350834"><I>F77 Binding: </I>
<BR><A NAME="350835"><I>SX Binding: </I>(</a>pg-draw-arc dev r a1 a2 x y unit)
<P><a name="350836">
This routine draws an arc with radius, r, in world coordinates from angles a1 to a2 centered about the point (x, y) in world coordinates. Unit controls whether the angle is specified in degrees or radians. See the description for </a>PG_draw_rad below for additional details.<p>
</a>
<a name="350837">
<p>
</a>
<A NAME="350838><I>C Binding: </I>void </a>PG_draw_box(PG_device *dev, double xmin, double xmax,
double ymin, double ymax)
<BR><A NAME="350839"><I>F77 Binding: </I>integer </a>pgdrbx(integer devid, REAL x1, REAL x2, REAL y1, REAL
y2)
<BR><A NAME="350840"><I>SX Binding: </I>(</a>pg-draw-box dev xmin xmax ymin ymax)
<P><a name="350841">
This routine draws a rectangle from xmin to xmax and from ymin to ymax which are specified in world coordinates.<p>
</a>
<a name="350842">
<p>
</a>
<A NAME="350843><I>C Binding: </I>void </a>PG_draw_disjoint_polyline_3(PG_device *dev, REAL *x, REAL
*y, REAL *z, double theta, double phi, double chi, long
n, int flag, int norm)
<BR><A NAME="350844"><I>F77 Binding: </I>integer </a>pgddp3(integer devid, REAL *x, REAL *y, REAL *z, REAL
theta, REAL phi, REAL chi, integer n, integer flag,
integer norm)
<BR><A NAME="350845"><I>SX Binding: </I>(</a>pg-draw-disjoint-polyline-3d dev theta phi chi flag norm x1 y1 z1 x2 y2
z2 x3 y3 z3 x4 y4 z4 ...)
<P><a name="350846">
This routine draws disjoint three dimensional line segments specified in world coordinates. The number of segments, n, is half the number of points. The arrays x, y, and z define the endpoint vectors X. X[2*i] is one endpoint of the ith segment, and X[2*i+1] is the other endpoint. The </a>viewing angle is specified by theta, phi, and chi. The flag norm determines whether the segment will be converted to normalized coordinates, and flag specifies whether the line segments are clipped to the viewport limits.<p>
</a>
<A NAME="350847><I>C Binding: </I>void </a>PG_draw_markers(PG_device *dev, int n, REAL *x, REAL *y,
int marker)
<BR><A NAME="350848"><I>F77 Binding: </I>integer </a>pgdrmk(integer dev, integer n, real x, real y, integer marker)
<BR><A NAME="350849"><I>SX Binding: </I>(</a>pg-draw-markers dev marker x y)
<P><a name="350850">
This routine draws the marker character specified by marker at each of the n world coordinate points defined by the x and y arrays on the specified device.<p>
</a>
<a name="350851">
<p>
</a>
<A NAME="350852><I>C Binding: </I>void </a>PG_draw_rad(PG_device *dev, double rmin, double rmax,
double a, double x, double y, int unit)
<BR><A NAME="350853"><I>F77 Binding: </I>
<BR><A NAME="350854"><I>SX Binding: </I>(</a>pg-draw-radius dev rmin rmax a x y unit)
<P><a name="350855">
This routine draws a radial line from the central point (x, y) from rmin to rmax along the direction specified by the angle a (with respect to positive x axis increasing counter-clockwise). If unit has the value DEGREE then the angle a is in degrees and otherwise it is in radians (there is a RADIAN constant for symmetry).<p>
</a>
<a name="350856">
<p>
</a>
<a name="350857">
<h3>5.2.14 </a>Axis </a>Drawing Routines</h3>
</a>
<a name="350858">
These routines handle various aspects of drawing axes. The most basic routine here draws a single axis with very general and controllable characteristics.<p>
</a>
<a name="350859">
<p>
</a>
<A NAME="350860><I>C Binding: </I>void </a>PG_axis(PG_device *dev, int axis_type)
<BR><A NAME="350861"><I>F77 Binding: </I>integer </a>pgaxis(integer devid, integer axt)
<BR><A NAME="350862"><I>SX Binding: </I>(</a>pg-axis device type)
<P><a name="350863">
This routine draws a set of axes which are tied to the viewport and world coordinate system. The valid values for axis_type are: </a>CARTESIAN, </a>POLAR, and </a>INSEL. The axes are drawn on the view boundary. See the drawing model section above for the definition of the view boundary.<p>
</a>
<a name="350864">
<p>
</a>
<A NAME="350865><I>C Binding: </I>void </a>PG_axis_3d(PG_device *dev, REAL *px, REAL *py, REAL *pz,
int n_pts, double theta, double phi, double chi, double
xmn, double xmx, double ymn, double ymx, double zmn,
double zmx, int norm)
<BR><A NAME="350866"><I>F77 Binding: </I>integer </a>pgdax3(integer devid, REAL *x, REAL *y, REAL *z, integer
n, REAL theta, REAL phi, REAL chi, integer norm)
<BR><A NAME="350867"><I>SX Binding: </I>
<P><a name="350868">
This routine draws a simple set of 3D axes oriented at the specified angle. The extent of the axes is determined by the n_pts points in (px, py, pz). The </a>view angle for the axes is specified by theta, phi, and chi. The unrotated limits of the data are specified by xmn, xmx, ymn, ymx, zmn, and zmx. If the axes should be drawn to normalized coordinates the norm flag should be TRUE.<p>
</a>
<a name="350869">
<p>
</a>
<A NAME="350870><I>C Binding: </I>PG_axis_def *</a>PG_draw_axis(PG_device *dev, double xl, double yl,
double xr, double yr, double t1, double t2, double v1,
double v2, double sc, char *format, int tick_type, int
label_type, int flag, ...)
<BR><A NAME="350871"><I>F77 Binding: </I>integer </a></a>pgdrax(integer devid, REAL xl, REAL yl, REAL xr, REAL yr,
REAL t1, REAL t2, REAL v1, REAL v2, REAL sc,
integer nc, char *format, integer tickdef, integer
tick_type, integer label_type)
<BR><A NAME="350872"><I>SX Binding: </I>(</a>pg-draw-axis dev xl yl xr yr t1 t2 v1 v2 sc format tick_type label_type
tickdef)
<P><a name="350873">
This routine will draw a single axis and produce labels and/or ticks depending on the arguments. The arguments are:<p>
</a>
<A NAME="350874">(xl, yl) coordinate of beginning end
<P><A NAME="350875">(xr, yr) coordinate of terminating end
<P><A NAME="350876">(t1, t2) fractional position of v1 and v2
<P><A NAME="350877">(v1, v2) first and last tick or label value
<P><A NAME="350878">sc an additional scale factor which is used, for example, when doing an
Inselberg axis in which the range may correspond to one appropriate for the
perpendicular dimension (set to 1.0 in most cases)
<P><A NAME="350879">format specifies the label format in the standard C way
<P><A NAME="350880">tick_type types of ticks
<P><A NAME="350881"><PRE> </a>RIGHT_OF_AXIS ticks on right
</PRE><A NAME="350882"><PRE> </a>LEFT_OF_AXIS ticks on left
</PRE><A NAME="350883"><PRE> </a>STRADDLE_AXIS ticks straddle (both)
</PRE><A NAME="350884">label_type types of labels
<P><A NAME="350885"><PRE> </a>RIGHT_OF_AXIS labels on right
</PRE><A NAME="350886"><PRE> </a>LEFT_OF_AXIS labels on left
</PRE><A NAME="350887"><PRE> </a>NOTHING_ON_AXIS no labels
</PRE><A NAME="350888"><PRE> </a>ENDS labels at ends of axis
</PRE><A NAME="350889">tickdef specifies the labels and ticks - one or more may be given and the list is
terminated with a value of 0.
<P><A NAME="350890"><PRE> </a>MAJOR major ticks
</PRE><A NAME="350891"><PRE> </a>MINOR minor ticks
</PRE><A NAME="350892"><PRE> </a>LABEL labels
</PRE><A NAME="352280">flag if TRUE return a pointer to a PG_axis def structure (this is mainly for
internal use) otherwise return NULL.
<P><a name="350893">
An axis is a directed line segment (from Xl to Xr) with ticks. The label values as defined by v1, v2, t1, and t2; the ticks associate with the line segment as follows:<p>
</a>
<a name="350894">
(xl, yl) (xr, yr)<p>
</a>
<a name="350895">
------------------------------------------> Axis<p>
</a>
<a name="350896">
| | Ticks<p>
</a>
<a name="350897">
v1 = v(t1) v2 = v(t2) Tick Labels (v)<p>
</a>
<a name="350898">
<p>
</a>
<A NAME="350899><I>C Binding: </I>int </a>PG_set_axis_attributes(PG_device *dev, ...)
<BR><A NAME="350900"><I>F77 Binding: </I>integer </a>pgsaxa(integer devid, integer n, REAL attr, char *attrs)
<BR><A NAME="350901"><I>SX Binding: </I>
<P><a name="350902">
This routine sets the parameters which control the look of the axes being drawn. An arbitrary number of specifications can be made in key/value pairs. The list is terminated with a zero key. In the F77 binding the key/value pairs are placed as floating point numbers in the array attr. The value n is the number of pairs. If the attribute is a character string, the value is put in the character array attrs, and the number of characters is put in attr as the attribute value following the attribute key. The character strings are packed together with no space between the attribute values. This also means that the order of the attributes in the array attr must match those in attrs since only the number of characters is used to associate the attribute with its position in the string attrs.<p>
</a>
<a name="352460">
The control keys are:<p>
</a>
<A NAME="350903">Name Type Value Description
<P><A NAME="352461"></a>AXIS_LINESTYLE integer 1 style of the lines
<P><A NAME="350904"></a>AXIS_LINETHICK real 2 thickness of the lines
<P><A NAME="350905"></a>AXIS_LINECOLOR integer 3 color of the lines
<P><A NAME="350906"></a>AXIS_LABELCOLOR integer 4 color of the labels
<P><A NAME="350907"></a>AXIS_LABELFONT char * 6 label font type face
<P><A NAME="350908"></a>AXIS_LABELPREC integer 7 character precision
<P><A NAME="350909"></a>AXIS_X_FORMAT char * 8 format of the x labels
<P><A NAME="350910"></a>AXIS_Y_FORMAT char * 9 format of the y labels
<P><A NAME="350911"></a>AXIS_TICKSIZE real 10 tick size in fraction of axis length
<P><A NAME="350912"></a>AXIS_GRID_ON integer 11 turn on grid iff TRUE
<P><A NAME="350913"></a>AXIS_SIGNIF_DIGIT integer 12 number of digits in labels
<P><A NAME="350914"></a>AXIS_CHAR_ANGLE real 13 orientation angle for label
<P><A NAME="352462"> characters (not supported on
<P><A NAME="352463"> all devices)
<P><A NAME="352496><I>C Binding: </I>void </a>PG_get_axis_decades(REAL *d)
<BR><A NAME="352501"><I>F77 Binding: </I>integer </a>pggaxd(real d)
<BR><A NAME="352502"><I>SX Binding: </I>
<P><a name="352503">
This routine returns the current </a>maximum number of decades that log axes will span in the argument d. This facility is primarily aimed at making the use of logarithmic axes more flexible by defining a user controlled limit to the number of decades plotted. In this way, potentially ill-defined logarithmic values (such as very small positive numbers) don’t interfere with the display of otherwise fine values.<p>
</a>
<A NAME="352498><I>C Binding: </I>void </a>PG_set_axis_decades(REAL *d)
<BR><A NAME="352499"><I>F77 Binding: </I>integer </a>pgsaxd(real d)
<BR><A NAME="352500"><I>SX Binding: </I>
<P><a name="352497">
This routine sets the current </a>maximum number of decades that log axes will span to the value of the argument d. This facility is primarily aimed at making the use of logarithmic axes more flexible by defining a user controlled limit to the number of decades plotted. In this way, potentially ill-defined logarithmic values (such as very small positive numbers) don’t interfere with the display of otherwise fine values.<p>
</a>
<a name="350915">
<h3>5.2.15 </a>Colormap Related Routines</h3>
</a>
<a name="350916">
<p>
</a>
<A NAME="350917><I>C Binding: </I>void </a>PG_show_colormap(PG_device *dev, int all)
<BR><A NAME="350918"><I>F77 Binding: </I>
<BR><A NAME="350919"><I>SX Binding: </I>
<P><a name="350920">
Display the </a>colormap for the current </a>palette if all is FALSE and for the entire device colormap if all is TRUE.<p>
</a>
<a name="350921">
<p>
</a>
<A NAME="350922><I>C Binding: </I>void </a>PG_show_palettes(PG_device *dev, char *type, int wbck)
<BR><A NAME="350923"><I>F77 Binding: </I>
<BR><A NAME="350924"><I>SX Binding: </I>(</a>pg-show-palettes dev wbck)
<P><a name="350925">
This routine pops up a temporary new window to display the palettes available for the specified device. The user may browse through the palettes and select one to be the new current palette. When the selection is made the palette window goes away. The type argument specifies the type of device to be spawned (WINDOW, PS, or CGM), this is useful for making hardcopies of the palette set. The wbck argument is TRUE if a white background is wanted and FALSE for a black one.<p>
</a>
<a name="350926">
<p>
</a>
<A NAME="350927><I>C Binding: </I>PG_palette *</a>PG_make_palette(PG_device *dev, char *name, int nc,
int wbck)
<BR><A NAME="350928"><I>F77 Binding: </I>
<BR><A NAME="350929"><I>SX Binding: </I>(</a>pg-make-palette dev name nc wbck)
<P><a name="350930">
This routine pops up a temporary new window with the available colors of the device and lets the user select from those colors to build up a new palette. When finished the window is dismissed and the new palette becomes the current palette of the device. Colors are selected by clicking on them with the left mouse button. Any number of colors may be selected in this fashion, however, colors selected after the ncth replace previously selected colors. When the new palette is completed, clicking the right button signals acceptance and the window goes away. The new palette is written into a file whose name is the same as the palette name and with a “.pal” extension. The number of colors requested is nc and if wbck is TRUE the temporary window has a white background (otherwise a black one). The palette file can be read in again with the </a>PG_rd_palette function.<p>
</a>
<a name="350931">
<p>
</a>
<A NAME="350932><I>C Binding: </I>PG_palette *</a>PG_rd_palette(PG_device *dev, char *fname)
<BR><A NAME="350933"><I>F77 Binding: </I>
<BR><A NAME="350934"><I>SX Binding: </I>(</a>pg-read-palette dev fname)
<P><a name="350935">
This function reads a palette file and makes the resulting palette the current palette of the specified device. The </a>format of a palette file is simple. It is an ASCII file whose first line contains the name of the palette and the number of colors, nc. The next nc lines contain normalized red, green, and blue values.<p>
</a>
<a name="350936">
<p>
</a>
<A NAME="350937><I>C Binding: </I>int </a>PG_wr_palette(PG_device *dev, PG_palette *pal, char *fname)
<BR><A NAME="350938"><I>F77 Binding: </I>
<BR><A NAME="350939"><I>SX Binding: </I>(</a>pg-write-palette dev pal fname)
<P><a name="350940">
This function writes a specified palette, pal, to a palette file. The </a>format of a palette file is simple. It is an ASCII file whose first line contains the name of the palette and the number of colors, nc. The next nc lines contain normalized red, green, and blue values.<p>
</a>
<a name="350941">
<h3>5.2.16 </a>Graph Control Routines</h3>
</a>
<a name="350942">
These routines control the state of graphs or act on them.<p>
</a>
<a name="350944">
These routines are at the other end of the scale from the previous low level routines. They perform complex drawing operations which are driven by user oriented specifications.<p>
</a>
<a name="350945">
<p>
</a>
<A NAME="350946><I>C Binding: </I>void </a>PG_draw_graph(PG_device *dev, PG_graph *data)
<BR><A NAME="350947"><I>F77 Binding: </I>integer </a>pgplot(integer devid, integer dataid)
<BR><A NAME="350948"><I>SX Binding: </I>(</a>pg-draw-graph dev [data]* rendering)
<P><a name="350949">
This routine draws the graph specified by data on the device specified by dev. The PG_graph structure contains both data and rendering specifications.<p>
</a>
<a name="350950">
<p>
</a>
<A NAME="350951><I>C Binding: </I>void </a>PG_domain_plot(PG_device *dev, PM_set *dom, PM_set *ran)
<BR><A NAME="350952"><I>F77 Binding: </I>integer </a>pgdplt(integer devid, integer domid)
<BR><A NAME="350953"><I>SX Binding: </I>(</a>pg-draw-domain dev [dom]* [type extrema])
<P><a name="350954">
This routine draws the domain set specified by dom on the device specified by dev. The PM_set structure contains the data. This is the generalization of a </a>mesh plot. A range set, ran, may optionally be provided if labels or other information associated with the mesh points are desired. The FORTRAN and SX bindings do not allow a range to be given at this time. The SX binding does allow for plotting limits to be set on the domain. They are specified by n (min, max) pairs where n is the dimensionality of the domain. The plot type may also be directly specified as PLOT_SURFACE, PLOT_MESH, or PLOT_WIRE_MESH instead of in the attribute list of the PM_set. The default is PLOT_WIRE_MESH<p>
</a>
<a name="350955">
<p>
</a>
<A NAME="352409><I>C Binding: </I>void </a>PG_get_identifier(PG_graph *g, int id)
<BR><A NAME="352410"><I>F77 Binding: </I>integer </a>pgggid(integer gid, integer id)
<BR><A NAME="352411"><I>SX Binding: </I>
<P><a name="352412">
Return the identifier character, id, of the specified graph. In the C binding this is a macro.<p>
</a>
<a name="352413">
<p>
</a>
<A NAME="352399><I>C Binding: </I>void </a>PG_get_render_info(PG_graph *g, pcons *alst)
<BR><A NAME="352400"><I>F77 Binding: </I>integer </a>pgginf(integer gid, integer alst)
<BR><A NAME="352401"><I>SX Binding: </I>
<P><a name="352402">
Return the </a>attribute list, alst, of the specified graph. In the C binding this is a macro.<p>
</a>
<a name="352408">
<p>
</a>
<A NAME="352404><I>C Binding: </I>
<BR><A NAME="352405"><I>F77 Binding: </I>integer </a>pgsdlm(integer grid, integer n, REAL v)
<BR><A NAME="352406"><I>SX Binding: </I>(</a>pg-set-domain-limits! gr v1mn v1mx ...)
<P><a name="352407">
Restrict the domain of the mapping contained in the graph to the values in the array v. There are 2n values in (min, max) pairs where n is the dimensionality of the domain.<p>
</a>
<a name="352414">
<p>
</a>
<A NAME="350956><I>C Binding: </I>void </a>PG_set_identifier(PG_graph *g, int id)
<BR><A NAME="350957"><I>F77 Binding: </I>integer </a>pgsgid(integer gid, integer id)
<BR><A NAME="350958"><I>SX Binding: </I>
<P><a name="350959">
Set the </a>identifier character, id, of the specified graph. In the C binding this is a macro.<p>
</a>
<a name="350960">
<p>
</a>
<A NAME="352415><I>C Binding: </I>void </a>PG_set_render_info(PG_graph *g, pcons *alst)
<BR><A NAME="352416"><I>F77 Binding: </I>integer </a>pgsinf(integer gid, integer alst)
<BR><A NAME="352417"><I>SX Binding: </I>
<P><a name="352418">
Set the </a>attribute list, alst, of the specified graph. In the C binding this is a macro.<p>
</a>
<a name="352419">
<p>
</a>
<A NAME="350961><I>C Binding: </I>
<BR><A NAME="350962"><I>F77 Binding: </I>integer </a>pgsrat(integer grid, integer n, char *name, integer t, char
*type, char *val)
<BR><A NAME="350963"><I>SX Binding: </I>(</a>pg-set-graph-attribute! gr name type val)
<P><a name="350964">
Set a single rendering attribute in the specified graph. The name of the attribute is in name, its type in type and its value in val. See the section on attributes for more information on attributes and their values.<p>
</a>
<a name="352403">
<p>
</a>
<A NAME="349948><I>C Binding: </I>void </a>PG_set_plot_type(pcons *inf, int plt, int axs)
<BR><A NAME="350466"><I>F77 Binding: </I>
<BR><A NAME="350467"><I>SX Binding: </I>
<P><a name="350468">
Set the plot type, plt, and axis type, axs, for the specified association list, inf. This list is usually the info part of a PG_graph.<p>
</a>
<a name="350469">
<p>
</a>
<A NAME="350965><I>C Binding: </I>
<BR><A NAME="350966"><I>F77 Binding: </I>integer </a>pgsrlm(integer grid, integer n, REAL v)
<BR><A NAME="350967"><I>SX Binding: </I>(</a>pg-set-range-limits! gr v1mn v1mx ...)
<P><a name="350968">
Restrict the range of the mapping contained in the graph to the values in the array v. There are 2n values in (min, max) pairs where n is the dimensionality of the range.<p>
</a>
<a name="350969">
<p>
</a>
<A NAME="350970><I>C Binding: </I>
<BR><A NAME="350971"><I>F77 Binding: </I>integer </a>pgsvlm(integer grid, REAL v)
<BR><A NAME="350972"><I>SX Binding: </I>
<P><a name="350973">
A PG_graph may have its own viewport limits which supercede the device viewport limits. This function takes an array, v, containing the limits and attaches them to the info list of the specified graph, grid. The limits are arranged as xmin, xmax, ymin, ymax.<p>
</a>
<a name="350974">
<p>
</a>
<a name="350975">
<h3>5.2.17 </a>Line </a>Plot Routines</h3>
</a>
<a name="350976">
These routines plot curves in various renderings.<p>
</a>
<a name="350977">
<p>
</a>
<A NAME="350978><I>C Binding: </I>void </a>PG_plot_curve(PG_device *dev, REAL *x, REAL *y, int n, pcons
*info, int l)
<BR><A NAME="350979"><I>F77 Binding: </I>integer </a>pgplln(integer devid, REAL *px, REAL *py, integer n, integer
mod, integer axt, integer col, REAL wid, integer sty,
integer sca, integer mrk, integer sta, integer l)
<BR><A NAME="350980"><I>SX Binding: </I> use pg-draw-graph
<P><a name="350981">
This routine is a moderately high level routine in that it will call the other routines depending on the values in the association list info and plot the n points in the x and y arrays. In the FORTRAN binding the following attributes may be passed directly:<p>
</a>
<A NAME="352271">mod </a>plot type (</a>CARTESIAN, </a>POLAR, </a>INSEL)
<P><A NAME="352272">axt </a>axis type (CARTESIAN, POLAR, INSEL)
<P><A NAME="352273">col </a>line color
<P><A NAME="352274">wid </a>line width
<P><A NAME="352275">sty </a>line style
<P><A NAME="352276">sca </a>scatter plot flag
<P><A NAME="352277">mrk </a>marker index
<P><A NAME="352278">sta </a>histogram starting point (</a>LEFT, </a>CENTER, </a>RIGHT)
<P><A NAME="352279">l if FALSE the world coordinates are recomputed from the data and the axes are
drawn
<P><A NAME="350982><I>C Binding: </I>void </a>PG_histogram_plot(PG_device *dev, REAL *x, REAL *y, int n,
int lncol, double lnwid, int lnsty, int scatter, int marker,
int start, int l)
<BR><A NAME="350986"><I>F77 Binding: </I> use pgplot
<BR><A NAME="350984"><I>SX Binding: </I> use pg-draw-graph
<P><a name="350985">
<p>
</a>
<A NAME="350943><I>C Binding: </I>void </a>PG_insel_plot(PG_device *dev, REAL *x, REAL *y, int n, int
lncol, double lnwid, int lnsty, int l)
<BR><A NAME="350989"><I>F77 Binding: </I> use pgplot
<BR><A NAME="350987"><I>SX Binding: </I> use pg-draw-graph
<P><a name="350988">
<p>
</a>
<A NAME="352104><I>C Binding: </I>void </a>PG_polar_plot(PG_device *dev, REAL *x, REAL *y, int n, int
lncol, double lnwid, int lnsty, int scatter, int marker, int
l)
<BR><A NAME="350992"><I>F77 Binding: </I> use pgplot
<BR><A NAME="350990"><I>SX Binding: </I> use pg-draw-graph
<P><a name="350991">
<p>
</a>
<A NAME="352105><I>C Binding: </I>void </a>PG_rect_plot(PG_device *dev, REAL *x, REAL *y, int n, int
lncol, double lnwid, int lnsty, int scatter, int marker, int
l)
<BR><A NAME="351100"><I>F77 Binding: </I> use pgplot
<BR><A NAME="350993"><I>SX Binding: </I> use pg-draw-graph
<P><a name="350994">
These routines plot the n points in the x and y arrays as a: rectangular cartesian plot; histogram plot; Inselberg plot; or polar plot. The qualifying arguments are:<p>
</a>
<A NAME="350995">lncol line color
<P><A NAME="350996">lnwid line width
<P><A NAME="350997">lnsty line style
<P><A NAME="350998">scatter TRUE for scatter plot
<P><A NAME="350999">marker index of marker character for scatter plots
<P><A NAME="351000">start </a>LEFT, </a>RIGHT, or </a>CENTER start for histogram plots
<P><A NAME="351001">l if TRUE the world coordinate system is redefined by x and y data
<P><a name="351002">
<h3>5.2.18 </a>Contour </a>Plotting Routines</h3>
</a>
<a name="351003">
<p>
</a>
<A NAME="351004><I>C Binding: </I>void </a>PG_contour_plot(PG_device *dev, PG_graph *data)
<BR><A NAME="351005"><I>F77 Binding: </I> use pgplot
<BR><A NAME="351006"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351007">
This routine renders the specified graph as a contour plot. </a>PG_draw_graph dispatches to this routine when the rendering specified in data is a contour plot.<p>
</a>
<a name="351008">
<p>
</a>
<A NAME="351009><I>C Binding: </I>
<BR><A NAME="351010"><I>F77 Binding: </I>integer </a>pgplcn(integer devid, REAL x, REAL y, REAL z, REAL lev,
integer k, integer l, integer nlev, integer labl, integer
alst)
<BR><A NAME="351011"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351012">
Make a </a>contour plot of the given </a>data set on the specified </a>device. The arguments are:<p>
</a>
<A NAME="351037">(x, y) coordinate point arrays
<P><A NAME="352113">z data array
<P><A NAME="352122">lev contour level value array
<P><A NAME="352117">(k, l) array dimensions
<P><A NAME="352119">nlev number of contour levels
<P><A NAME="352121">labl starting label character if non-zero
<P><A NAME="352464">alst an integer attribute list identifier (use 0 if none)
<P><a name="351013">
<p>
</a>
<A NAME="351014><I>C Binding: </I>int </a>PG_contour_levels(REAL *lev, int nlev, double fmn, double fmx,
double ratio)
<BR><A NAME="351015"><I>F77 Binding: </I>integer </a>pgclev(REAL lev, integer nlev, REAL fmn, REAL fmx, REAL
ratio)
<BR><A NAME="351016"><I>SX Binding: </I> set LEVEL attribute
<P><a name="351017">
Compute an array of nlev iso contour levels between fmn and fmx using the spacing ratio. Put them in the space provided, lev. The arguments are:<p>
</a>
<A NAME="352123">lev the array of contour levels
<P><A NAME="352124">nlev the number of contour levels
<P><A NAME="352125">(fmn, fmx ) the minimum and maximum values for contour levels
<P><A NAME="352127">ratio the spacing ratio between contour levels
<P><a name="351019">
<h3>5.2.19 </a>Filled Polygon Plot Routines</h3>
</a>
<a name="351020">
<p>
</a>
<A NAME="351021><I>C Binding: </I>void </a>PG_poly_fill_plot(PG_device *dev, PG_graph *data)
<BR><A NAME="351022"><I>F77 Binding: </I> use pgplot
<BR><A NAME="351023"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351024">
This routine renders the specified graph as a filled polygon plot. </a>PG_draw_graph dispatches to this routine when the rendering specified in data is a a filled polygon plot.<p>
</a>
<a name="351025">
<p>
</a>
<a name="351026">
<h3>5.2.20 </a>Image </a>Plot Routines</h3>
</a>
<a name="351027">
<p>
</a>
<A NAME="351028><I>C Binding: </I>void </a>PG_image_plot(PG_device *dev, PG_graph *data)
<BR><A NAME="351029"><I>F77 Binding: </I> use pgplot
<BR><A NAME="351030"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351031">
This routine renders the specified graph as a raster image plot. </a>PG_draw_graph dispatches to this routine when the rendering specified in data is an image plot.<p>
</a>
<a name="351032">
<p>
</a>
<A NAME="352106><I>C Binding: </I>void </a>PG_draw_image(PG_device *dev, PG_image *im, char *label,
pcons *alist)
<BR><A NAME="352107"><I>F77 Binding: </I>
<BR><A NAME="352108"><I>SX Binding: </I>(</a>pg-draw-image dev im)
<P><a name="352109">
This routine makes an image plot from a PG_image structure. A pointer to the image is in im and a label for the plot is in label.<p>
</a>
<a name="352110">
<p>
</a>
<A NAME="351033><I>C Binding: </I>
<BR><A NAME="351034"><I>F77 Binding: </I>integer </a>pgplim(integer devid, integer nc, char *name, integer nct, char
*type, REAL *pz, integer k, integer l, REAL xmn,
REAL xmx, REAL ymn, REAL ymx, REAL zmn,
REAL zmx, integer alst)
<BR><A NAME="351035"><I>SX Binding: </I>
<P><a name="351036">
This routine makes an image plot from “raw” data. The arguments are:<p>
</a>
<A NAME="352111">name the name of the image (used as a label for the plot)
<P><A NAME="352112">type the type of the data (“char”, “short”, “int”, “long”, “float”, “double”)
<P><A NAME="352114">z the array of pixel values (will be scaled to the current palette of the
device)
<P><A NAME="352115">(k, l) the dimensions of the image
<P><A NAME="352116">(xmn, xmx) the minimum and maximum x values (for axis labels)
<P><A NAME="352118">(ymn, ymx) the minimum and maximum y values (for axis labels)
<P><A NAME="352120">(zmn, zmx) the nminimum and maximum data values (for palette labels)
<P><A NAME="352465">alst an integer attribute list identifier (use 0 if none)
<P><A NAME="351038><I>C Binding: </I>void </a>PG_draw_palette(PG_device *dev, double xmn, double ymn,
double xmx, double ymx, double zmn, double zmx,
double wid)
<BR><A NAME="351039"><I>F77 Binding: </I>integer </a>pgdrpa(integer devid, REAL xmn, REAL ymn, REAL xmx,
REAL ymx, REAL zmn, REAL zmx, REAL wid)
<BR><A NAME="351040"><I>SX Binding: </I>(</a>pg-draw-palette dev xmn ymn xmx ymx zmn zmx wid)
<P><a name="351041">
This routine draws the specified device palette as a raster image. The palette is drawn next to the viewport in a rectangle along an axis specified by the points (xmn, ymn) and (xmx, ymx). The axis is labeled by values ranging from zmn to zmx. The width of the palette in the rectangle is specified in normalized form by wid.<p>
</a>
<a name="351042">
<h3>5.2.21 </a>Surface </a>Plot Routines</h3>
</a>
<a name="351043">
<p>
</a>
<A NAME="351044><I>C Binding: </I>void </a>PG_surface_plot(PG_device *dev, PG_graph *data)
<BR><A NAME="350673"><I>F77 Binding: </I> use pgplot
<BR><A NAME="351046"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351047">
This routine renders the specified graph as a surface plot. </a>PG_draw_graph dispatches to this routine when the rendering specified in data is a surface plot.<p>
</a>
<a name="351048">
<p>
</a>
<A NAME="351049><I>C Binding: </I>void </a>PG_draw_surface(PG_device *dev, REAL *a1, REAL *a2,
REAL *aext, REAL *x, REAL *y, int nn, double xmn,
double xmx, double ymn, double ymx, double theta,
double phi, double chi, double width, int color, int style,
int type, char *label, char *mesh_type, void *cnnct,
pcons *alist)
<BR><A NAME="351050"><I>F77 Binding: </I>integer </a>pgplsf(integer devid, REAL *px, REAL *py, REAL *pz,
integer n, REAL xn, REAL xx, REAL yn, REAL yx,
REAL zn, REAL zx, integer kx, integer lx, REAL th,
REAL ph, REAL ch, integer typ, integer col, REAL wid,
integer sty, integer nc, char *label)
<BR><A NAME="351051"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351052">
This routine is a medium level routine which can be called directly from applications. The data can be rendered as a wire frame mesh or as a true shaded surface. Both forms do hidden line and hidden surface removal. The algorithm uses a raster scan line approach with a single Z buffer line. This choice minimizes the memory requirements of the routine at some expense of speed.<p>
</a>
<a name="351171">
The arguments are:<p>
</a>
<A NAME="351053">dev the device to which the plot is drawn
<P><A NAME="351054">a1, a2 the arrays specifying height of the surface and color shading. If
the color array is NULL the a1 array will do both height and color in a shaded
plot
<P><A NAME="351055">aext the minimum and maximum values for a1 and a2
<P><A NAME="351056">x, y the x and y components of the positions of the nodes
<P><A NAME="351057">nn the number of points
<P><A NAME="351058">xmn, xmx the minimum and maximum values for x
<P><A NAME="351059">ymn, ymx the minimum and maximum values for y
<P><A NAME="351060">theta, phi, chi the Euler view angles
<P><A NAME="351061">width the line width to use
<P><A NAME="351062">color the line color to use
<P><A NAME="351063">style the line style to use
<P><A NAME="351064">type </a>PLOT_SURFACE or </a>PLOT_WIRE_MESH
<P><A NAME="351065">name a label for the plot
<P><A NAME="351066">mesh_type “</a>Logical-Rectangular” (LR) or “</a>Arbitrarily-Connected” (AC)
<P><A NAME="351067">cnnct connectivity specifications: array of dimensions for LR meshes
or a pointer to a </a>PM_mesh_topology struct for AC meshes
<P><A NAME="351068">alist association list of plotting attributes
<P><a name="351069">
<p>
</a>
<a name="351070">
<h3>5.2.22 </a>Vector </a>Plot Routines</h3>
</a>
<a name="351071">
<p>
</a>
<A NAME="351072><I>C Binding: </I>void </a>PG_vector_plot(PG_device *dev, PG_graph *data)
<BR><A NAME="351045"><I>F77 Binding: </I> use pgplot
<BR><A NAME="351074"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351075">
This routine renders the specified graph as a vector plot. </a>PG_draw_graph dispatches to this routine when the rendering specified in data is a vector plot.<p>
</a>
<a name="351076">
<p>
</a>
<A NAME="351077><I>C Binding: </I>
<BR><A NAME="351078"><I>F77 Binding: </I>integer </a>pgplvc(integer devid, REAL *px, REAL *py, REAL *pu,
REAL *pv, integer n, integer alst)
<BR><A NAME="351079"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351080">
Make a </a>vector plot of the given </a>data set on the specified </a>device.<p>
</a>
<A NAME="352466">devid an integer attribute list identifier (use 0 if none)
<P><A NAME="351018">(px, py) farrays containing the x and y positions
<P><A NAME="352469">(pu, pv) farrays containing the u and v vector components
<P><A NAME="352467">n an integer number of vectors
<P><A NAME="352468">alst an integer attribute list identifier (use 0 if none)
<P><a name="351081">
<p>
</a>
<A NAME="351082><I>C Binding: </I>void </a>PG_set_vec_attr(PG_device *dev, ...)
<BR><A NAME="351083"><I>F77 Binding: </I>integer </a>pgsvat(integer devid, ...)
<BR><A NAME="351084"><I>SX Binding: </I>(</a>pg-set-vector-attributes! dev ...)
<P><a name="351085">
This routine sets the properties of the vectors for the next vector plot. The parameters are paired, optional, and can be in any order. For each pair, the first value describes the option, the second, the value. The options are ints. The values can be ints, REALs, or chars. What type the values are is determined by the option. Most values are normalized to unity with the angle being the exception. The list must be ended with a zero. The attributes are:<p>
</a>
<A NAME="351086"><PRE> C Id FORTRAN Id Description Default
</PRE><A NAME="351087"><PRE> </a>VEC_SCALE 1 </a>scale factor on lengths 1.0
</PRE><A NAME="351088"><PRE> </a>VEC_ANGLE 2 </a>angle between </a>wings 22.5
</PRE><A NAME="351089"><PRE> </a>VEC_HEADSIZE 3 </a>length of the wings 0.05
</PRE><A NAME="351090"><PRE> </a>VEC_FIXSIZE 4 a </a>fixed </a>vector length 0.0
</PRE><A NAME="351091"><PRE> </a>VEC_MAXSIZE 5 a </a>maximum vector length 0.0
</PRE><A NAME="351092"><PRE> </a>VEC_LINESTYLE 6 </a>line style of vectors 1
</PRE><A NAME="351093"><PRE> </a>VEC_LINETHICK 7 </a>line width of vectors 0.0
</PRE><A NAME="351094"><PRE> </a>VEC_COLOR 8 </a>line color of vectors WHITE
</PRE><A NAME="351095"><PRE> </a>VEC_FIXHEAD 9 a </a>fixed </a>head size FALSE
</PRE><a name="351096">
<h3>5.2.23 </a>Level Diagram </a>Plot Routine</h3>
</a>
<a name="351097">
This routine draws a level diagram or grotrian plot.<p>
</a>
<a name="351098">
<p>
</a>
<A NAME="351099><I>C Binding: </I>void </a>PG_</a>grotrian_plot(PG_device *dev, PG_graph *data)
<BR><A NAME="351073"><I>F77 Binding: </I> use pgplot
<BR><A NAME="351101"><I>SX Binding: </I> use pg-draw-graph
<P><a name="351102">
This routine renders the specified graph as a level diagram plot. </a>PG_draw_graph dispatches to this routine when the rendering specified in data is a level diagram plot. These graphs have an unusual data layout and would not produce a very meaningful plot rendered any other way.<p>
</a>
<a name="351103">
<h3>5.2.24 Graphical Interface Routines</h3>
</a>
<a name="351104">
These routines supply a capability for applications to develop portable, user and runtime configurable graphical user interfaces.<p>
</a>
<a name="351105">
<p>
</a>
<A NAME="351106><I>C Binding: </I>void </a>PG_draw_interface_objects(PG_device *dev)
<BR><A NAME="351107"><I>F77 Binding: </I>integer </a>pgdrif(integer devid)
<BR><A NAME="351108"><I>SX Binding: </I>
<P><a name="351109">
This routine draws the entire </a>graphical interface of the specified device.<p>
</a>
<a name="351110">
<p>
</a>
<A NAME="351111><I>C Binding: </I>void </a>PG_query_pointer(PG_device *dev, int *px, int *py, int *pbtn, int
*mod)
<BR><A NAME="351112"><I>F77 Binding: </I>integer </a>pgqptr(integer devid, integer x, integer y, integer btn, integer
mod)
<BR><A NAME="351113"><I>SX Binding: </I>
<P><a name="351114">
This routine allows the application to query the state of the locator or mouse. The mouse state is: the (x, y) position on the screen in pixel coordinates; btn, the indicator of mouse buttons which are pressed (</a>MOUSE_LEFT, </a>MOUSE_CENTER, </a>MOUSE_RIGHT); and mod the indicator of which keyboard modifiers are pressed (</a>KEY_SHIFT, </a>KEY_CNTL, </a>KEY_ALT). These flags can be and’d to ascertain which combinations are pressed.<p>
</a>
<a name="351115">
<p>
</a>
<A NAME="351116><I>C Binding: </I>int </a>PG_read_interface(PG_device *dev, char *fname)
<BR><A NAME="351117"><I>F77 Binding: </I>integer </a>pgrdif(integer devid, integer n, char *fname)
<BR><A NAME="351118"><I>SX Binding: </I>
<P><a name="351119">
This routine reads the entire </a>graphical interface from the named file into the specified device.<p>
</a>
<a name="351120">
<p>
</a>
<A NAME="351121><I>C Binding: </I>void </a>PG_register_callback(char *name, PFVoid fnc)
<BR><A NAME="351122"><I>F77 Binding: </I>integer </a>pgrgfn(integer nc, char *name, function fnc)
<BR><A NAME="351123"><I>SX Binding: </I>
<P><a name="351124">
This routine </a>registers a function with PGS so that it may be called by an </a>interface event such as the click of a button or selection of some item of an interface. The name is used to refer to the function (via a lookup) in such applications<p>
</a>
<A NAME="351125><I>C Binding: </I>void </a>PG_register_variable(char *name, char *type, void *var, void
*vmin, void *vmax)
<BR><A NAME="351126"><I>F77 Binding: </I>integer </a>pgrgvr(integer nc, char *name, integer nt, char *type, var,
vmin, vmax)
<BR><A NAME="351127"><I>SX Binding: </I>
<P><a name="351128">
This routine </a>registers a variable with PGS so that its value may be changed by an </a>interface event such as the selection of some item of from a menu. The required information is the variables name, type, and address (var). Optionally pointers to the minimum and maximum values, vmin and vmax, may be supplied (NULL if not wanted).<p>
</a>
<a name="351129">
<p>
</a>
<A NAME="351130><I>C Binding: </I>int </a>PG_write_interface(PG_device *dev, char *fname)
<BR><A NAME="351131"><I>F77 Binding: </I>integer </a>pgwrif(integer devid, integer n, char *fname)
<BR><A NAME="351132"><I>SX Binding: </I>
<P><a name="351133">
This routine writes the entire </a>graphical interface of the specified device to the named file.<p>
</a>
<a name="351134">
<p>
</a>
<a name="351135">
<h2>5.3 </a>Structures</h2>
</a>
<a name="351136">
</a>PGS employs several structures to </a>encapsulate information pertaining to specific groups of functionality. C based applications can have access to these structures (not a good idea in general because the structures may change) and some readers may find the structures revealing of details in the design and implementation of PGS. Some of these are also discussed in the context of rendering. See those sections for additional details.<p>
</a>
<a name="351137">
<p>
</a>
<A NAME="351138"><BR><B></a>PG_graph
</B><BR><a name="351139">
The </a>PG_graph structure contains information specifying how data is to be rendered. That includes specification of the </a>rendering technique, </a>line attributes, and other information. A PG_graph always contains a </a>PM_mapping (a structure defined by the PACT library </a>PML) pointer for the </a>data set to be rendered.<p>
</a>
<a name="351140">
PG_graph’s can be linked together in a list and the PGS rendering functions will render all graphs in the list.<p>
</a>
<a name="351141">
An associated type of the PG_graph is:<p>
</a>
<A NAME="351142"><PRE> typedef PG_graph *(*</a>PFPPG_graph)();
</PRE><a name="351143">
The last type is a Pointer to a Function returning a Pointer to a PG_GRAPH. This convention is used throughout PACT. See the related documentation for further information.<p>
</a>
<A NAME="351144"><BR><B></a>PG_palette
</B><BR><a name="351145">
The </a>PG_palette structure contains the specification of a </a>palette of </a>RGB colors. The number of </a>colors in the palette is determined by the application. If the number of colors specified exceeds the number of colors which the host platform can display, PGS attempts to simulate the colors with </a>dithering of colors which the host graphics system can display.<p>
</a>
<A NAME="351146"><BR><B></a>PG_device
</B><BR><a name="351147">
The </a>PG_device structure contains the information which the host graphics system requires applications to provide and maintain and it keeps a set of </a>state variables describing such quantities as </a>coordinate systems, </a>palettes, and </a>drawing attributes.<p>
</a>
<a name="351148">
<p>
</a>
<A NAME="351149"><BR><B></a>PG_image
</B><BR><a name="351150">
The </a>PG_image structure contains the specification for </a>cell array or </a>image plots. It contains </a>data, the </a>data type, the </a>array dimensions, </a>bounding values for use in defining </a>scales, </a>palette information, and other appropriate data.<p>
</a>
<a name="351151">
<p>
</a>
<A NAME="351152"><BR><B></a>PG_dev_attributes
</B><BR><a name="351153">
The </a>PG_dev_attributes structure contains a large number of the commonly queried and set </a>attributes found in the </a>PG_device. The intent of this structure is to allow applications to access and change many </a>device attributes quickly and efficiently. The attributes include line, text, and fill colors, line style and width, palette, and clipping state. It is convenient to save these all at once in a PG_dev_attributes, change the device state, perform drawing operation, and restore the original device state from the PG_dev_attributes.<p>
</a>
<a name="351154">
<h2>5.4 </a>PGS </a>Constants</h2>
</a>
<a name="351155">
PGS defines and uses several </a>#</a>define’d constants. These can be used by applications and are listed here by category.<p>
</a>
<a name="351156">
<p>
</a>
<A NAME="351157"><BR><B></a>General Purpose Constants
</B><BR><A NAME="351158"></a>PG_IMAGE_VERSION 0
<P><A NAME="351159"></a>N_COLORS 16
<P><A NAME="351160"></a>QUAD_ONE 1
<P><A NAME="351161"></a>QUAD_FOUR 4
<P><A NAME="351162"></a>N_ANGLES 180
<P><A NAME="351163"></a>DEGREE 1
<P><A NAME="351164"></a>RADIAN 2
<P><a name="351165">
<p>
</a>
<A NAME="351166"><BR><B></a>Device Characterization Constants
</B><BR><A NAME="351167"></a>TEXT_WINDOW_DEVICE 128
<P><A NAME="351168"></a>GRAPHIC_WINDOW_DEVICE 129
<P><A NAME="351169"></a>PS_DEVICE 130
<P><A NAME="351170"></a>CGMF_DEVICE 131
<P><A NAME="351172"></a>HARD_COPY_DEVICE 133
<P><A NAME="351173"></a>SCREEN_DEVICE 134
<P><a name="351174">
<p>
</a>
<A NAME="352491"><BR><B></a>Rendering Clear Mode Constants
</B><BR><A NAME="352492"></a>CLEAR_SCREEN -5
<P><A NAME="352493"></a>CLEAR_VIEWPORT -6
<P><A NAME="352494"></a>CLEAR_FRAME -7
<P><a name="352495">
<p>
</a>
<A NAME="351175"><BR><B></a>Axis Description Constants
</B><BR><A NAME="351176"></a>AXIS_LINESTYLE 1
<P><A NAME="351177"></a>AXIS_LINETHICK 2
<P><A NAME="351178"></a>AXIS_LINECOLOR 3
<P><A NAME="351179"></a>AXIS_LABELCOLOR 4
<P><A NAME="351180"></a>AXIS_LABELSIZE 5
<P><A NAME="351181"></a>AXIS_LABELFONT 6
<P><A NAME="351182"></a>AXIS_LABELPREC 7
<P><A NAME="351183"></a>AXIS_X_FORMAT 8
<P><A NAME="351184"></a>AXIS_Y_FORMAT 9
<P><A NAME="351185"></a>AXIS_TICKSIZE 10
<P><A NAME="351186"></a>AXIS_GRID_ON 11
<P><A NAME="351187"></a>AXIS_SIGNIF_DIGIT 12
<P><A NAME="351188"></a>AXIS_CHAR_ANGLE 13
<P><A NAME="351189"></a>MAJOR 1
<P><A NAME="351190"></a>MINOR 2
<P><A NAME="351191"></a>LABEL 3
<P><A NAME="351192"></a>MAJOR_MINOR 4
<P><A NAME="351193"></a>MAJOR_LABEL 5
<P><A NAME="351194"></a>MINOR_LABEL 6
<P><A NAME="351195"></a>MAJOR_MINOR_LABEL 7
<P><A NAME="351196"></a>NO_TICKS 8
<P><A NAME="351197"></a>RIGHT_OF_AXIS 9
<P><A NAME="351198"></a>LEFT_OF_AXIS 10
<P><A NAME="351199"></a>STRADDLE_AXIS 11
<P><A NAME="351200"></a>ENDS 12
<P><A NAME="351201"></a>NOTHING_ON_AXIS 13
<P><A NAME="351202"></a>NOTICKS 0
<P><A NAME="351203"></a>INSIDE 1
<P><A NAME="351204"></a>OUTSIDE 2
<P><A NAME="351205"></a>INOUT 3
<P><A NAME="351206"></a>TICKTICK 1
<P><A NAME="351207"></a>LINELINE 2
<P><A NAME="351208"></a>TICKLINE 3
<P><A NAME="351209"></a>LINETICK 4
<P><a name="351210">
<p>
</a>
<A NAME="351211"><BR><B></a>Grid Description </a>Constants
</B><BR><A NAME="351212"></a>GRID_LINESTYLE 1
<P><A NAME="351213"></a>GRID_LINETHICK 2
<P><A NAME="351214"></a>GRID_LINECOLOR 3
<P><A NAME="351215"></a>GRID_LABELCOLOR 4
<P><A NAME="351216"></a>GRID_LABELSIZE 5
<P><A NAME="351217"></a>GRID_LABELFONT 6
<P><A NAME="351218"></a>GRID_LABELPREC 7
<P><A NAME="351219"></a>GRID_XFORMAT 8
<P><A NAME="351220"></a>GRID_YFORMAT 9
<P><A NAME="351221"></a>GRID_TICKPOSITION 10
<P><A NAME="351222"></a>GRID_TICKSIZE 11
<P><A NAME="351223"></a>GRID_TICKTYPE 12
<P><A NAME="351224"></a>GRID_SIGNIF_DIGIT 13
<P><a name="351225">
<p>
</a>
<A NAME="351226"><BR><B></a>Vector Description </a>Constants
</B><BR><A NAME="351227"></a>VEC_SCALE 1
<P><A NAME="351228"></a>VEC_ANGLE 2
<P><A NAME="351229"></a>VEC_HEADSIZE 3
<P><A NAME="351230"></a>VEC_FIXSIZE 4
<P><A NAME="351231"></a>VEC_MAXSIZE 5
<P><A NAME="351232"></a>VEC_LINESTYLE 6
<P><A NAME="351233"></a>VEC_LINETHICK 7
<P><A NAME="351234"></a>VEC_COLOR 8
<P><A NAME="351235"></a>VEC_FIXHEAD 9
<P><a name="351236">
<p>
</a>
<A NAME="351237"><BR><B></a>Line </a>Plot Types
</B><BR><A NAME="351238"></a>CARTESIAN -1
<P><A NAME="351239"></a>POLAR -2
<P><A NAME="351240"></a>INSEL -3
<P><A NAME="351241"></a>HISTOGRAM -4
<P><A NAME="351242"></a>SCATTER -5
<P><A NAME="351243"></a>LOGICAL -6
<P><A NAME="351244"></a>ERROR_BAR -7
<P><a name="351245">
<p>
</a>
<A NAME="351246"><BR><B></a>Rendering Mode </a>Constants
</B><BR><A NAME="351247"></a>PLOT_CURVE 10
<P><A NAME="351248"></a>PLOT_CONTOUR 11
<P><A NAME="351249"></a>PLOT_IMAGE 12
<P><A NAME="351250"></a>PLOT_WIRE_MESH 13
<P><A NAME="351251"></a>PLOT_SURFACE 14
<P><A NAME="351252"></a>PLOT_VECTOR 15
<P><A NAME="351253"></a>PLOT_FILL_POLY 16
<P><A NAME="351254"></a>PLOT_MESH 17
<P><A NAME="351255"></a>PLOT_ERROR_BAR 18
<P><A NAME="351256"></a>PLOT_DEFAULT 19
<P><a name="351257">
<h1>6.0 </a>Glossary</h1>
</a>
<a name="352318">
Here is a list of terms which are used in this manual.<p>
</a>
<A NAME="352319"></a>device A generic name for a graphical output device such as a display window,
a PostScript file. PGS supports WINDOW (display screen), PS (PostScript),
and CGM devices.
<P><A NAME="352320"></a>console A special device which mimics a UNIX shell window on platforms
which lack that functionality (e.g. Macintosh)
<P><A NAME="352321"></a>NDC Normalized device coordinates or screen coordinates. Values range
between 0.0 and 1.0.
<P><A NAME="352322"></a>image An array of pixel values also called a raster image or cell array
<P><A NAME="352323"></a>graph Generically the collection of information needed to visualize a collection of data. More specifically a </a>PG_graph structure.
<P><A NAME="352324"></a>set Generically a collection of related data. More specifically a </a>PM_set
structure.
<P><A NAME="352332"></a>mapping Generically a rule of association between elements of two sets. More
specifically a </a>PM_mapping structure.
<P><A NAME="352326"></a>palette An application oriented representation of a color scheme to be associated with data in a plot.
<P><A NAME="352328"></a>colormap A host oriented representation of a color scheme to be associated with
colors in hardware.
<P><A NAME="352329"></a>marker A user definable “character”. A collection of line segments which can
be rotated and scaled collectively.
<P><A NAME="352330"></a>connectivity The collection of neighbor relationships between points of a computational mesh.
<P><a name="352331">
<p>
</a>
<a name="352317">
<h1>7.0 </a>PGS By Example</h1>
</a>
<a name="351258">
Perhaps the best way to learn to use PGS is by example. Certainly it is the easiest way to explain certain aspects of it. In this section there are examples of some of the </a>low level </a>graphics primitives and the </a>high level </a>rendering functions. The actual tests are:<p>
</a>
<a name="351259">
<p>
</a>
<A NAME="351260"><PRE> </PRE>Text Placement and Drawing
<BR><A NAME="351261"><PRE> </PRE>Line Drawing
<BR><A NAME="351262"><PRE> </PRE>Making Line Plots
<BR><A NAME="351263"><PRE> </PRE>Making Contour Plots
<BR><A NAME="351264"><PRE> </PRE>Making Image Plots
<BR><A NAME="351265"><PRE> </PRE>Making Wire Frame Mesh Plots
<BR><A NAME="351266"><PRE> </PRE>Making Vector Plots
<BR><a name="352351">
Before showing the examples we discuss some sequences of PGS calls that are common to most PGS applications. The hope is that this will make clear why some of PGS functions exist and how they relate to one another.<p>
</a>
<a name="351267">
<h2>7.1 </a>Common Call Sequences</h2>
</a>
<a name="352346">
The PGS functions are generally not very meaningful taken one at a time. What is important is the way they are used together to accomplish various graphical objectives. We are not focusing on the details of the calls here so many details are omitted. Concentrate on which calls are being made and when they are performed.<p>
</a>
<a name="352354">
<h3>7.1.1 </a>Initializing a Device</h3>
</a>
<a name="352355">
The first basic job in a graphics application is to setup the devices to be used. Most common is setting up screen windows. Also important is initializing hardcopy devices such as a PostScript device. The sequence is all the same, some of the parameters differ. <p>
</a>
<A NAME="352356"><PRE> dev = </a>PG_make_device(...);
</PRE><A NAME="351448"><PRE>
</PRE><A NAME="351446"><PRE> </a>PG_set_viewport_pos(dev, ...);
</PRE><A NAME="351447"><PRE> </a>PG_set_viewport_shape(dev, ...);
</PRE><A NAME="351449"><PRE> </a>PG_white_background(dev, ...);
</PRE><A NAME="352357"><PRE>
</PRE><A NAME="352359"><PRE> </a>PG_open_device(dev, ...)
</PRE><a name="351450">
The </a>PG_make_device call only allocates a PG_device structure and sets default values for the state it contains. The </a>PG_open_device call actually consults the state of the PG_device and opens the device. The calls in between change the state of the PG_device from the defaults. <p>
</a>
<a name="352358">
<h3>7.1.2 </a>Making a Picture</h3>
</a>
<a name="352360">
The next basic idea is to put together a picture. This may be done with low level drawing operations or high level rendering calls or both. What is common to all is that the picture must be set up, drawn, and finished.<p>
</a>
<A NAME="352362"><PRE> </a>PG_clear_window(dev);
</PRE><A NAME="352363"><PRE> ...
</PRE><A NAME="352367"><PRE> draw
</PRE><A NAME="352368"><PRE> ...
</PRE><A NAME="352364"><PRE> </a>PG_update_vs(dev);
</PRE><A NAME="352365"><PRE> ...
</PRE><A NAME="352369"><PRE> </a>PG_finish_plot(dev);
</PRE><a name="352366">
The call to </a>PG_clear_window must be done for hardcopy devices! It is a pretty good idea for screen window devices too. Sometimes in the process of drawing a picture you want to see the results so far with the idea that more will be drawn later. </a>PG_update_vs makes sure that everything the has been requested is visible. When the picture is complete and there is nothing more to be drawn to it, </a>PG_finish_plot is called. This is crucial for hardcopy devices! It is also crucial that </a>PG_clear_window and </a>PG_finish_plot be called once per picture.<p>
</a>
<a name="352434">
<h3>7.1.3 </a>Setting Attributes</h3>
</a>
<a name="352435">
To gain control of the appearance of high level plots, applications must set rendering attributes. See the discussion of rendering attributes before going any further here. The sequence is to use </a>PG_get_render_info to obtain the attribute list from the graph, use </a>SC_change_alist to change or add values to the list, and use </a>PG_set_render_info to update the graph’s attribute list.<p>
</a>
<a name="352447">
Here are C and FORTRAN examples of setting some attributes in a graph. In this example some attributes are set for contour plotting.<p>
</a>
<A NAME="352436"><CENTER><B></B></CENTER><A NAME="352448"><PRE> PG_graph *g;
</PRE><A NAME="352446"><PRE> pcons *alst;
</PRE><A NAME="352449"><PRE> double *clev;
</PRE><A NAME="352441"><PRE> int *nlev;
</PRE><A NAME="352453"><PRE>
</PRE><A NAME="352450"><PRE> nlev = MAKE(int);
</PRE><A NAME="352457"><PRE> *nlev = 6;
</PRE><A NAME="352458"><PRE> clev = MAKE_N(double, *nlev);
</PRE><A NAME="352456"><PRE>
</PRE><A NAME="352455"><PRE> </a>PG_get_render_info(g, alst);
</PRE><A NAME="352437"><PRE> alst = SC_change_alist(alst, “LEVELS”, “double *”, clev);
</PRE><A NAME="352454"><PRE> alst = SC_change_alist(alst, “N-LEVELS”, “int *”, nlev);
</PRE><A NAME="352451"><PRE> </a>PG_set_render_info(g, alst);
</PRE><A NAME="352459"><PRE>
</PRE><A NAME="352452"><CENTER><B></B></CENTER><A NAME="352438"><PRE> integer gid, ial, nlev
</PRE><A NAME="352444"><PRE> real clev(10)
</PRE><A NAME="352445"><PRE>
</PRE><A NAME="352443"><PRE> call </a>pgginf (gid, ial)
</PRE><A NAME="352439"><PRE> call scchal (ial, 6, ’LEVELS’, 6, ’double’, nlev, clev)
</PRE><A NAME="352440"><PRE> call scchal (ial, 8, ’N-LEVELS’, 7, ’integer’, 1, nlev)
</PRE><A NAME="352442"><PRE> call </a>pgsinf (gid, ial)
</PRE><a name="351268">
<h2>7.2 </a>Text Placement and </a>Drawing</h2>
</a>
<a name="351269">
The following program demonstrates some of the PGS functionality for placement and drawing of text.<p>
</a>
<A NAME="351270"><PRE>
</PRE><A NAME="351271"><PRE> #include “</a>pgs.h”
</PRE><A NAME="351272"><PRE>
</PRE><A NAME="351273"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351274"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351275"><PRE>
</PRE><A NAME="351276"><PRE> void main(argc, argv)
</PRE><A NAME="351277"><PRE> int argc;
</PRE><A NAME="351278"><PRE> char *argv[];
</PRE><A NAME="351279"><PRE> {char s[MAXLINE], *token;
</PRE><A NAME="351280"><PRE> PG_device *SCR_dev, *PS_dev, *CGM_dev;
</PRE><A NAME="351281"><PRE> REAL x1, y1, x2, y2, dx, dy;
</PRE><A NAME="351282"><PRE> char *face, *style;
</PRE><A NAME="351283"><PRE> int size;
</PRE><A NAME="351284"><PRE>
</PRE><A NAME="351285"><PRE> /* connect the I/O functions */
</PRE><A NAME="351286"><PRE> PG_open_console(“PGS Test”, “COLOR”, TRUE, 0.1, 0.7, 0.5, 0.3);
</PRE><A NAME="351287"><PRE>
</PRE><A NAME="351288"><PRE> SCR_dev = PG_make_device(“WINDOW”, “COLOR”, “PGS Test”);
</PRE><A NAME="351289"><PRE> PG_open_device(SCR_dev, 0.1, 0.1, 0.5, 0.6);
</PRE><A NAME="351290"><PRE> PG_set_viewport(SCR_dev, 0.1, 0.9, 0.2, 0.8);
</PRE><A NAME="351291"><PRE> PG_set_window(SCR_dev, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351292"><PRE> PG_draw_box(SCR_dev, -0.02, 1.02, -0.02, 1.02);
</PRE><A NAME="351293"><PRE>
</PRE><A NAME="351294"><PRE> CGM_dev = PG_make_device(“CGM”, “MONOCHROME”, “gstxts”);
</PRE><A NAME="351295"><PRE> PG_open_device(CGM_dev, 0.1, 0.1, 0.8, 0.8);
</PRE><A NAME="351296"><PRE>
</PRE><A NAME="351297"><PRE> PS_dev = PG_make_device(“PS”, “MONOCHROME”, “gstxts”);
</PRE><A NAME="351298"><PRE> PG_open_device(PS_dev, 0.1, 0.1, 0.8, 1.1);
</PRE><A NAME="351299"><PRE>
</PRE><A NAME="351300"><PRE> PG_expose_device(PG_console_device);
</PRE><A NAME="351301"><PRE>
</PRE><A NAME="351302"><PRE> PG_clear_window(SCR_dev);
</PRE><A NAME="351303"><PRE> PG_clear_window(CGM_dev);
</PRE><A NAME="351304"><PRE> PG_clear_window(PS_dev);
</PRE><A NAME="351305"><PRE>
</PRE><A NAME="351306"><PRE> test_dev(SCR_dev);
</PRE><A NAME="351307"><PRE> test_dev(CGM_dev);
</PRE><A NAME="351308"><PRE> test_dev(PS_dev);
</PRE><A NAME="351309"><PRE>
</PRE><A NAME="351310"><PRE> PG_finish_plot(SCR_dev);
</PRE><A NAME="351311"><PRE> PG_finish_plot(CGM_dev);
</PRE><A NAME="351312"><PRE> PG_finish_plot(PS_dev);
</PRE><A NAME="351313"><PRE>
</PRE><A NAME="351314"><PRE> SC_pause();
</PRE><A NAME="351315"><PRE>
</PRE><A NAME="351316"><PRE> PG_close_device(SCR_dev);
</PRE><A NAME="351317"><PRE> PG_close_device(CGM_dev);
</PRE><A NAME="351318"><PRE> PG_close_device(PS_dev);
</PRE><A NAME="351319"><PRE>
</PRE><A NAME="351320"><PRE> exit(0);}
</PRE><A NAME="351321"><PRE>
</PRE><A NAME="351322"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351323"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351324"><PRE>
</PRE><A NAME="351325"><PRE> /* SF_DT - set the font and draw the text */
</PRE><A NAME="351326"><PRE>
</PRE><A NAME="351327"><PRE> static void sf_dt(dev, x1, y1, face, style, size)
</PRE><A NAME="351328"><PRE> PG_device *dev;
</PRE><A NAME="351329"><PRE> double x1, y1;
</PRE><A NAME="351330"><PRE> char *face, *style;
</PRE><A NAME="351331"><PRE> int size;
</PRE><A NAME="351332"><PRE> {double x2, y2, dx, dy;
</PRE><A NAME="351333"><PRE>
</PRE><A NAME="351334"><PRE> PG_set_font(dev, face, style, size);
</PRE><A NAME="351335"><PRE>
</PRE><A NAME="351336"><PRE> PG_get_text_ext(dev, “foo”, &dx, &dy);
</PRE><A NAME="351337"><PRE>
</PRE><A NAME="351338"><PRE> /* write some text and draw a box around it */
</PRE><A NAME="351339"><PRE> PG_write_abs(dev, x1, y1, “%s”, “foo”);
</PRE><A NAME="351340"><PRE>
</PRE><A NAME="351341"><PRE> x2 = x1 + dx;
</PRE><A NAME="351342"><PRE> y2 = y1 + dy;
</PRE><A NAME="351343"><PRE> PG_draw_box(dev, x1, x2, y1, y2);
</PRE><A NAME="351344"><PRE>
</PRE><A NAME="351345"><PRE> return;}
</PRE><A NAME="351346"><PRE>
</PRE><A NAME="351347"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351348"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351349"><PRE>
</PRE><A NAME="351350"><PRE> /* TEST_DEV - test the entire device */
</PRE><A NAME="351351"><PRE>
</PRE><A NAME="351352"><PRE> static void test_dev(dev)
</PRE><A NAME="351353"><PRE> PG_device *dev;
</PRE><A NAME="351354"><PRE> {PG_set_line_color(dev, dev->BLACK);
</PRE><A NAME="351355"><PRE> PG_set_text_color(dev, dev->BLACK);
</PRE><A NAME="351356"><PRE>
</PRE><A NAME="351357"><PRE> sf_dt(dev, .1, .9, “helvetica”, “medium”, 12);
</PRE><A NAME="351358"><PRE> sf_dt(dev, .1, .8, “helvetica”, “italic”, 12);
</PRE><A NAME="351359"><PRE> sf_dt(dev, .1, .7, “helvetica”, “bold”, 12);
</PRE><A NAME="351360"><PRE> sf_dt(dev, .1, .6, “helvetica”, “bold-italic”, 12);
</PRE><A NAME="351361"><PRE>
</PRE><A NAME="351362"><PRE> sf_dt(dev, .1, .50, “helvetica”, “medium”, 10);
</PRE><A NAME="351363"><PRE> sf_dt(dev, .1, .45, “helvetica”, “italic”, 10);
</PRE><A NAME="351364"><PRE> sf_dt(dev, .1, .40, “helvetica”, “bold”, 10);
</PRE><A NAME="351365"><PRE> sf_dt(dev, .1, .35, “helvetica”, “bold-italic”, 10);
</PRE><A NAME="351366"><PRE>
</PRE><A NAME="351367"><PRE> sf_dt(dev, .1, .30, “helvetica”, “medium”, 8);
</PRE><A NAME="351368"><PRE> sf_dt(dev, .1, .25, “helvetica”, “italic”, 8);
</PRE><A NAME="351369"><PRE> sf_dt(dev, .1, .20, “helvetica”, “bold”, 8);
</PRE><A NAME="351370"><PRE> sf_dt(dev, .1, .15, “helvetica”, “bold-italic”, 8);
</PRE><A NAME="351371"><PRE>
</PRE><A NAME="351372"><PRE> sf_dt(dev, .3, .9, “times”, “medium”, 12);
</PRE><A NAME="351373"><PRE> sf_dt(dev, .3, .8, “times”, “italic”, 12);
</PRE><A NAME="351374"><PRE> sf_dt(dev, .3, .7, “times”, “bold”, 12);
</PRE><A NAME="351375"><PRE> sf_dt(dev, .3, .6, “times”, “bold-italic”, 12);
</PRE><A NAME="351376"><PRE>
</PRE><A NAME="351377"><PRE> sf_dt(dev, .3, .50, “times”, “medium”, 10);
</PRE><A NAME="351378"><PRE> sf_dt(dev, .3, .45, “times”, “italic”, 10);
</PRE><A NAME="351379"><PRE> sf_dt(dev, .3, .40, “times”, “bold”, 10);
</PRE><A NAME="351380"><PRE> sf_dt(dev, .3, .35, “times”, “bold-italic”, 10);
</PRE><A NAME="351381"><PRE>
</PRE><A NAME="351382"><PRE> sf_dt(dev, .3, .30, “times”, “medium”, 8);
</PRE><A NAME="351383"><PRE> sf_dt(dev, .3, .25, “times”, “italic”, 8);
</PRE><A NAME="351384"><PRE> sf_dt(dev, .3, .20, “times”, “bold”, 8);
</PRE><A NAME="351385"><PRE> sf_dt(dev, .3, .15, “times”, “bold-italic”, 8);
</PRE><A NAME="351386"><PRE>
</PRE><A NAME="351387"><PRE> sf_dt(dev, .5, .9, “courier”, “medium”, 12);
</PRE><A NAME="351388"><PRE> sf_dt(dev, .5, .8, “courier”, “italic”, 12);
</PRE><A NAME="351389"><PRE> sf_dt(dev, .5, .7, “courier”, “bold”, 12);
</PRE><A NAME="351390"><PRE> sf_dt(dev, .5, .6, “courier”, “bold-italic”, 12);
</PRE><A NAME="351391"><PRE>
</PRE><A NAME="351392"><PRE> sf_dt(dev, .5, .50, “courier”, “medium”, 10);
</PRE><A NAME="351393"><PRE> sf_dt(dev, .5, .45, “courier”, “italic”, 10);
</PRE><A NAME="351394"><PRE> sf_dt(dev, .5, .40, “courier”, “bold”, 10);
</PRE><A NAME="351395"><PRE> sf_dt(dev, .5, .35, “courier”, “bold-italic”, 10);
</PRE><A NAME="351396"><PRE>
</PRE><A NAME="351397"><PRE> sf_dt(dev, .5, .30, “courier”, “medium”, 8);
</PRE><A NAME="351398"><PRE> sf_dt(dev, .5, .25, “courier”, “italic”, 8);
</PRE><A NAME="351399"><PRE> sf_dt(dev, .5, .20, “courier”, “bold”, 8);
</PRE><A NAME="351400"><PRE> sf_dt(dev, .5, .15, “courier”, “bold-italic”, 8);
</PRE><A NAME="351401"><PRE>
</PRE><A NAME="351402"><PRE> PG_update_vs(dev);
</PRE><A NAME="351403"><PRE>
</PRE><A NAME="351404"><PRE> return;}
</PRE><A NAME="351405"><PRE>
</PRE><A NAME="351406"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351407"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351408"><PRE>
</PRE><a name="351409">
<h2>7.3 </a>Line </a>Drawing</h2>
</a>
<a name="351410">
This program illustrates some of the PGS calls for handling drawing attributes and for drawing lines.<p>
</a>
<A NAME="351411"><PRE>
</PRE><A NAME="351412"><PRE> #include “</a>pgs.h”
</PRE><A NAME="351413"><PRE>
</PRE><A NAME="351414"><PRE> char
</PRE><A NAME="351415"><PRE> *color[] = {“BLACK”,
</PRE><A NAME="351416"><PRE> “WHITE”,
</PRE><A NAME="351417"><PRE> “LGHT_WHITE”
</PRE><A NAME="351418"><PRE> “GRAY”,
</PRE><A NAME="351419"><PRE> “BLUE”,
</PRE><A NAME="351420"><PRE> “GREEN”,
</PRE><A NAME="351421"><PRE> “CYAN”,
</PRE><A NAME="351422"><PRE> “RED”,
</PRE><A NAME="351423"><PRE> “MAGENTA”,
</PRE><A NAME="351424"><PRE> “BROWN”,
</PRE><A NAME="351425"><PRE> “LGHT_BLUE”,
</PRE><A NAME="351426"><PRE> “LGHT_GREEN”,
</PRE><A NAME="351427"><PRE> “LGHT_CYAN”,
</PRE><A NAME="351428"><PRE> “LGHT_RED”,
</PRE><A NAME="351429"><PRE> “YELLOW”,
</PRE><A NAME="351430"><PRE> “LGHT_MAGENTA”};
</PRE><A NAME="351431"><PRE>
</PRE><A NAME="351432"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351433"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351434"><PRE>
</PRE><A NAME="351435"><PRE> main(argc, argv)
</PRE><A NAME="351436"><PRE> int argc;
</PRE><A NAME="351437"><PRE> char *argv[];
</PRE><A NAME="351438"><PRE> {</a>PG_device *SCR_dev;
</PRE><A NAME="351439"><PRE> PG_device *SCR_dew;
</PRE><A NAME="351440"><PRE> REAL y, dy;
</PRE><A NAME="351441"><PRE> int i, n;
</PRE><A NAME="351442"><PRE>
</PRE><A NAME="351443"><PRE> SCR_dev = </a>PG_make_device(“WINDOW”, “COLOR”, “PGS Test A”);
</PRE><A NAME="351444"><PRE> SCR_dew = </a>PG_make_device(“WINDOW”, “COLOR”, “PGS Test B”);
</PRE><A NAME="351445"><PRE>
</PRE><A NAME="351451"><PRE> </a>PG_set_viewport_pos(SCR_dev, 0.0001, 0.0001);
</PRE><A NAME="351453"><PRE> </a>PG_set_viewport_shape(SCR_dev, 0.9999, 0.0, 1.0);
</PRE><A NAME="351454"><PRE>
</PRE><A NAME="351452"><PRE> </a>PG_set_viewport_pos(SCR_dew, 0.0001, 0.0001);
</PRE><A NAME="352361"><PRE> </a>PG_set_viewport_shape(SCR_dew, 0.9999, 0.0, 1.0);
</PRE><A NAME="351455"><PRE>
</PRE><A NAME="351456"><PRE> </a>PG_white_background(SCR_dev, TRUE);
</PRE><A NAME="351457"><PRE> </a>PG_white_background(SCR_dew, FALSE);
</PRE><A NAME="351458"><PRE>
</PRE><A NAME="351459"><PRE> </a>PG_open_device(SCR_dev, 0.1, 0.1, 0.4, 0.4);
</PRE><A NAME="351460"><PRE> </a>PG_open_device(SCR_dew, 0.5, 0.1, 0.4, 0.4);
</PRE><A NAME="351461"><PRE>
</PRE><A NAME="351462"><PRE> /* connect the I/O functions */
</PRE><A NAME="351463"><PRE> </a>PG_open_console(“PGS Test”, “MONOCHROME”, 0.1, 0.7, 0.5, 0.3);
</PRE><A NAME="351464"><PRE>
</PRE><A NAME="351465"><PRE> </a>PG_set_viewport(SCR_dev, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351466"><PRE> </a>PG_set_window(SCR_dev, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351467"><PRE> </a>PG_set_viewport(SCR_dew, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351468"><PRE> </a>PG_set_window(SCR_dew, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351469"><PRE>
</PRE><A NAME="351470"><PRE> n = 16;
</PRE><A NAME="351471"><PRE> dy = 1.0/(n + 1.0);
</PRE><A NAME="351472"><PRE> y = 0.5*dy;
</PRE><A NAME="351473"><PRE> for (i = 0; i < n; i++)
</PRE><A NAME="351474"><PRE> {</a>PG_set_line_color(SCR_dev, i);
</PRE><A NAME="351475"><PRE> </a>PG_draw_line(SCR_dev, 0.0, y, 0.5, y);
</PRE><A NAME="351476"><PRE> </a>PG_set_text_color(SCR_dev, i);
</PRE><A NAME="351477"><PRE> </a>PG_write_abs(SCR_dev, 0.6, y, “%d %s”, i, color[i]);
</PRE><A NAME="351478"><PRE>
</PRE><A NAME="351479"><PRE> </a>PG_set_line_color(SCR_dew, i);
</PRE><A NAME="351480"><PRE> </a>PG_draw_line(SCR_dew, 0.0, y, 0.5, y);
</PRE><A NAME="351481"><PRE> </a>PG_set_text_color(SCR_dew, i);
</PRE><A NAME="351482"><PRE> </a>PG_write_abs(SCR_dew, 0.6, y, “%d %s”, i, color[i]);
</PRE><A NAME="351483"><PRE>
</PRE><A NAME="351484"><PRE> y += dy;};
</PRE><A NAME="351485"><PRE>
</PRE><A NAME="351486"><PRE> </a>PG_update_vs(SCR_dew);
</PRE><A NAME="351487"><PRE> </a>PG_update_vs(SCR_dev);
</PRE><A NAME="351488"><PRE>
</PRE><A NAME="351489"><PRE> SC_pause();
</PRE><A NAME="351490"><PRE>
</PRE><A NAME="351491"><PRE> </a>PG_close_device(SCR_dew);
</PRE><A NAME="351492"><PRE> </a>PG_close_device(SCR_dev);
</PRE><A NAME="351493"><PRE>
</PRE><A NAME="351494"><PRE> exit(0);}
</PRE><A NAME="351495"><PRE>
</PRE><A NAME="351496"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351497"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351498"><PRE>
</PRE><a name="351499">
<h2>7.4 </a>Line </a>Plots</h2>
</a>
<a name="351500">
This program demonstrates some of the line plot capabilities of PGS.<p>
</a>
<A NAME="351501"><PRE>
</PRE><A NAME="351502"><PRE> #include “</a>pgs.h”
</PRE><A NAME="351503"><PRE>
</PRE><A NAME="351504"><PRE> #define N 50
</PRE><A NAME="351505"><PRE>
</PRE><A NAME="351506"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351507"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351508"><PRE>
</PRE><A NAME="351509"><PRE> main(argc, argv)
</PRE><A NAME="351510"><PRE> int argc;
</PRE><A NAME="351511"><PRE> char **argv;
</PRE><A NAME="351512"><PRE> {int i;
</PRE><A NAME="351513"><PRE> REAL *x, *y;
</PRE><A NAME="351514"><PRE> char *s;
</PRE><A NAME="351515"><PRE> </a>PG_graph *data;
</PRE><A NAME="351516"><PRE> </a>PG_device *SCR_dev, *SCR_dew, *PS_dev;
</PRE><A NAME="351517"><PRE>
</PRE><A NAME="351518"><PRE> s = SC_strsave(“WINDOW”);
</PRE><A NAME="351519"><PRE> for (i = 1; i < argc; i++)
</PRE><A NAME="351520"><PRE> if (argv[i][0] == ‘-’)
</PRE><A NAME="351521"><PRE> {switch (argv[i][1])
</PRE><A NAME="351522"><PRE> {case ‘h’ : i++;
</PRE><A NAME="351523"><PRE> s = argv[i];
</PRE><A NAME="351524"><PRE> break;};};
</PRE><A NAME="351525"><PRE>
</PRE><A NAME="351526"><PRE> x = MAKE_N(REAL, N);
</PRE><A NAME="351527"><PRE> y = MAKE_N(REAL, N);
</PRE><A NAME="351528"><PRE>
</PRE><A NAME="351529"><PRE> for (i = 0; i < N; i++)
</PRE><A NAME="351530"><PRE> {x[i] = -(i+1)/8.0;
</PRE><A NAME="351531"><PRE> y[i] = 6.022e23/x[i];};
</PRE><A NAME="351532"><PRE>
</PRE><A NAME="351533"><PRE> data = </a>PG_make_graph_1d(‘A’, “Test Data #1”, FALSE, N,
</PRE><A NAME="351534"><PRE> x, y, “X Values”, “Y Values”, 1, 0.0, 1);
</PRE><A NAME="351535"><PRE>
</PRE><A NAME="351536"><PRE> </a>PG_open_console(“GSTEST”, “MONOCHROME”, 1,
</PRE><A NAME="351537"><PRE> 0.05, 0.7, 0.9, 0.20);
</PRE><A NAME="351538"><PRE>
</PRE><A NAME="351539"><PRE> /* set up the left window */
</PRE><A NAME="351540"><PRE> SCR_dev = </a>PG_make_device(s, “COLOR”, “PGS Test A”);
</PRE><A NAME="351541"><PRE> </a>PG_white_background(SCR_dev, TRUE);
</PRE><A NAME="351542"><PRE> </a>PG_turn_data_id(SCR_dev, </a>ON);
</PRE><A NAME="351543"><PRE> </a>PG_open_device(SCR_dev, 0.05, 0.2, 0.45, 0.45);
</PRE><A NAME="351544"><PRE>
</PRE><A NAME="351545"><PRE> /* set up the right window */
</PRE><A NAME="351546"><PRE> SCR_dew = </a>PG_make_device(s, “COLOR”, “PGS Test B”);
</PRE><A NAME="351547"><PRE> </a>PG_white_background(SCR_dew, FALSE);
</PRE><A NAME="351548"><PRE> </a>PG_turn_data_id(SCR_dew, </a>ON);
</PRE><A NAME="351549"><PRE> </a>PG_open_device(SCR_dew, 0.5, 0.2, 0.45, 0.45);
</PRE><A NAME="351550"><PRE>
</PRE><A NAME="351551"><PRE> /* set up the hard copy device */
</PRE><A NAME="351552"><PRE> PS_dev = </a>PG_make_device(“PS”, “MONOCHROME”, “PGS Test”);
</PRE><A NAME="351553"><PRE> </a>PG_turn_data_id(PS_dev, </a>ON);
</PRE><A NAME="351554"><PRE> </a>PG_open_device(PS_dev, 0.0, 0.0, 0.0, 0.0);
</PRE><A NAME="351555"><PRE>
</PRE><A NAME="351556"><PRE> </a>PG_set_plot_type(SCR_dev, </a>CARTESIAN);
</PRE><A NAME="351557"><PRE> </a>PG_draw_graph(SCR_dev, data);
</PRE><A NAME="351558"><PRE> </a>PG_set_plot_type(PS_dev, </a>CARTESIAN);
</PRE><A NAME="351559"><PRE> </a>PG_draw_graph(PS_dev, data);
</PRE><A NAME="351560"><PRE> SC_pause();
</PRE><A NAME="351561"><PRE>
</PRE><A NAME="351562"><PRE> </a>PG_set_plot_type(SCR_dew, </a>POLAR);
</PRE><A NAME="351563"><PRE> </a>PG_draw_graph(SCR_dew, data);
</PRE><A NAME="351564"><PRE> </a>PG_set_plot_type(PS_dev, </a>POLAR);
</PRE><A NAME="351565"><PRE> </a>PG_draw_graph(PS_dev, data);
</PRE><A NAME="351566"><PRE> SC_pause();
</PRE><A NAME="351567"><PRE>
</PRE><A NAME="351568"><PRE> </a>PG_set_plot_type(SCR_dev, </a>INSEL);
</PRE><A NAME="351569"><PRE> </a>PG_draw_graph(SCR_dev, data);
</PRE><A NAME="351570"><PRE> </a>PG_set_plot_type(PS_dev, </a>INSEL);
</PRE><A NAME="351571"><PRE> </a>PG_draw_graph(PS_dev, data);
</PRE><A NAME="351572"><PRE> SC_pause();
</PRE><A NAME="351573"><PRE>
</PRE><A NAME="351574"><PRE> for (i = 0; i < N; i++)
</PRE><A NAME="351575"><PRE> {x[i] = i/8.0;
</PRE><A NAME="351576"><PRE> y[i] = cos(x[i]);};
</PRE><A NAME="351577"><PRE>
</PRE><A NAME="351578"><PRE> data = </a>PG_make_graph_1d(‘B’, “Test Data #2”, FALSE, N,
</PRE><A NAME="351579"><PRE> x, y, “X Values”, “Y Values”, 2, 0.0, 1);
</PRE><A NAME="351580"><PRE>
</PRE><A NAME="351581"><PRE> </a>PG_turn_grid(SCR_dev, </a>ON);
</PRE><A NAME="351582"><PRE> </a>PG_turn_grid(SCR_dew, </a>ON);
</PRE><A NAME="351583"><PRE> </a>PG_turn_grid(PS_dev, </a>ON);
</PRE><A NAME="351584"><PRE>
</PRE><A NAME="351585"><PRE> </a>PG_set_plot_type(SCR_dew, </a>POLAR);
</PRE><A NAME="351586"><PRE> </a>PG_draw_graph(SCR_dew, data);
</PRE><A NAME="351587"><PRE> </a>PG_set_plot_type(PS_dev, </a>POLAR);
</PRE><A NAME="351588"><PRE> </a>PG_draw_graph(PS_dev, data);
</PRE><A NAME="351589"><PRE> SC_pause();
</PRE><A NAME="351590"><PRE>
</PRE><A NAME="351591"><PRE> </a>PG_set_plot_type(SCR_dev, </a>INSEL);
</PRE><A NAME="351592"><PRE> </a>PG_draw_graph(SCR_dev, data);
</PRE><A NAME="351593"><PRE> </a>PG_set_plot_type(PS_dev, </a>INSEL);
</PRE><A NAME="351594"><PRE> </a>PG_draw_graph(PS_dev, data);
</PRE><A NAME="351595"><PRE> SC_pause();
</PRE><A NAME="351596"><PRE>
</PRE><A NAME="351597"><PRE> </a>PG_set_plot_type(SCR_dew, </a>CARTESIAN);
</PRE><A NAME="351598"><PRE> </a>PG_draw_graph(SCR_dew, data);
</PRE><A NAME="351599"><PRE> </a>PG_set_plot_type(PS_dev, </a>CARTESIAN);
</PRE><A NAME="351600"><PRE> </a>PG_draw_graph(PS_dev, data);
</PRE><A NAME="351601"><PRE> SC_pause();
</PRE><A NAME="351602"><PRE>
</PRE><A NAME="351603"><PRE> </a>PG_close_device(SCR_dev);
</PRE><A NAME="351604"><PRE> </a>PG_close_device(SCR_dew);
</PRE><A NAME="351605"><PRE> </a>PG_close_device(PS_dev);
</PRE><A NAME="351606"><PRE>
</PRE><A NAME="351607"><PRE> exit(0);}
</PRE><A NAME="351608"><PRE>
</PRE><A NAME="351609"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351610"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351611"><PRE>
</PRE><a name="351612">
<h2>7.5 </a>Contour </a>Plots</h2>
</a>
<a name="351613">
This program illustrates the PGS contour plotting functionality.<p>
</a>
<A NAME="351614"><PRE>
</PRE><A NAME="351615"><PRE> #include “</a>pgs.h”
</PRE><A NAME="351616"><PRE>
</PRE><A NAME="351617"><PRE> #define NPLOTS 1
</PRE><A NAME="351618"><PRE>
</PRE><A NAME="351619"><PRE> </a>PG_graph
</PRE><A NAME="351620"><PRE> *dataset;
</PRE><A NAME="351621"><PRE>
</PRE><A NAME="351622"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351623"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351624"><PRE>
</PRE><A NAME="351625"><PRE> /* MAIN - start it off here */
</PRE><A NAME="351626"><PRE>
</PRE><A NAME="351627"><PRE> main()
</PRE><A NAME="351628"><PRE> {int i, k, l, kmax, lmax, kxl;
</PRE><A NAME="351629"><PRE> int id, lncolor, lnstyle, centering;
</PRE><A NAME="351630"><PRE> REAL *x, *y, *f, r, t, lnwidth;
</PRE><A NAME="351631"><PRE> REAL xmin, xmax, ymin, ymax, fmin, fmax;
</PRE><A NAME="351632"><PRE> </a>PG_device *SCR_dev, *PS_dev;
</PRE><A NAME="351633"><PRE>
</PRE><A NAME="351634"><PRE> dataset = MAKE_N(</a>PG_graph, NPLOTS);
</PRE><A NAME="351635"><PRE> mark = MAKE_N(int, NPLOTS);
</PRE><A NAME="351636"><PRE>
</PRE><A NAME="351637"><PRE> /* set up the graphics window */
</PRE><A NAME="351638"><PRE> SCR_dev = </a>PG_make_device(“WINDOW”, “COLOR”, “PGS Contour Test”);
</PRE><A NAME="351639"><PRE> </a>PG_open_device(SCR_dev, 0.05, 0.2, 0.45, 0.45);
</PRE><A NAME="351640"><PRE>
</PRE><A NAME="351641"><PRE> PS_dev = </a>PG_make_device(“PS”, “MONOCHROME”, “PGS Contour Test”);
</PRE><A NAME="351642"><PRE> </a>PG_open_device(PS_dev, 0.0, 0.0, 0.0, 0.0);
</PRE><A NAME="351643"><PRE>
</PRE><A NAME="352371"><PRE> </a>PG_set_viewport_pos(SCR_dev, 0.25, 0.15);
</PRE><A NAME="352372"><PRE> </a>PG_set_viewport_shape(SCR_dev, 0.5, 0.0, 0.5/0.3333);
</PRE><A NAME="352373"><PRE>
</PRE><A NAME="352374"><PRE> </a>PG_white_background(SCR_dev, TRUE);
</PRE><A NAME="351649"><PRE> </a>PG_set_border_width(SCR_dev, 5);
</PRE><A NAME="351651"><PRE>
</PRE><A NAME="351652"><PRE> /* set up data */
</PRE><A NAME="351653"><PRE> kmax = 20;
</PRE><A NAME="351654"><PRE> lmax = 20;
</PRE><A NAME="351655"><PRE> xmin = -5.0;
</PRE><A NAME="351656"><PRE> xmax = 5.0;
</PRE><A NAME="351657"><PRE> ymin = -5.0;
</PRE><A NAME="351658"><PRE> ymax = 5.0;
</PRE><A NAME="351659"><PRE> kxl = kmax*lmax;
</PRE><A NAME="351660"><PRE> x = MAKE_N(REAL, kxl);
</PRE><A NAME="351661"><PRE> y = MAKE_N(REAL, kxl);
</PRE><A NAME="351662"><PRE> f = MAKE_N(REAL, kxl);
</PRE><A NAME="351663"><PRE> id = ‘A’;
</PRE><A NAME="351664"><PRE> lncolor = SCR_dev->BLUE;
</PRE><A NAME="351665"><PRE> lnwidth = 0.0;
</PRE><A NAME="351666"><PRE> lnstyle = SOLID;
</PRE><A NAME="351667"><PRE> centering = FALSE;
</PRE><A NAME="351668"><PRE>
</PRE><A NAME="351669"><PRE> for (k = 0; k < kmax; k++)
</PRE><A NAME="351670"><PRE> for (l = 0; l < lmax; l++)
</PRE><A NAME="351671"><PRE> {i = l*kmax + k;
</PRE><A NAME="351672"><PRE> x[i] = k/10.0 - 5.0;
</PRE><A NAME="351673"><PRE> y[i] = l/10.0 - 5.0;
</PRE><A NAME="351674"><PRE> r = x[i]*x[i] + y[i]*y[i];
</PRE><A NAME="351675"><PRE> t = 5.0*atan(y[i]/(x[i] + SMALL));
</PRE><A NAME="351676"><PRE> r = pow(r, 0.125);
</PRE><A NAME="351677"><PRE> f[i] = exp(-r)*(1.0 + 0.1*cos(t));};
</PRE><A NAME="351678"><PRE>
</PRE><A NAME="351679"><PRE> </a>PG_iso_limit(f, kxl, &fmin, &fmax);
</PRE><A NAME="351680"><PRE>
</PRE><A NAME="351681"><PRE> dataset = </a>PG_make_graph_r2_r1(id, “contour”, FALSE,
</PRE><A NAME="351682"><PRE> kmax, lmax, centering, x, y, f,
</PRE><A NAME="351683"><PRE> “xy”, “f”,
</PRE><A NAME="351684"><PRE> lncolor, lnwidth, lnstyle);
</PRE><A NAME="351685"><PRE>
</PRE><A NAME="351686"><PRE> data->info = </a>PG_set_tds_info(data->info, PLOT_CONTOUR, CARTESIAN,
</PRE><A NAME="351645"><PRE> lnstyle, lncolor, 10, 1.0,
</PRE><A NAME="351646"><PRE> lnwidth, 0.0, 0.0, 0.0, HUGE);
</PRE><A NAME="351687"><PRE>
</PRE><A NAME="351688"><PRE> </a>PG_contour_plot(SCR_dev, dataset);
</PRE><A NAME="351689"><PRE> </a>PG_contour_plot(PS_dev, dataset);
</PRE><A NAME="351690"><PRE>
</PRE><A NAME="351691"><PRE> SC_pause();
</PRE><A NAME="351692"><PRE>
</PRE><A NAME="351693"><PRE> </a>PG_close_device(SCR_dev);
</PRE><A NAME="351694"><PRE> </a>PG_close_device(PS_dev);
</PRE><A NAME="351695"><PRE>
</PRE><A NAME="351696"><PRE> exit(0);}
</PRE><A NAME="351697"><PRE>
</PRE><A NAME="351698"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351699"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351700"><PRE>
</PRE><a name="351701">
<h2>7.6 </a>Image </a>Plots</h2>
</a>
<a name="351702">
PGS has facilities for manipulating </a>cell array data and </a>rendering such data sets. In PGS these are referred to as image plots. The following program generates and plots some images.<p>
</a>
<A NAME="351703"><PRE>
</PRE><A NAME="351704"><PRE> #include “</a>pgs.h”
</PRE><A NAME="351705"><PRE>
</PRE><A NAME="351706"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351707"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351708"><PRE>
</PRE><A NAME="351709"><PRE> main()
</PRE><A NAME="351710"><PRE> {int k, l;
</PRE><A NAME="351711"><PRE> int X_max, Y_max;
</PRE><A NAME="351712"><PRE> double dx, dy, x, y, sf;
</PRE><A NAME="351713"><PRE> char *s;
</PRE><A NAME="351714"><PRE> </a>PG_palette *pl;
</PRE><A NAME="351715"><PRE> </a>PG_image *calc_im;
</PRE><A NAME="351716"><PRE> </a>PG_device *SCR_dev, *SCR_dew, *PS_dev;
</PRE><A NAME="351717"><PRE> unsigned char *bf, *p;
</PRE><A NAME="351718"><PRE>
</PRE><A NAME="351719"><PRE> X_max = 250;
</PRE><A NAME="351720"><PRE> Y_max = 250;
</PRE><A NAME="351721"><PRE>
</PRE><A NAME="351722"><PRE> calc_im = </a>PG_make_image(“Test Image”, SC_CHAR_S,
</PRE><A NAME="351723"><PRE> 0.0, 0.0, 0.0, 0.0, -1.0, 1.0,
</PRE><A NAME="351724"><PRE> X_max, Y_max, 4, NULL);
</PRE><A NAME="351725"><PRE> if (calc_im == NULL)
</PRE><A NAME="351726"><PRE> {PRINT(stdout, “CAN’T ALLOCATE IMAGE”);
</PRE><A NAME="351727"><PRE> exit(1);};
</PRE><A NAME="351728"><PRE>
</PRE><A NAME="351729"><PRE> </a>PG_open_console(“GSIMTS”, “MONOCHROME”, 1,
</PRE><A NAME="351730"><PRE> 0.05, 0.7, 0.9, 0.20);
</PRE><A NAME="351731"><PRE>
</PRE><A NAME="351732"><PRE> SCR_dev = </a>PG_make_device(“WINDOW”, “COLOR”, “PGS Image Test”);
</PRE><A NAME="351733"><PRE> </a>PG_background_white(SCR_dev, FALSE;
</PRE><A NAME="351734"><PRE> </a>PG_open_device(SCR_dev, 0.05, 0.1, 0.4, 0.4);
</PRE><A NAME="351735"><PRE>
</PRE><A NAME="351736"><PRE> SCR_dew = </a>PG_make_device(s, “COLOR”, “PGS Image Test”);
</PRE><A NAME="351737"><PRE> </a>PG_background_white(SCR_dew, TRUE);
</PRE><A NAME="351738"><PRE> </a>PG_open_device(SCR_dew, 0.55, 0.1, 0.4, 0.4);
</PRE><A NAME="351739"><PRE>
</PRE><A NAME="351740"><PRE> PS_dev = </a>PG_make_device(“PS”, “COLOR”, “PGS Test”);
</PRE><A NAME="351741"><PRE> </a>PG_open_device(PS_dev, 0.0, 0.0, 0.0, 0.0);
</PRE><A NAME="351742"><PRE>
</PRE><A NAME="351743"><PRE> </a>PG_set_viewport(SCR_dev, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351744"><PRE> </a>PG_set_window(SCR_dev, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351745"><PRE>
</PRE><A NAME="351746"><PRE> </a>PG_set_viewport(SCR_dew, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351747"><PRE> </a>PG_set_window(SCR_dew, 0.0, 1.0, 0.0, 1.0);
</PRE><A NAME="351748"><PRE>
</PRE><A NAME="351749"><PRE> /* draw the first image */
</PRE><A NAME="351750"><PRE> bf = calc_im->buffer;
</PRE><A NAME="351751"><PRE> pl = </a>PG_set_palette(SCR_dev, “</a>bw”);
</PRE><A NAME="351752"><PRE> sf = pl->n_pal_colors;
</PRE><A NAME="351753"><PRE> for (l = 0; l < Y_max; l++)
</PRE><A NAME="351754"><PRE> {for (k = 0; k < X_max; k++)
</PRE><A NAME="351755"><PRE> *bf++ = sf*((double) k)*((double) (Y_max - l - 1))/
</PRE><A NAME="351756"><PRE> ((double) Y_max*X_max);};
</PRE><A NAME="351757"><PRE>
</PRE><A NAME="351758"><PRE> </a>PG_draw_image(SCR_dev, calc_im, “Test Data A”);
</PRE><A NAME="351759"><PRE>
</PRE><A NAME="351760"><PRE> </a>PG_set_palette(PS_dev, “</a>bw”);
</PRE><A NAME="351761"><PRE> </a>PG_draw_image(PS_dev, calc_im, “Test Data HC”);
</PRE><A NAME="351762"><PRE>
</PRE><A NAME="351763"><PRE> SC_pause();
</PRE><A NAME="351764"><PRE>
</PRE><A NAME="351765"><PRE> /* draw the second image */
</PRE><A NAME="351766"><PRE> dx = 2.0*PI/((double) X_max);
</PRE><A NAME="351767"><PRE> dy = 2.0*PI/((double) Y_max);
</PRE><A NAME="351768"><PRE> bf = calc_im->buffer;
</PRE><A NAME="351769"><PRE> pl = </a>PG_set_palette(SCR_dew, “</a>rainbow”);
</PRE><A NAME="351770"><PRE> sf = pl->n_pal_colors;
</PRE><A NAME="351771"><PRE> for (l = 0; l < Y_max; l++)
</PRE><A NAME="351772"><PRE> {for (k = 0; k < X_max; k++)
</PRE><A NAME="351773"><PRE> {x = ((double) k)*dx;
</PRE><A NAME="351774"><PRE> y = ((double) (Y_max - l - 1))*dy;
</PRE><A NAME="351775"><PRE> *bf++ = sf*(0.5 + 0.5*sin(x)*cos(y));};};
</PRE><A NAME="351776"><PRE>
</PRE><A NAME="351777"><PRE> </a>PG_clear_window(SCR_dew);
</PRE><A NAME="351778"><PRE> </a>PG_draw_image(SCR_dew, calc_im, “Test Data B”);
</PRE><A NAME="351779"><PRE>
</PRE><A NAME="351780"><PRE> SC_pause();
</PRE><A NAME="351781"><PRE>
</PRE><A NAME="351782"><PRE> </a>PG_close_device(SCR_dev);
</PRE><A NAME="351783"><PRE> </a>PG_close_device(SCR_dew);
</PRE><A NAME="351784"><PRE> </a>PG_close_device(PS_dev);
</PRE><A NAME="351785"><PRE>
</PRE><A NAME="351786"><PRE> </a>PG_rl_image(calc_im);
</PRE><A NAME="351787"><PRE>
</PRE><A NAME="351788"><PRE> exit(0);}
</PRE><A NAME="351789"><PRE>
</PRE><A NAME="351790"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351791"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351792"><PRE>
</PRE><a name="351793">
<h2>7.7 </a>Surface </a>Plots</h2>
</a>
<a name="351794">
PGS also has the ability to </a>render data sets as </a>wire-frame meshes with </a>hidden line removal. The following program shows how this is done.<p>
</a>
<A NAME="351795"><PRE>
</PRE><A NAME="351796"><PRE> #include “pgs.h”
</PRE><A NAME="351797"><PRE>
</PRE><A NAME="351798"><PRE> #define N_POINTS 10
</PRE><A NAME="351799"><PRE>
</PRE><A NAME="351800"><PRE> static void
</PRE><A NAME="351801"><PRE> DECLARE(draw_set, (PG_device *SCR_dev, PG_device *PS_dev,
</PRE><A NAME="351802"><PRE> PG_device *CGM_dev, REAL *rz, REAL *rs, REAL *ext,
</PRE><A NAME="351803"><PRE> REAL *rx, REAL *ry, int n_pts,
</PRE><A NAME="351804"><PRE> double xmn, double xmx, double ymn, double ymx,
</PRE><A NAME="351805"><PRE> double theta, double phi, double width,
</PRE><A NAME="351806"><PRE> int color, int style, int type, int *maxes)),
</PRE><A NAME="351807"><PRE> DECLARE(print_help, (byte));
</PRE><A NAME="351808"><PRE>
</PRE><A NAME="351809"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351810"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351811"><PRE>
</PRE><A NAME="351812"><PRE> main(argc, argv)
</PRE><A NAME="351813"><PRE> int argc;
</PRE><A NAME="351814"><PRE> char **argv;
</PRE><A NAME="351815"><PRE> {int i, k, l;
</PRE><A NAME="351816"><PRE> int maxes[2], X_max, Y_max, n_pts, use_color, type;
</PRE><A NAME="351817"><PRE> double x, y, dx, dy, theta, phi, dp;
</PRE><A NAME="351818"><PRE> char *s, t[MAXLINE], *token;
</PRE><A NAME="351819"><PRE> PG_device *SCR_dev, *PS_dev, *CGM_dev;
</PRE><A NAME="351820"><PRE> REAL *rx, *ry, *rz, *rs, *px, *py, *pz, *ps, *ext;
</PRE><A NAME="351821"><PRE>
</PRE><A NAME="351822"><PRE> X_max = N_POINTS;
</PRE><A NAME="351823"><PRE> Y_max = N_POINTS;
</PRE><A NAME="351824"><PRE> use_color = FALSE;
</PRE><A NAME="351825"><PRE> type = PLOT_WIRE_MESH;
</PRE><A NAME="351826"><PRE> dp = 0.0;
</PRE><A NAME="351827"><PRE> for (i = 1; i < argc; i++)
</PRE><A NAME="351828"><PRE> {if (argv[i][0] == ‘-’)
</PRE><A NAME="351829"><PRE> {switch (argv[i][1])
</PRE><A NAME="351830"><PRE> {case ‘c’ : use_color = TRUE;
</PRE><A NAME="351831"><PRE> break;
</PRE><A NAME="351832"><PRE> case ‘p’ : dp = ATOF(argv[++i]);
</PRE><A NAME="351833"><PRE> break;
</PRE><A NAME="351834"><PRE> case ‘s’ : type = PLOT_SURFACE;
</PRE><A NAME="351835"><PRE> break;
</PRE><A NAME="351836"><PRE> case ‘w’ : type = PLOT_WIRE_MESH;
</PRE><A NAME="351837"><PRE> break;
</PRE><A NAME="351838"><PRE> case ‘z’ : X_max = Y_max = atoi(argv[++i]);
</PRE><A NAME="351839"><PRE> break;};}
</PRE><A NAME="351840"><PRE>
</PRE><A NAME="351841"><PRE> else
</PRE><A NAME="351842"><PRE> break;};
</PRE><A NAME="351843"><PRE>
</PRE><A NAME="351844"><PRE> maxes[0] = X_max;
</PRE><A NAME="351845"><PRE> maxes[1] = Y_max;
</PRE><A NAME="351846"><PRE> n_pts = X_max*Y_max;
</PRE><A NAME="351847"><PRE>
</PRE><A NAME="351848"><PRE> PG_open_console(“GSSFTS”, “MONOCHROME”, 1,
</PRE><A NAME="351849"><PRE> 0.55, 0.1, 0.4, 0.8);
</PRE><A NAME="351850"><PRE>
</PRE><A NAME="351851"><PRE> if (use_color)
</PRE><A NAME="351852"><PRE> SCR_dev = PG_make_device(“WINDOW”, “COLOR”, “PGS Surface Test”);
</PRE><A NAME="351853"><PRE> else
</PRE><A NAME="351854"><PRE> SCR_dev = PG_make_device(“WINDOW”, “MONOCHROME”,
</PRE><A NAME="351855"><PRE> “PGS Surface Test”);
</PRE><A NAME="351856"><PRE> PG_open_device(SCR_dev, 0.1, 0.1, 0.4, 0.4);
</PRE><A NAME="351857"><PRE>
</PRE><A NAME="351858"><PRE> if (type == PLOT_SURFACE)
</PRE><A NAME="351859"><PRE> PG_set_palette(SCR_dev, “spectrum”);
</PRE><A NAME="351860"><PRE>
</PRE><A NAME="351861"><PRE> rx = px = MAKE_N(REAL, n_pts);
</PRE><A NAME="351862"><PRE> ry = py = MAKE_N(REAL, n_pts);
</PRE><A NAME="351863"><PRE> rz = pz = MAKE_N(REAL, n_pts);
</PRE><A NAME="351864"><PRE>
</PRE><A NAME="351865"><PRE> if (type == PLOT_SURFACE)
</PRE><A NAME="351866"><PRE> rs = ps = MAKE_N(REAL, n_pts);
</PRE><A NAME="351867"><PRE> else
</PRE><A NAME="351868"><PRE> rs = ps = pz;
</PRE><A NAME="351869"><PRE>
</PRE><A NAME="351870"><PRE> ext = MAKE_N(REAL, 4);
</PRE><A NAME="351871"><PRE> ext[0] = -1;
</PRE><A NAME="351872"><PRE> ext[1] = 1;
</PRE><A NAME="351873"><PRE> ext[2] = -1;
</PRE><A NAME="351874"><PRE> ext[3] = 1;
</PRE><A NAME="351875"><PRE>
</PRE><A NAME="351876"><PRE> /* draw the first image */
</PRE><A NAME="351877"><PRE> dx = 2.0*PI/((double) (X_max - 1));
</PRE><A NAME="351878"><PRE> dy = 2.0*PI/((double) (Y_max - 1));
</PRE><A NAME="351879"><PRE> for (l = 0; l < Y_max; l++)
</PRE><A NAME="351880"><PRE> {for (k = 0; k < X_max; k++)
</PRE><A NAME="351881"><PRE> {*px++ = x = ((double) k)*dx;
</PRE><A NAME="351882"><PRE> *py++ = y = ((double) l)*dy;
</PRE><A NAME="351883"><PRE> *pz++ = cos(y);
</PRE><A NAME="351884"><PRE> if (type == PLOT_SURFACE)
</PRE><A NAME="351885"><PRE> *ps++ = sin(x);};};
</PRE><A NAME="351886"><PRE>
</PRE><A NAME="351887"><PRE> if (dp == 0.0)
</PRE><A NAME="351888"><PRE> {while (TRUE)
</PRE><A NAME="351889"><PRE> {PRINT(stdout, “Viewing Angle: “);
</PRE><A NAME="351890"><PRE> GETLN(t, MAXLINE, stdin);
</PRE><A NAME="351891"><PRE>
</PRE><A NAME="351892"><PRE> if ((token = strtok(t, “ ,”)) == NULL)
</PRE><A NAME="351893"><PRE> break;
</PRE><A NAME="351894"><PRE> theta = DEG_RAD*ATOF(token);
</PRE><A NAME="351895"><PRE>
</PRE><A NAME="351896"><PRE> if ((token = strtok(NULL, “ ,”)) == NULL)
</PRE><A NAME="351897"><PRE> break;
</PRE><A NAME="351898"><PRE> phi = DEG_RAD*ATOF(token);
</PRE><A NAME="351899"><PRE>
</PRE><A NAME="351900"><PRE> draw_set(SCR_dev, PS_dev, CGM_dev,
</PRE><A NAME="351901"><PRE> rz, rs, ext, rx, ry,
</PRE><A NAME="351902"><PRE> n_pts,
</PRE><A NAME="351903"><PRE> 0.0, 2.0*PI, 0.0, 2.0*PI,
</PRE><A NAME="351904"><PRE> theta, phi,
</PRE><A NAME="351905"><PRE> 0.0, SCR_dev->BLUE, SOLID,
</PRE><A NAME="351906"><PRE> type, maxes);};}
</PRE><A NAME="351907"><PRE>
</PRE><A NAME="351908"><PRE> else
</PRE><A NAME="351909"><PRE> {for (phi = 0.0; phi <= 90.0; phi += dp)
</PRE><A NAME="351910"><PRE> {draw_set(SCR_dev, PS_dev, CGM_dev,
</PRE><A NAME="351911"><PRE> rz, rs, ext, rx, ry,
</PRE><A NAME="351912"><PRE> n_pts,
</PRE><A NAME="351913"><PRE> 0.0, 2.0*PI, 0.0, 2.0*PI,
</PRE><A NAME="351914"><PRE> 0.0, DEG_RAD*phi,
</PRE><A NAME="351915"><PRE> 0.0, SCR_dev->BLUE, SOLID,
</PRE><A NAME="351916"><PRE> type, maxes);};};
</PRE><A NAME="351917"><PRE>
</PRE><A NAME="351918"><PRE> PG_close_device(SCR_dev);
</PRE><A NAME="351919"><PRE>
</PRE><A NAME="351920"><PRE> exit(0);}
</PRE><A NAME="351921"><PRE>
</PRE><A NAME="351922"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351923"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351924"><PRE>
</PRE><A NAME="351925"><PRE> /* DRAW_SET - draw a complete set of plots */
</PRE><A NAME="351926"><PRE>
</PRE><A NAME="351927"><PRE> static void draw_set(SCR_dev, PS_dev, CGM_dev, rz, rs, ext, rx, ry,
</PRE><A NAME="351928"><PRE> n_pts, xmn, xmx, ymn, ymx, theta, phi,
</PRE><A NAME="351929"><PRE> width, color, style, type, maxes)
</PRE><A NAME="351930"><PRE> PG_device *SCR_dev, *PS_dev, *CGM_dev;
</PRE><A NAME="351931"><PRE> REAL *rz, *rs, *ext, *rx, *ry;
</PRE><A NAME="351932"><PRE> int n_pts;
</PRE><A NAME="351933"><PRE> double xmn, xmx, ymn, ymx, theta, phi, width;
</PRE><A NAME="351934"><PRE> int color, style, type;
</PRE><A NAME="351935"><PRE> int *maxes;
</PRE><A NAME="351936"><PRE> {PG_draw_surface(SCR_dev, rz, rs, ext, rx, ry,
</PRE><A NAME="351937"><PRE> n_pts,
</PRE><A NAME="351938"><PRE> xmn, xmx, ymn, ymx, theta, phi, width, color,
</PRE><A NAME="351939"><PRE> style, type, “Test Data”,
</PRE><A NAME="351940"><PRE> “Logical-Rectangular”, maxes);
</PRE><A NAME="351941"><PRE> return;}
</PRE><A NAME="351942"><PRE>
</PRE><A NAME="351943"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351944"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="351945"><PRE>
</PRE><a name="351946">
<h2>7.8 </a>Vector </a>Plots</h2>
</a>
<a name="351947">
PGS can </a>render </a>2 dimensional </a>vector </a>fields. The following program demonstrates this capability.<p>
</a>
<a name="351948">
<h2>7.9 </a>FORTRAN API Example</h2>
</a>
<A NAME="351949"><PRE> c
</PRE><A NAME="351950"><PRE> c GSTEST.F - test of PGS FORTRAN API
</PRE><A NAME="351951"><PRE> c
</PRE><A NAME="351952"><PRE> c -------------------------------------------------------------------
</PRE><A NAME="351953"><PRE> c -------------------------------------------------------------------
</PRE><A NAME="351954"><PRE>
</PRE><A NAME="351955"><PRE> program gsftst
</PRE><A NAME="351956"><PRE>
</PRE><A NAME="351957"><PRE> integer pgmkdv
</PRE><A NAME="351958"><PRE> integer idev, idvp
</PRE><A NAME="351959"><PRE> double precision x1, y1, x2, y2
</PRE><A NAME="351960"><PRE> double precision x(5), y(5), u(4), v(4)
</PRE><A NAME="351961"><PRE> character*8 names, namep
</PRE><A NAME="351962"><PRE> character*10 name2, name3
</PRE><A NAME="351963"><PRE> character*12 name4
</PRE><A NAME="351964"><PRE>
</PRE><A NAME="351965"><PRE> c ... set up the window
</PRE><A NAME="351966"><PRE> names = ‘WINDOW’
</PRE><A NAME="351967"><PRE> name2 = ‘COLOR’
</PRE><A NAME="351968"><PRE> name3 = ‘PGS Test A’
</PRE><A NAME="351969"><PRE> idev = pgmkdv(6, names, 5, name2, 10, name3)
</PRE><A NAME="351970"><PRE> x1 = 0.05
</PRE><A NAME="351971"><PRE> y1 = 0.2
</PRE><A NAME="351972"><PRE> x2 = 0.45
</PRE><A NAME="351973"><PRE> y2 = 0.45
</PRE><A NAME="351974"><PRE> call pgopen(idev, x1, y1, x2, y2)
</PRE><A NAME="351975"><PRE>
</PRE><A NAME="351976"><PRE> c ... set up the PS device
</PRE><A NAME="351977"><PRE> namep = ‘PS’
</PRE><A NAME="351978"><PRE> name2 = ‘MONOCHROME’
</PRE><A NAME="351979"><PRE> name3 = ‘gsftst’
</PRE><A NAME="351980"><PRE> idvp = pgmkdv(2, namep, 10, name2, 6, name3)
</PRE><A NAME="351981"><PRE> x1 = 0.0
</PRE><A NAME="351982"><PRE> y1 = 0.0
</PRE><A NAME="351983"><PRE> x2 = 0.0
</PRE><A NAME="351984"><PRE> y2 = 0.0
</PRE><A NAME="351985"><PRE> call pgopen(idvp, x1, y1, x2, y2)
</PRE><A NAME="351986"><PRE>
</PRE><A NAME="351987"><PRE> call pgclsc(idev)
</PRE><A NAME="351988"><PRE> call pgclsc(idvp)
</PRE><A NAME="351989"><PRE>
</PRE><A NAME="351990"><PRE> c ... set up the view port and world coordinate system
</PRE><A NAME="351991"><PRE> x1 = 0.1
</PRE><A NAME="351992"><PRE> x2 = 0.9
</PRE><A NAME="351993"><PRE> y1 = 0.1
</PRE><A NAME="351994"><PRE> y2 = 0.9
</PRE><A NAME="351995"><PRE> call pgsvwp(idev, x1, x2, y1, y2)
</PRE><A NAME="351996"><PRE> call pgsvwp(idvp, x1, x2, y1, y2)
</PRE><A NAME="351997"><PRE> x1 = 0.0
</PRE><A NAME="351998"><PRE> x2 = 10.0
</PRE><A NAME="351999"><PRE> y1 = -15.0
</PRE><A NAME="352000"><PRE> y2 = 30.0
</PRE><A NAME="352001"><PRE> call pgswcs(idev, x1, x2, y1, y2)
</PRE><A NAME="352002"><PRE> call pgswcs(idvp, x1, x2, y1, y2)
</PRE><A NAME="352003"><PRE>
</PRE><A NAME="352004"><PRE> c ... draw a bounding box
</PRE><A NAME="352005"><PRE> x1 = 0.0
</PRE><A NAME="352006"><PRE> x2 = 10.0
</PRE><A NAME="352007"><PRE> y1 = -15.0
</PRE><A NAME="352008"><PRE> y2 = 30.0
</PRE><A NAME="352009"><PRE> call pgdrbx(idev, x1, x2, y1, y2)
</PRE><A NAME="352010"><PRE> call pgdrbx(idvp, x1, x2, y1, y2)
</PRE><A NAME="352011"><PRE>
</PRE><A NAME="352012"><PRE> c ... write a string
</PRE><A NAME="352013"><PRE> x1 = 5.0
</PRE><A NAME="352014"><PRE> y1 = 0.0
</PRE><A NAME="352015"><PRE> name4 = ‘TEXT STRING’
</PRE><A NAME="352016"><PRE> 100 format(1p, e10.2)
</PRE><A NAME="352017"><PRE> call pgwrta(idev, x1, y1, 11, name4)
</PRE><A NAME="352018"><PRE> call pgwrta(idvp, x1, y1, 11, name4)
</PRE><A NAME="352019"><PRE>
</PRE><A NAME="352020"><PRE> c ... draw a line
</PRE><A NAME="352021"><PRE> x1 = 1.0
</PRE><A NAME="352022"><PRE> x2 = 9.0
</PRE><A NAME="352023"><PRE> y1 = -4.0
</PRE><A NAME="352024"><PRE> y2 = -1.0
</PRE><A NAME="352025"><PRE> call pgdrln(idev, x1, y1, x2, y2)
</PRE><A NAME="352026"><PRE> call pgdrln(idvp, x1, y1, x2, y2)
</PRE><A NAME="352027"><PRE>
</PRE><A NAME="352028"><PRE> c ... do a vector plot
</PRE><A NAME="352029"><PRE> x(1) = 3.0
</PRE><A NAME="352030"><PRE> y(1) = 4.0
</PRE><A NAME="352031"><PRE> u(1) = -0.5
</PRE><A NAME="352032"><PRE> v(1) = -0.25
</PRE><A NAME="352033"><PRE>
</PRE><A NAME="352034"><PRE> x(2) = 4.0
</PRE><A NAME="352035"><PRE> y(2) = 4.0
</PRE><A NAME="352036"><PRE> u(2) = 0.5
</PRE><A NAME="352037"><PRE> v(2) = -0.25
</PRE><A NAME="352038"><PRE>
</PRE><A NAME="352039"><PRE> x(3) = 4.0
</PRE><A NAME="352040"><PRE> y(3) = 5.0
</PRE><A NAME="352041"><PRE> u(3) = 0.5
</PRE><A NAME="352042"><PRE> v(3) = 0.0
</PRE><A NAME="352043"><PRE>
</PRE><A NAME="352044"><PRE> x(4) = 3.0
</PRE><A NAME="352045"><PRE> y(4) = 5.0
</PRE><A NAME="352046"><PRE> u(4) = -0.5
</PRE><A NAME="352047"><PRE> v(4) = 0.5
</PRE><A NAME="352048"><PRE>
</PRE><A NAME="352049"><PRE> call pgplvc(idev, x, y, u, v, 4)
</PRE><A NAME="352050"><PRE> call pgplvc(idvp, x, y, u, v, 4)
</PRE><A NAME="352051"><PRE>
</PRE><A NAME="352052"><PRE> c ... draw and fill a polygon (color 4 is blue)
</PRE><A NAME="352053"><PRE> x(1) = 5.0
</PRE><A NAME="352054"><PRE> x(2) = 6.0
</PRE><A NAME="352055"><PRE> x(3) = 6.0
</PRE><A NAME="352056"><PRE> x(4) = 5.0
</PRE><A NAME="352057"><PRE> x(5) = 5.0
</PRE><A NAME="352058"><PRE> y(1) = 8.0
</PRE><A NAME="352059"><PRE> y(2) = 8.0
</PRE><A NAME="352060"><PRE> y(3) = 9.0
</PRE><A NAME="352061"><PRE> y(4) = 9.0
</PRE><A NAME="352062"><PRE> y(5) = 8.0
</PRE><A NAME="352063"><PRE> call pgfply(idev, x, y, 5, 4)
</PRE><A NAME="352064"><PRE> call pgfply(idvp, x, y, 5, 4)
</PRE><A NAME="352065"><PRE>
</PRE><A NAME="352066"><PRE> call pgfnpl(idev)
</PRE><A NAME="352067"><PRE> call pgfnpl(idvp)
</PRE><A NAME="352068"><PRE>
</PRE><A NAME="352069"><PRE> pause
</PRE><A NAME="352070"><PRE>
</PRE><A NAME="352071"><PRE> c ... close the device
</PRE><A NAME="352072"><PRE> call pgclos(idev)
</PRE><A NAME="352073"><PRE> call pgclos(idvp)
</PRE><A NAME="352074"><PRE>
</PRE><A NAME="352075"><PRE> call exit
</PRE><A NAME="352076"><PRE> end
</PRE><A NAME="352077"><PRE>
</PRE><A NAME="352078"><PRE> c ------------------------------------------------------------------
</PRE><A NAME="352079"><PRE> c ------------------------------------------------------------------
</PRE><A NAME="352080"><PRE>
</PRE><a name="352081">
<h1>8.0 Other </a>PACT </a>Documentation</h1>
</a>
<a name="352082">
</a>PGS depends on the </a>SCORE and </a>PML PACT libraries for certain key supporting functionalities. In turn PGS structures are used in </a>ULTRA II, </a>SX, and </a>PANACEA. Some readers may find it helpful to refer to these and other PACT documents.<p>
</a>
<a name="352083">
The list of PACT Documents is:<p>
</a>
<A NAME="352084"><PRE> PACT User’s Guide, UCRL-MA-112087
</PRE><A NAME="352085"><PRE> SCORE User’s Manual, UCRL-MA-108976 Rev.1
</PRE><A NAME="352086"><PRE> PPC User’s Manual UCRL-MA-108964 Rev.1
</PRE><A NAME="352087"><PRE> PML User’s Manual, UCRL-MA-108965 Rev.1
</PRE><A NAME="352088"><PRE> PDBLib User’s Manual, M-270 Rev.2
</PRE><A NAME="352089"><PRE> PGS User’s Manual, UCRL-MA-108966 Rev.1 (this document)
</PRE><A NAME="352090"><PRE> PANACEA User’s Manual, M-276 Rev.2
</PRE><A NAME="352091"><PRE> ULTRA II User’s Manual, UCRL-MA-108967 Rev.1
</PRE><A NAME="352092"><PRE> PDBDiff User’s Manual, UCRL-MA-108975 Rev.1
</PRE><A NAME="352093"><PRE> PDBView User’s Manual, UCRL-MA-108968 Rev.1
</PRE><A NAME="352094"><PRE> SX User’s Manual, UCRL-MA-112315
</PRE><a name="352095">
<p>
</a>
<p><hr>
</body></html>
|