home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / sonderh1 / gsxdemo.pas < prev    next >
Pascal/Delphi Source File  |  1986-11-25  |  7KB  |  224 lines

  1. PROGRAM GSXDemo (INPUT, OUTPUT);
  2.  
  3. CONST
  4.   {$I a:gsxconst.pas }
  5.  
  6. TYPE
  7.   {$I a:gsxtype.pas }
  8.  
  9. VAR
  10.   {$I a:gsxvar.pas }
  11.   Wahl: CHAR;
  12.   i, j, Style, Index, MaxInx, Rows, Cols: INTEGER;
  13.   angle, dummy: REAL;
  14.  
  15. {$I A:gsxvdi.pas }
  16. {$I A:gsxlib1.pas }
  17.  
  18. {---------------------------------------------------------------------------}
  19.  
  20. PROCEDURE Pause (Count: INTEGER);
  21.  
  22. VAR i, j: INTEGER;
  23.  
  24. BEGIN
  25.   FOR i := 0 TO Count DO
  26.     j := MaxInt DIV 1000;
  27. END;
  28.  
  29. {---------------------------------------------------------------------------}
  30.  
  31. PROCEDURE ShowLineType (Style: Line_Types);
  32.  
  33. VAR st: VDI_String;
  34.  
  35. BEGIN
  36.   Graph_Text(14000, 17000, 'Linienart:');
  37.   Str(Style, st);
  38.   Graph_Text(14000, 15000, st);
  39. END;
  40.  
  41. {---------------------------------------------------------------------------}
  42.  
  43. PROCEDURE ShowFillStyles (Style: Fill_Styles; Index: INTEGER);
  44.  
  45. VAR st: VDI_String;
  46.  
  47. BEGIN
  48.   Graph_Text(14000, 19000, 'Fuellart:');
  49.   Str(Style, st);
  50.   Graph_Text(14000, 17000, st);
  51.   Graph_Text(14000, 15000, 'Fuellmuster:');
  52.   Str(Index, st);
  53.   Graph_Text(14000, 13000, st);
  54. END;
  55.  
  56. {---------------------------------------------------------------------------}
  57.  
  58. PROCEDURE ShowMarkerType (Style: Marker_Types);
  59.  
  60. VAR st: VDI_String;
  61.  
  62. BEGIN
  63.   Graph_Text(14000, 16000, 'Markierungszeichen:');
  64.   Str(Style, st);
  65.   Graph_Text(14000, 14000, st);
  66. END;
  67.  
  68. {---------------------------------------------------------------------------}
  69.  
  70. PROCEDURE Fillptsin;
  71.  
  72. VAR i: INTEGER;
  73.  
  74. BEGIN
  75.   FOR i := 1 TO 100 DO
  76.     ptsin[i] := Random(MaxInt);
  77. END;
  78.  
  79. {---------------------------------------------------------------------------}
  80.  
  81. BEGIN
  82.   REPEAT
  83.     WriteLn; WriteLn; WriteLn;
  84.     WriteLn('              *********************************************');
  85.     WriteLn('              *                                           *');
  86.     WriteLn('              *              GSX-Grafik Demo              *');
  87.     WriteLn('              *                                           *');
  88.     WriteLn('              *********************************************');
  89.     WriteLn; WriteLn; WriteLn;
  90.     REPEAT
  91.       Write('Waehlen sie das Ausgabegeraet:');
  92.       Write('( A - Screen , B - Printer , C - Plotter ) : ');
  93.       ReadLn(Wahl);
  94.     UNTIL Wahl IN ['A'..'C','a'..'c'];
  95.     CASE Wahl OF
  96.       'A','a' : Open_Workstation(Screen);
  97.       'B','b' : Open_Workstation(Printer);
  98.       'C','c' : Open_Workstation(Plotter)
  99.     end;
  100.     WriteLn('  Es folgen Informationen ueber das angewaehlte Geraet:');
  101.     WriteLn; WriteLn;
  102.     WriteLn('           exakt skalierendes Geraet : ', Scaling);
  103.     WriteLn('                          farbfaehig : ', ColorDevice);
  104.     WriteLn('            Text kann gedreht werden : ', TextRotation);
  105.     WriteLn('    Flaechen koennen gefuellt werden : ', AreaFill);
  106.     WriteLn('Zeichen-Zellen Fuellung ist moeglich : ', CellArrays);
  107.     Write(' horizontale Aufloesung : ',HRes);
  108.     WriteLn('  vertikale Aufloesung : ',VRes);
  109.     Write('Abmessungen eines Pixel : ');
  110.     WriteLn(PixWidth, 'x', PixHeight, ' (x10^-6 m)');
  111.     Write('     Anzahl Linienarten : ', Lines);
  112.     WriteLn('  Anzahl Linienbreiten : ', LineWidths);
  113.     Write('Anzahl Punktmarkerarten : ', Markers);
  114.     WriteLn(' Anzahl Markergroessen : ', MarkerSizes);
  115.     Write('   Anzahl Zeichensaetze : ', Fonts);
  116.     WriteLn('    Anzahl Fuellmuster : ', Patterns);
  117.     Write('     Anzahl Schraffuren : ', HatchStyles);
  118.     WriteLn(' Anzahl vordef. Farben : ', Colors);
  119.     Write('   Anzahl ZeichenMakros : ',GDPs);
  120.     WriteLn('    Verfuegbare Farben : ',ColorsAvail);
  121.     Write('          Steuergeraete : ', InputLocators);
  122.     WriteLn('             Wertgeber : ', InputValuators);
  123.     Write('        Funktionstasten : ', InputChoices);
  124.     WriteLn(' Stringeingabe-Geraete : ', InputStrings);
  125.     Write('             Geraetetyp : ');
  126.     CASE WorkStationType OF
  127.       OutOnly  : WriteLn('nur Output');
  128.       InpOnly  : WriteLn('nur Input');
  129.       InpOut   : WriteLn('Input/Output');
  130.       SegStore : WriteLn('Segmentspeicher');
  131.       MetaOut  : WriteLn('GKS Metafile Output')
  132.     END;
  133.     Write('Minimale Zeichenhoehe : ',MinCharHeight);
  134.     WriteLn('  Maximale Zeichenhoehe : ',MaxCharHeight);
  135.     Write('Minimale Zeilenbreite : ',MinLineWidth);
  136.     WriteLn('  Maximale Zeilenbreite : ',MaxLineWidth);
  137.     Write('Minimale Punktmarkerhoehe : ',MinMarkHeight);
  138.     WriteLn('  Maximale Punktmarkerhoehe : ',MaxMarkHeight);
  139.     Text_Resolution(Rows, Cols);
  140.     WriteLn('Textaufloesung: ',Cols,'x',Rows);
  141.     WriteLn; WriteLn;
  142.     REPEAT
  143.       Write('Anderes Geraet waehlen (j/n) ? ');
  144.       ReadLn(Wahl)
  145.     UNTIL Wahl IN ['j','J','n','N'];
  146.   UNTIL Wahl IN ['n','N'];
  147.  
  148.   Open_Workstation(Screen);
  149.   Enter_Graphics;
  150.   i := Draw_Mode(Transparent);
  151.   Graph_Text(6000, 15000,
  152.              'Es folgt eine Demonstration verschiedener Linientypen.');
  153.   Pause(4000);
  154.   FOR i := Solid TO Lines DO
  155.   BEGIN
  156.     Clear_Workstation;
  157.     Style := Line_Type(i);
  158.     Fillptsin;
  159.     Poly_Line(50,ptsin);
  160.     ShowLineType(Style);
  161.     Pause(6000);
  162.   END;
  163.   Clear_Workstation;
  164.   Graph_Text(6000, 15000,
  165.              'Es folgt ein Demonstration verschiedener Fuellmuster.');
  166.   Pause(4000);
  167.   FOR i := Hollow TO Hatch DO
  168.   BEGIN
  169.     Style := Fill_Style(i);
  170.     IF Style IN [Pattern, Hatch] THEN
  171.     BEGIN
  172.       IF Style = Pattern THEN MaxInx := Patterns
  173.       ELSE MaxInx := HatchStyles;
  174.       FOR j := Vertical TO MaxInx DO
  175.       BEGIN
  176.         Index := Fill_Index(j);
  177.         Fillptsin;
  178.         Clear_Workstation;
  179.         Poly_Fill(50,ptsin);
  180.         ShowFillStyles(Style, Index);
  181.         Pause(6000);
  182.       END;
  183.     END
  184.     ELSE
  185.     BEGIN
  186.       Index := 0;
  187.       Fillptsin;
  188.       Clear_Workstation;
  189.       Poly_Fill(50, ptsin);
  190.       ShowFillStyles(Style, Index);
  191.       Pause(6000);
  192.     END;
  193.   END;
  194.   Clear_Workstation;
  195.   Graph_Text(5000, 15000,
  196.          'Es folgt noch eine Demonstration der verschiedenen Punktmarker.');
  197.   Pause(4000);
  198.   Clear_Workstation;
  199.   FOR i := Dot TO Markers DO
  200.   BEGIN
  201.     Clear_Workstation;
  202.     Style := Marker_Type(i);
  203.     Fillptsin;
  204.     Poly_Marker(50, ptsin);
  205.     ShowMarkerType(Style);
  206.     Pause(6000);
  207.   END;
  208.   Close_Workstation;
  209. {
  210.   Open_Workstation(Printer);
  211.   Enter_Graphics;
  212.   Text_Height(600, i, i, i, i);
  213.   angle := 0.0;
  214.   REPEAT
  215.     dummy := Text_Direction(angle);
  216.     Graph_Text(16383, 16383, ' GSX und Pascal');
  217.     angle := angle + 90.0;
  218.   UNTIL angle > 360.0;
  219.   Update_Workstation;
  220.  
  221.   Exit_Graphics;
  222.   Close_Workstation
  223. }
  224. END.