123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #include "sys-defines.h"
- #include "extern.h"
- int
- _API_fbox (R___(Plotter *_plotter) double x0, double y0, double x1, double y1)
- {
- double xnew, ynew;
- plPoint p0, p1;
- bool clockwise;
- if (!_plotter->data->open)
- {
- _plotter->error (R___(_plotter)
- "fbox: invalid operation");
- return -1;
- }
-
- if (_plotter->drawstate->path)
- _API_endpath (S___(_plotter));
-
- _plotter->drawstate->path = _new_plPath ();
- p0.x = x0;
- p0.y = y0;
- p1.x = x1;
- p1.y = y1;
- clockwise = _plotter->drawstate->orientation < 0 ? true : false;
- if (!_plotter->drawstate->points_are_connected)
-
- _add_box_as_lines (_plotter->drawstate->path,
- p0, p1, clockwise);
- else
-
- {
-
- if ((_plotter->drawstate->pen_type == 0
- ||
- (_plotter->drawstate->dash_array_in_effect == false
- && _plotter->drawstate->line_type == PL_L_SOLID))
- &&
- ((_plotter->data->allowed_box_scaling == AS_ANY)
- ||
- (_plotter->data->allowed_box_scaling == AS_AXES_PRESERVED
- && _plotter->drawstate->transform.axes_preserved)))
-
- _add_box (_plotter->drawstate->path,
- p0, p1, clockwise);
- else
-
- _add_box_as_lines (_plotter->drawstate->path,
- p0, p1, clockwise);
- if (_plotter->drawstate->path->type == PATH_SEGMENT_LIST)
-
- _plotter->maybe_prepaint_segments (R___(_plotter) 0);
- }
-
-
- xnew = 0.5 * (x0 + x1);
- ynew = 0.5 * (y0 + y1);
- _plotter->drawstate->pos.x = xnew;
- _plotter->drawstate->pos.y = ynew;
- return 0;
- }
|