home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / HISPEED2.LZH / GEMDEMO / GRAPHIC.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-02  |  4KB  |  111 lines

  1. {-------------------------------------------------------------------------
  2.                 HighSpeed Pascal GEM-interface demo program
  3.  
  4.                              VDI GRAPHICS DEMO
  5.  
  6.                       Copyright (c) 1990 by D-House I
  7.                             All rights reserved
  8.  
  9.                       Programmed by Martin Eskildsen
  10. -------------------------------------------------------------------------}
  11. {$R-,S-,D+}
  12.  
  13. program VDI_graphics;
  14.  
  15. uses GemInterface, GemDecl, GemVDI, GemAES;
  16.  
  17. var
  18.   i : integer;          { FOR index                }
  19.   j : integer;          { FOR index                }
  20.   p : PtsIn_Array;      { v_pline coordinate array }
  21.   a : Array_4;          { v_bar coordinate array   }
  22.   y : integer;          { y coordinates            }
  23.  
  24. begin
  25.   if Init_Gem then begin
  26.     Message('Welcome to the VDI graphics demonstration!');
  27.     OpenOutputWindow;
  28.  
  29.     Message('First, we''ll look at some lines...');
  30.     vsl_color(VDI_handle, Black);       { black lines           }
  31.     vsl_width(VDI_handle, 1);           { line width := 1 pixel }
  32.     with OutputWindow do begin
  33.       p[0] := wX + 5;                   { set line's left X     }
  34.       p[2] := wX + wW - 10;             { and right X           }
  35.       y    := wY + 5                    { first line's Y        }
  36.     end;
  37.     vsl_udsty(VDI_handle, Binary('1100110011001100'));  { set user line style }
  38.  
  39.     for i := Solid to DashDotDot + 1 do begin   { let's see all styles  }
  40.       vsl_type(VDI_handle, i);          { set current style             }
  41.       p[1] := y;  p[3] := y;            { set line start, end Y         }
  42.       v_pline(VDI_handle, 2, p);        { draw the line, 2 coords       }
  43.       inc(y, 10)                        { new y                         }
  44.     end;
  45.  
  46.     vsl_type(VDI_handle, Solid);        { set solid line style          }
  47.     for i := 0 to 4 do begin            { let's look at line widths     }
  48.       inc(y, 10);
  49.       vsl_width(VDI_handle, 1 + i * 2); { set line width (should be odd)}
  50.       p[1] := y;  p[3] := y;
  51.       v_pline(VDI_handle, 2, p)
  52.     end;
  53.  
  54.     Message('markers...');
  55.     ClearOutputWindow;
  56.     for i := 1 to 6 do
  57.       p[(i-1)*2] := OutputWindow.wX + i * 80;   { set up v_pmarker  }
  58.     p[1] := OutputWindow.wY + 20;               { coordinates       }
  59.     vsm_height(VDI_handle, 38);                 { set marker height }
  60.     for i := 1 to 6 do begin
  61.       for j := 1 to 5 do p[j*2+1] := p[1];      { set same y coord  }
  62.       vsm_type(VDI_handle, i);                  { set marker type   }
  63.       v_pmarker(VDI_handle, 6, p);              { make the markers  }
  64.       inc(p[1], 40)                             { update y pos      }
  65.     end;
  66.  
  67.     Message('then at some arcs...');
  68.     vsl_width(VDI_handle, 1);                   { line width := 1       }
  69.     ClearOutputWindow;
  70.     with OutputWindow do y := wY + wH div 2;    { window mid Y          }
  71.     for i := 0 to 5 do 
  72.       v_arc(VDI_handle, OutputWindow.wX + 50 + i * 100, y,      { x, y  }
  73.             45,                                 { radius                }
  74.             0, (i + 1) * 600);                  { start, end angle      }
  75.  
  76.     Message('not to mention the pies...');
  77.     ClearOutputWindow;
  78.     vsf_interior(VDI_handle, PATTERN);  { use a pattern fill            }
  79.     vsf_color(VDI_handle, BLACK);       { make set points black         }
  80.     for i := 0 to 5 do begin
  81.       vsf_style(VDI_handle, i + 1);     { set fill style                }
  82.       v_pieslice(VDI_handle, OutputWindow.wX + 50 + i * 100, y,
  83.                  45,
  84.                  0, (i + 1) * 600)      { parameters same as for v_arc  }
  85.     end;                                { above                         }
  86.  
  87.     Message('circles...');
  88.     ClearOutputWindow;
  89.     for i := 0 to 5 do begin
  90.       vsf_style(VDI_handle, i + 1);
  91.       v_circle(VDI_handle, OutputWindow.wX + 50 + i * 100, y,   { x, y   }
  92.               (i+1) * 8)                                        { radius }
  93.     end;
  94.  
  95.     Message('and bars.');
  96.     ClearOutputWindow;
  97.     for i := 0 to 19 do begin
  98.       vsf_style(VDI_handle, i + 1);
  99.       a[0] := OutputWindow.wX + 5 + i * 30;
  100.       a[2] := a[0] + 25;
  101.       a[1] := OutputWindow.wY + OutputWindow.wH - 5;
  102.       a[3] := a[1] - (i + 1) * 10;
  103.       v_bar(VDI_handle, a)
  104.     end;
  105.  
  106.     Message('That''s all folks!');
  107.     CloseOutputWindow;
  108.     Exit_Gem
  109.   end
  110. end.
  111.