g_relative.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. /* This file contains the libplot methods that take floating-point relative
  16. coordinates as arguments. */
  17. #include "sys-defines.h"
  18. #include "extern.h"
  19. int
  20. _API_farcrel (R___(Plotter *_plotter) double dxc, double dyc, double dx0, double dy0, double dx1, double dy1)
  21. {
  22. return _API_farc (R___(_plotter)
  23. _plotter->drawstate->pos.x + dxc,
  24. _plotter->drawstate->pos.y + dyc,
  25. _plotter->drawstate->pos.x + dx0,
  26. _plotter->drawstate->pos.y + dy0,
  27. _plotter->drawstate->pos.x + dx1,
  28. _plotter->drawstate->pos.y + dy1);
  29. }
  30. int
  31. _API_fbezier2rel (R___(Plotter *_plotter) double dxc, double dyc, double dx0, double dy0, double dx1, double dy1)
  32. {
  33. return _API_fbezier2 (R___(_plotter)
  34. _plotter->drawstate->pos.x + dxc,
  35. _plotter->drawstate->pos.y + dyc,
  36. _plotter->drawstate->pos.x + dx0,
  37. _plotter->drawstate->pos.y + dy0,
  38. _plotter->drawstate->pos.x + dx1,
  39. _plotter->drawstate->pos.y + dy1);
  40. }
  41. int
  42. _API_fbezier3rel (R___(Plotter *_plotter) double dx0, double dy0, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
  43. {
  44. return _API_fbezier3 (R___(_plotter)
  45. _plotter->drawstate->pos.x + dx0,
  46. _plotter->drawstate->pos.y + dy0,
  47. _plotter->drawstate->pos.x + dx1,
  48. _plotter->drawstate->pos.y + dy1,
  49. _plotter->drawstate->pos.x + dx2,
  50. _plotter->drawstate->pos.y + dy2,
  51. _plotter->drawstate->pos.x + dx3,
  52. _plotter->drawstate->pos.y + dy3);
  53. }
  54. int
  55. _API_fellarcrel (R___(Plotter *_plotter) double dxc, double dyc, double dx0, double dy0, double dx1, double dy1)
  56. {
  57. return _API_fellarc (R___(_plotter)
  58. _plotter->drawstate->pos.x + dxc,
  59. _plotter->drawstate->pos.y + dyc,
  60. _plotter->drawstate->pos.x + dx0,
  61. _plotter->drawstate->pos.y + dy0,
  62. _plotter->drawstate->pos.x + dx1,
  63. _plotter->drawstate->pos.y + dy1);
  64. }
  65. int
  66. _API_fboxrel (R___(Plotter *_plotter) double dx0, double dy0, double dx1, double dy1)
  67. {
  68. return _API_fbox (R___(_plotter)
  69. _plotter->drawstate->pos.x + dx0,
  70. _plotter->drawstate->pos.y + dy0,
  71. _plotter->drawstate->pos.x + dx1,
  72. _plotter->drawstate->pos.y + dy1);
  73. }
  74. int
  75. _API_fcirclerel (R___(Plotter *_plotter) double dx, double dy, double r)
  76. {
  77. return _API_fcircle (R___(_plotter)
  78. _plotter->drawstate->pos.x + dx,
  79. _plotter->drawstate->pos.y + dy, r);
  80. }
  81. int
  82. _API_fellipserel (R___(Plotter *_plotter) double dx, double dy, double rx, double ry, double angle)
  83. {
  84. return _API_fellipse (R___(_plotter)
  85. _plotter->drawstate->pos.x + dx,
  86. _plotter->drawstate->pos.y + dy,
  87. rx, ry, angle);
  88. }
  89. int
  90. _API_fcontrel (R___(Plotter *_plotter) double dx, double dy)
  91. {
  92. return _API_fcont (R___(_plotter)
  93. _plotter->drawstate->pos.x + dx,
  94. _plotter->drawstate->pos.y + dy);
  95. }
  96. int
  97. _API_flinerel (R___(Plotter *_plotter) double dx0, double dy0, double dx1, double dy1)
  98. {
  99. return _API_fline (R___(_plotter)
  100. _plotter->drawstate->pos.x + dx0,
  101. _plotter->drawstate->pos.y + dy0,
  102. _plotter->drawstate->pos.x + dx1,
  103. _plotter->drawstate->pos.y + dy1);
  104. }
  105. int
  106. _API_fmarkerrel (R___(Plotter *_plotter) double dx, double dy, int type, double size)
  107. {
  108. return _API_fmarker (R___(_plotter)
  109. _plotter->drawstate->pos.x + dx,
  110. _plotter->drawstate->pos.y + dy,
  111. type, size);
  112. }
  113. int
  114. _API_fmoverel (R___(Plotter *_plotter) double x, double y)
  115. {
  116. return _API_fmove (R___(_plotter)
  117. _plotter->drawstate->pos.x + x,
  118. _plotter->drawstate->pos.y + y);
  119. }
  120. int
  121. _API_fpointrel (R___(Plotter *_plotter) double dx, double dy)
  122. {
  123. return _API_fpoint (R___(_plotter)
  124. _plotter->drawstate->pos.x + dx,
  125. _plotter->drawstate->pos.y + dy);
  126. }