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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
/* This file is part of the GNU plotutils package. Copyright (C) 1995,
1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.
The GNU plotutils package is free software. You may redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software foundation; either version 2, or (at your
option) any later version.
The GNU plotutils package is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with the GNU plotutils package; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
Boston, MA 02110-1301, USA. */
/* This file contains the versions of the Plotter methods that (i) take as
arguments, and/or (ii) return integers rather than doubles. */
#include "sys-defines.h"
#include "extern.h"
int
_API_arc (R___(Plotter *_plotter) int xc, int yc, int x0, int y0, int x1, int y1)
{
return _API_farc (R___(_plotter)
(double)xc, (double)yc,
(double)x0, (double)y0,
(double)x1, (double)y1);
}
int
_API_arcrel (R___(Plotter *_plotter) int dxc, int dyc, int dx0, int dy0, int dx1, int dy1)
{
return _API_farcrel (R___(_plotter)
(double)dxc, (double)dyc,
(double)dx0, (double)dy0,
(double)dx1, (double)dy1);
}
int
_API_bezier2 (R___(Plotter *_plotter) int xc, int yc, int x0, int y0, int x1, int y1)
{
return _API_fbezier2 (R___(_plotter)
(double)xc, (double)yc,
(double)x0, (double)y0,
(double)x1, (double)y1);
}
int
_API_bezier2rel (R___(Plotter *_plotter) int dxc, int dyc, int dx0, int dy0, int dx1, int dy1)
{
return _API_fbezier2rel (R___(_plotter)
(double)dxc, (double)dyc,
(double)dx0, (double)dy0,
(double)dx1, (double)dy1);
}
int
_API_bezier3 (R___(Plotter *_plotter) int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
{
return _API_fbezier3 (R___(_plotter)
(double)x0, (double)y0,
(double)x1, (double)y1,
(double)x2, (double)y2,
(double)x3, (double)y3);
}
int
_API_bezier3rel (R___(Plotter *_plotter) int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
{
return _API_fbezier3rel (R___(_plotter)
(double)x0, (double)y0,
(double)x1, (double)y1,
(double)x2, (double)y2,
(double)x3, (double)y3);
}
int
_API_box (R___(Plotter *_plotter) int x0, int y0, int x1, int y1)
{
return _API_fbox (R___(_plotter)
(double)x0, (double)y0, (double)x1, (double)y1);
}
int
_API_boxrel (R___(Plotter *_plotter) int dx0, int dy0, int dx1, int dy1)
{
return _API_fboxrel (R___(_plotter)
(double)dx0, (double)dy0,
(double)dx1, (double)dy1);
}
int
_API_circle (R___(Plotter *_plotter) int x, int y, int r)
{
return _API_fcircle (R___(_plotter)
(double)x, (double)y, (double)r);
}
int
_API_circlerel (R___(Plotter *_plotter) int dx, int dy, int r)
{
return _API_fcirclerel (R___(_plotter)
(double)dx, (double)dy, (double)r);
}
int
_API_cont (R___(Plotter *_plotter) int x, int y)
{
return _API_fcont (R___(_plotter)
(double)x, (double)y);
}
int
_API_contrel (R___(Plotter *_plotter) int dx, int dy)
{
return _API_fcontrel (R___(_plotter)
(double)dx, (double)dy);
}
int
_API_ellarc (R___(Plotter *_plotter) int xc, int yc, int x0, int y0, int x1, int y1)
{
return _API_fellarc (R___(_plotter)
(double)xc, (double)yc,
(double)x0, (double)y0,
(double)x1, (double)y1);
}
int
_API_ellarcrel (R___(Plotter *_plotter) int dxc, int dyc, int dx0, int dy0, int dx1, int dy1)
{
return _API_fellarcrel (R___(_plotter)
(double)dxc, (double)dyc,
(double)dx0, (double)dy0,
(double)dx1, (double)dy1);
}
int
_API_ellipse (R___(Plotter *_plotter) int x, int y, int rx, int ry, int angle)
{
return _API_fellipse (R___(_plotter)
(double)x, (double)y,
(double)rx, (double)ry, (double)angle);
}
int
_API_ellipserel (R___(Plotter *_plotter) int dx, int dy, int rx, int ry, int angle)
{
return _API_fellipserel (R___(_plotter)
(double)dx, (double)dy,
(double)rx, (double)ry,
(double)angle);
}
int
_API_fontname (R___(Plotter *_plotter) const char *s)
{
double new_size = _API_ffontname (R___(_plotter) s);
return IROUND(new_size);
}
int
_API_fontsize (R___(Plotter *_plotter) int size)
{
double new_size = _API_ffontsize (R___(_plotter) (double)size);
return IROUND(new_size);
}
int
_API_line (R___(Plotter *_plotter) int x0, int y0, int x1, int y1)
{
return _API_fline (R___(_plotter)
(double)x0, (double)y0,
(double)x1, (double)y1);
}
int
_API_linedash (R___(Plotter *_plotter) int n, const int *dashes, int offset)
{
double *idashes;
int i, retval;
if (!_plotter->data->open)
{
_plotter->error (R___(_plotter)
"linedash: invalid operation");
return -1;
}
/* sanity checks */
if (n < 0 || (n > 0 && dashes == NULL))
return -1;
for (i = 0; i < n; i++)
if (dashes[i] < 0)
return -1;
idashes = (double *)_pl_xmalloc ((unsigned int)n * sizeof(double));
for (i = 0; i < n; i++)
idashes[i] = dashes[i];
retval = _API_flinedash (R___(_plotter)
n, idashes, (double)offset);
free (idashes);
return retval;
}
int
_API_linerel (R___(Plotter *_plotter) int dx0, int dy0, int dx1, int dy1)
{
return _API_flinerel (R___(_plotter)
(double)dx0, (double)dy0,
(double)dx1, (double)dy1);
}
int
_API_labelwidth (R___(Plotter *_plotter) const char *s)
{
double width = _API_flabelwidth (R___(_plotter) s);
return IROUND(width);
}
int
_API_linewidth (R___(Plotter *_plotter) int new_line_width)
{
return _API_flinewidth (R___(_plotter) (double)new_line_width);
}
int
_API_marker (R___(Plotter *_plotter) int x, int y, int type, int size)
{
return _API_fmarker (R___(_plotter)
(double)x, (double)y,
type, (double)size);
}
int
_API_markerrel (R___(Plotter *_plotter) int dx, int dy, int type, int size)
{
return _API_fmarkerrel (R___(_plotter)
(double)dx, (double)dy,
type, (double)size);
}
int
_API_move (R___(Plotter *_plotter) int x, int y)
{
return _API_fmove (R___(_plotter)
(double)x, (double)y);
}
int
_API_moverel (R___(Plotter *_plotter) int x, int y)
{
return _API_fmoverel (R___(_plotter)
(double)x, (double)y);
}
int
_API_point (R___(Plotter *_plotter) int x, int y)
{
return _API_fpoint (R___(_plotter)
(double)x, (double)y);
}
int
_API_pointrel (R___(Plotter *_plotter) int dx, int dy)
{
return _API_fpointrel (R___(_plotter)
(double)dx, (double)dy);
}
int
_API_space (R___(Plotter *_plotter) int x0, int y0, int x1, int y1)
{
return _API_fspace (R___(_plotter)
(double)x0, (double)y0,
(double)x1, (double)y1);
}
int
_API_space2 (R___(Plotter *_plotter) int x0, int y0, int x1, int y1, int x2, int y2)
{
return _API_fspace2 (R___(_plotter)
(double)x0, (double)y0,
(double)x1, (double)y1,
(double)x2, (double)y2);
}
int
_API_textangle (R___(Plotter *_plotter) int angle)
{
double new_size = _API_ftextangle (R___(_plotter)
(double)angle);
return IROUND(new_size);
}
|