File: gettingstarted.c

package info (click to toggle)
giza 1.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,352 kB
  • sloc: ansic: 13,252; sh: 4,205; f90: 3,003; lex: 437; perl: 330; makefile: 99
file content (37 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (4)
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
#include <giza.h>

int
main (int argc, char **argv)
{
  int error;
  // Open the giza device
  error = giza_open_device ("?", "Getting_Started");

  if (error) {
    // Something went wrong so exit
    return 1;
  }

  // Set up the drawing environment
  giza_set_environment (-10., 10., 0., 100., 0, 0);
  
  // Draw a line
  int i, n = 100;
  double xpts[n], ypts[n];

  for (i = 0; i < n; ++i)
    {
      xpts[i] = -10. + (double) i * 20. / (double) (n - 1);
      ypts[i] = xpts[i] * xpts[i];
    }

  giza_line (n, xpts, ypts);

  // Label the axes
  giza_annotate ("B", 2.5, 0.5, 0.5, "Furlongs");
  giza_annotate ("L", 2.5, 0.5, 0.5, "Parsecs");

  // Close the giza device
  giza_close_device ();
  return 0;
}