File: m_ellipse.c

package info (click to toggle)
plotutils 2.0-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,964 kB
  • ctags: 2,522
  • sloc: ansic: 38,416; sh: 1,853; yacc: 856; makefile: 181; lex: 144
file content (74 lines) | stat: -rw-r--r-- 1,541 bytes parent folder | download
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
/* This file contains the ellipse method, which is a GNU extension to
   libplot.  It draws an object: an ellipse with center xc,yc and semi-axes
   of length rx and ry (the former at a specified angle with the
   x-axis). */

#include "sys-defines.h"
#include "plot.h"
#include "extern.h"

int
#ifdef _HAVE_PROTOS
_m_ellipse (int x, int y, int rx, int ry, int angle)
#else
_m_ellipse (x, y, rx, ry, angle)
     int x, y, rx, ry, angle;
#endif
{
  if (!_plotter->open)
    {
      _plotter->error ("ellipse: invalid operation");
      return -1;
    }

  if (_plotter->outstream)
    {
      if (_plotter->portable_output)
	fprintf (_plotter->outstream, "%c %d %d %d %d %d\n", 
		 ELLIPSE, x, y, rx, ry, angle);
      else
	{
	  putc (ELLIPSE, _plotter->outstream);
	  _emit_integer (x);
	  _emit_integer (y);
	  _emit_integer (rx);
      _emit_integer (ry);
	  _emit_integer (angle);
	}
    }
  
  return 0;
}

int
#ifdef _HAVE_PROTOS
_m_fellipse (double x, double y, double rx, double ry, double angle)
#else
_m_fellipse (x, y, rx, ry, angle)
     double x, y, rx, ry, angle;
#endif
{
  if (!_plotter->open)
    {
      _plotter->error ("fellipse: invalid operation");
      return -1;
    }

  if (_plotter->outstream)
    {
      if (_plotter->portable_output)
	fprintf (_plotter->outstream, "%c %g %g %g %g %g\n", 
		 ELLIPSE, x, y, rx, ry, angle);
      else
	{
	  putc (FELLIPSE, _plotter->outstream);
	  _emit_float (x);
	  _emit_float (y);
	  _emit_float (rx);
	  _emit_float (ry);
	  _emit_float (angle);
	}
    }
  
  return 0;
}