File: m_affine.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 (99 lines) | stat: -rw-r--r-- 1,822 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
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
/* This file contains the translate, rotate and scale methods, which are
   GNU extensions to libplot.  They affect the affine transformation from
   user coordinates to device coordinates, as in Postscript. */

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

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

  if (_plotter->outstream)
    {
      if (_plotter->portable_output)
	fprintf (_plotter->outstream, "%c %g %g\n",
		 FTRANSLATE, x, y);
      else
	{
	  putc (FTRANSLATE, _plotter->outstream);
	  _emit_float (x);
	  _emit_float (y);
	}  
    }

  /* invoke generic method */
  return _g_ftranslate (x, y);
}

int
#ifdef _HAVE_PROTOS
_m_frotate (double theta)
#else
_m_frotate (theta)
     double theta;
#endif
{
  if (!_plotter->open)
    {
      _plotter->error ("frotate: invalid operation");
      return -1;
    }

  if (_plotter->outstream)
    {
      if (_plotter->portable_output)
	fprintf (_plotter->outstream, "%c %g\n",
		 FROTATE, theta);
      else
	{
	  putc (FROTATE, _plotter->outstream);
	  _emit_float (theta);
	}  
    }
      
  /* invoke generic method */
  return _g_frotate (theta);
}

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

  if (_plotter->outstream)
    {
      if (_plotter->portable_output)
	fprintf (_plotter->outstream, "%c %g %g\n",
		 FSCALE, x, y);
      else
	{
	  putc (FSCALE, _plotter->outstream);
	  _emit_float (x);
	  _emit_float (y);
	}  
    }
      
  /* invoke generic method */
  return _g_fscale (x, y);
}