home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / yahp2ps / part03 / penctrl.h < prev    next >
C/C++ Source or Header  |  1989-02-03  |  6KB  |  239 lines

  1. /*
  2.         HPGL to PostScript converter
  3.    Copyright (C) 1988 (and following) Federico Heinz
  4.  
  5. yahp2ps is distributed in the hope that it will be useful, but WITHOUT ANY
  6. WARRANTY.  No author or distributor accepts responsibility to anyone
  7. for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.
  9. Refer to the Free Software Foundation's General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute yahp2ps,
  12. but only under the conditions described in the GNU General Public
  13. License.  A copy of this license is supposed to have been given to you
  14. along with yahp2ps so you can know your rights and responsibilities.  It
  15. should be in a file named COPYING.  Among other things, the copyright
  16. notice and this notice must be preserved on all copies.
  17.  
  18. In other words, go ahead and share yahp2ps, but don't try to stop
  19. anyone else from sharing it farther.  Help stamp out software hoarding!
  20.  
  21. yahp2ps is TOTALLY unrelated to GNU or the Free Software Foundation,
  22. it is only released under the same conditions.
  23.  
  24.     For bug reports, wishes, etc. send e-mail to
  25.  
  26.     ...!mcvax!unido!tub!actisb!federico  (from Europe)
  27.     ...!uunet!pyramid!actisb!federico    (from anywhere else)
  28.  
  29.     For Physical mail:
  30.  
  31.     Federico Heinz
  32.     Beusselstr. 21
  33.     1000 Berlin 21
  34.  
  35.     Tel. (+49 30) 396 77 92
  36.  
  37. */
  38. /**************************************************************************
  39.  
  40.    Ideal interface to the graphics hardware.
  41.  
  42. **************************************************************************/
  43.  
  44. /* Paper sizes */
  45.  
  46. #define A    0
  47. #define A4    1
  48. #define B    2
  49. #define A3    3
  50.  
  51. /* Constants for A paper */
  52.  
  53. #define MaxXA        103650000L
  54. #define MaxYA         79620000L
  55.  
  56. #define InitialP1XA        2500000L
  57. #define InitialP1YA        5960000L
  58. #define InitialP2XA      102500000L
  59. #define InitialP2YA       77960000L
  60.  
  61. #define InitialP1XAR       1540000L
  62. #define InitialP1YAR       2440000L
  63. #define InitialP2XAR      73540000L
  64. #define InitialP2YAR     102440000L
  65.  
  66.  
  67. /* Constants for DIN A4 paper (Default) */
  68.  
  69. #define MaxXA4          110400000L
  70. #define MaxYA4           77210000L
  71.  
  72. #define InitialP1XA4        6030000L
  73. #define InitialP1YA4        5210000L
  74. #define InitialP2XA4      106030000L
  75. #define InitialP2YA4       77210000L
  76.  
  77. #define InitialP1XA4R         00000L
  78. #define InitialP1YA4R       6100000L
  79. #define InitialP2XA4R      72000000L
  80. #define InitialP2YA4R     106100000L
  81.  
  82.  
  83. /* Constants for B paper */
  84.  
  85. #define MaxXB        166400000L
  86. #define MaxYB        103650000L
  87.  
  88. #define InitialP1XB         5220000L
  89. #define InitialP1YB         2590000L
  90. #define InitialP2XB       157220000L
  91. #define InitialP2YB       102590000L
  92.  
  93. #define InitialP1XBR        2830000L
  94. #define InitialP1YBR        9340000L
  95. #define InitialP2XBR      102830000L
  96. #define InitialP2YBR      161340000L
  97.  
  98.  
  99. /* Constants for A3 paper */
  100.  
  101. #define MaxXA3        161580000L
  102. #define MaxYA3        110400000L
  103.  
  104. #define InitialP1XA3        1700000L
  105. #define InitialP1YA3        6020000L
  106. #define InitialP2XA3      153700000L
  107. #define InitialP2YA3      106020000L
  108.  
  109. #define InitialP1XA3R       6070000L
  110. #define InitialP1YA3R       7970000L
  111. #define InitialP2XA3R     106070000L
  112. #define InitialP2YA3R     159970000L
  113.  
  114.  
  115. #define MaxPen    60000L
  116.  
  117. #define FullLine 70000L
  118. #define DefaultPatternLength 40000L
  119.  
  120.  
  121. extern CoordinatePair PenPosition;          /* Current pen coordinates      */
  122. extern CoordinatePair PlotterP1, PlotterP2; /* Pn's coords in Plotter Space */
  123. extern Number P1P2Diagonal;            /* Distance between P1 and P2   */
  124.  
  125. extern Boolean PenIsUp;         /* Is the plotting pen up?                  */
  126. extern Boolean UserMode;    /* Are we plotting in user coordinates?     */
  127.  
  128.  
  129. /*
  130.  
  131.   Convert from user to plotter coordinates
  132.  
  133. */
  134.  
  135. #define PlotterUnitsFactor 40
  136.  
  137. #define plotterXUnits(x) (UserMode ? \
  138.                            trunc(mulNum(XScaleFactor, (x))) : \
  139.                            trunc(x))
  140. #define plotterYUnits(x) (UserMode ? \
  141.                            trunc(mulNum(YScaleFactor, (x))) : \
  142.                            trunc(x))
  143.  
  144. #define plotterXCoord(x) (UserMode ? \
  145.                            (trunc(mulNum(XScaleFactor, (x))) + XOrigin) : \
  146.                            trunc(x))
  147. #define plotterYCoord(x) (UserMode ? \
  148.                            (trunc(mulNum(YScaleFactor, (x))) + YOrigin) : \
  149.                            trunc(x))
  150.  
  151.  
  152. extern Number XScaleFactor, YScaleFactor;
  153. extern Number XOrigin, YOrigin;
  154.  
  155.  
  156. /* Change the location of the scaling points */
  157.  
  158. extern void changeP1P2();
  159.  
  160.  
  161.  
  162. /* Reset P1 and P2 to default values */
  163.  
  164. extern void resetP1P2();
  165.  
  166.  
  167. /* Set the window to the whole plotting area */
  168.  
  169. extern void resetWindow();
  170.  
  171.  
  172. /* Set the window to a new value */
  173.  
  174. extern void setWindow();
  175.  
  176.  
  177. /* Reset the the pen control status to default values */
  178.  
  179. extern void penctrlInit();
  180.  
  181.  
  182. /* Set the scaling parameters to reflex the current status */
  183.  
  184. extern void updateScaling();
  185.  
  186.  
  187. /* Quit scaling coordinates */
  188.  
  189. extern void turnScalingOff();
  190.  
  191.  
  192.  
  193. /* From now on, everything will be scaled */
  194.  
  195. extern void turnScalingOn();
  196.  
  197.  
  198.  
  199. /* Rotate the coordinate system */
  200.  
  201. extern void rotate();
  202.  
  203.  
  204.  
  205. /* Return coordinate system to default orientation */
  206.  
  207. extern void unRotate();
  208.  
  209.  
  210.  
  211. /* Moves the pen in it's current state to the absolute coordinates
  212.    indicated in User Space */
  213.  
  214. extern void doLine();
  215.  
  216.  
  217.  
  218. /* Raises the plotting pen */
  219.  
  220. extern void liftPen();
  221.  
  222.  
  223.  
  224. /* Puts plotting pen in contact with the paper */
  225.  
  226. extern void lowerPen();
  227.  
  228.  
  229.  
  230. /* Get a new pen */
  231.  
  232. extern void changePen();
  233.  
  234.  
  235.  
  236. /* Change the line pattern */
  237.  
  238. extern void setDash();
  239.