f_point.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* This file is part of the GNU plotutils package. Copyright (C) 1995,
  2. 1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.
  3. The GNU plotutils package is free software. You may redistribute it
  4. and/or modify it under the terms of the GNU General Public License as
  5. published by the Free Software foundation; either version 2, or (at your
  6. option) any later version.
  7. The GNU plotutils package is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. You should have received a copy of the GNU General Public License along
  12. with the GNU plotutils package; see the file COPYING. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
  14. Boston, MA 02110-1301, USA. */
  15. /* The internal point-drawing function, which point() is a wrapper around.
  16. It draws a point at the current location. There is no standard
  17. definition of `point', so any Plotter is free to implement this as it
  18. sees fit. */
  19. /* So far as a FigPlotter objects goes, a point is a single-vertex polyline
  20. (that is the only sort of point that xfig supports). */
  21. #include "sys-defines.h"
  22. #include "extern.h"
  23. /* xfig polyline subtypes */
  24. #define P_OPEN 1
  25. #define P_BOX 2
  26. #define P_CLOSED 3
  27. void
  28. _pl_f_paint_point (S___(Plotter *_plotter))
  29. {
  30. double x, y;
  31. if (_plotter->drawstate->pen_type != 0)
  32. /* have a pen to draw with */
  33. {
  34. /* evaluate fig colors lazily, i.e. only when needed */
  35. _pl_f_set_pen_color (S___(_plotter));
  36. _pl_f_set_fill_color (S___(_plotter));
  37. /* update xfig's `depth' attribute */
  38. if (_plotter->fig_drawing_depth > 0)
  39. (_plotter->fig_drawing_depth)--;
  40. /* get location */
  41. x = _plotter->drawstate->pos.x;
  42. y = _plotter->drawstate->pos.x;
  43. sprintf(_plotter->data->page->point,
  44. "#POLYLINE [OPEN]\n%d %d %d %d %d %d %d %d %d %.3f %d %d %d %d %d %d\n\t%d %d\n",
  45. 2, /* polyline object */
  46. P_OPEN, /* polyline subtype */
  47. FIG_L_SOLID, /* style */
  48. 1, /* thickness, in Fig display units */
  49. _plotter->drawstate->fig_fgcolor, /* pen color */
  50. _plotter->drawstate->fig_fgcolor, /* fill color */
  51. _plotter->fig_drawing_depth, /* depth */
  52. 0, /* pen style, ignored */
  53. 20, /* fig fill level (20 = full intensity) */
  54. 0.0, /* style val, ignored (?) */
  55. FIG_JOIN_ROUND, /* join style = round */
  56. FIG_CAP_ROUND, /* cap style = round */
  57. 0, /* radius (of arc boxes, ignored) */
  58. 0, /* forward arrow */
  59. 0, /* backward arrow */
  60. 1, /* number of points in polyline */
  61. IROUND(XD(x,y)),
  62. IROUND(YD(x,y))
  63. );
  64. _update_buffer (_plotter->data->page);
  65. }
  66. }