123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- #include "sys-defines.h"
- #include "extern.h"
- int
- _API_fellipse (R___(Plotter *_plotter) double xc, double yc, double rx, double ry, double angle)
- {
- if (!_plotter->data->open)
- {
- _plotter->error (R___(_plotter)
- "fellipse: invalid operation");
- return -1;
- }
-
- if (_plotter->drawstate->path)
- _API_endpath (S___(_plotter));
- if (!_plotter->drawstate->points_are_connected)
-
- {
- }
- else
-
- {
- plPoint pc;
- bool clockwise;
-
- bool aligned_ellipse = false;
- int iangle = IROUND(angle);
-
- if (iangle < 0)
- iangle += (1 + (-iangle / 90)) * 90;
- if (iangle % 90 == 0 && angle == (double)iangle)
- aligned_ellipse = true;
-
-
- _plotter->drawstate->path = _new_plPath ();
-
- pc.x = xc;
- pc.y = yc;
- clockwise = _plotter->drawstate->orientation < 0 ? true : false;
- if ((_plotter->data->allowed_ellipse_scaling == AS_ANY)
- ||
- (_plotter->data->allowed_ellipse_scaling == AS_AXES_PRESERVED
- && _plotter->drawstate->transform.axes_preserved
- && aligned_ellipse))
-
- _add_ellipse (_plotter->drawstate->path,
- pc, rx, ry, angle, clockwise);
- else if (_plotter->data->allowed_ellarc_scaling == AS_ANY
- || (_plotter->data->allowed_ellarc_scaling == AS_AXES_PRESERVED
- && _plotter->drawstate->transform.axes_preserved
- && aligned_ellipse))
-
- _add_ellipse_as_ellarcs (_plotter->drawstate->path,
- pc, rx, ry, angle, clockwise);
- else if (_plotter->data->allowed_cubic_scaling == AS_ANY)
-
- _add_ellipse_as_bezier3s (_plotter->drawstate->path,
- pc, rx, ry, angle, clockwise);
- else
-
- _add_ellipse_as_lines (_plotter->drawstate->path,
- pc, rx, ry, angle, clockwise);
- if (_plotter->drawstate->path->type == PATH_SEGMENT_LIST)
-
- _plotter->maybe_prepaint_segments (R___(_plotter) 0);
- }
-
- _plotter->drawstate->pos.x = xc;
- _plotter->drawstate->pos.y = yc;
- return 0;
- }
|