g_defstate.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. /* Initialization for the first drawing state on the stack of drawing
  16. states maintained by any Plotter. Its components include drawing
  17. attributes, and the state of any uncompleted path object. (At
  18. initialization, there is none.) */
  19. /* This is copied to the first state on the stack, in g_savestate.c. The
  20. four fields, `font_name', `font_type', `typeface_index', and
  21. `font_index' are special: they are filled in at that time, since they
  22. are Plotter-dependent. So the values for them below (respectively
  23. "HersheySerif", PL_F_HERSHEY, 0, and 1) are really dummies. */
  24. /* Two other fields (font size and line width in user coordinates) play an
  25. important role at later times, e.g. a bad font size resets the font size
  26. to the default. For that reason, those variables are filled in when
  27. space() or fsetmatrix() is called (see g_concat.c). They are computed
  28. using the two quantities PL_DEFAULT_FONT_SIZE_AS_FRACTION_OF_DISPLAY_SIZE
  29. and PL_DEFAULT_LINE_WIDTH_AS_FRACTION_OF_DISPLAY_SIZE (defined in
  30. extern.h). */
  31. #include "sys-defines.h"
  32. #include "extern.h"
  33. /* save keystrokes */
  34. #define DFSAFODS PL_DEFAULT_FONT_SIZE_AS_FRACTION_OF_DISPLAY_SIZE
  35. #define DLWAFODS PL_DEFAULT_LINE_WIDTH_AS_FRACTION_OF_DISPLAY_SIZE
  36. const plDrawState _default_drawstate = {
  37. /***************** DEVICE-INDEPENDENT PART **************************/
  38. /* graphics cursor position */
  39. {0.0, 0.0}, /* cursor position, in user coordinates */
  40. /* affine transformation from user coordinates to normalized device
  41. coordinates, and affine transformation to actual device coordinates
  42. (derived from it) */
  43. {
  44. {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}, /* user->NDC transformation matrix */
  45. {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}, /* user->device transformation [dummy] */
  46. true, /* transf. scaling is uniform? [dummy] */
  47. true, /* transf. preserves axis dirs? [dummy] */
  48. true /* transf. doesn't reflect? [dummy] */
  49. },
  50. /* the compound path being drawn, if any */
  51. (plPath *)NULL, /* simple path being drawn */
  52. (plPath **)NULL, /* previously drawn simple paths */
  53. 0, /* number of previously drawn simple paths */
  54. {0.0, 0.0}, /* starting point (used by closepath()) */
  55. /* modal drawing attributes */
  56. /* 1. path-related attributes */
  57. "even-odd", /* fill mode ["even-odd" / "nonzero-winding"]*/
  58. PL_FILL_ODD_WINDING, /* fill type, one of PL_FILL_*, det'd by mode */
  59. "solid", /* line mode [must be valid] */
  60. PL_L_SOLID, /* line type, one of L_*, det'd by line mode */
  61. true, /* if not set, paths are "disconnected" */
  62. "butt", /* cap mode [must be valid] */
  63. PL_CAP_BUTT, /* cap type, one of PL_CAP_*, det'd by cap mode */
  64. "miter", /* join mode [must be valid] */
  65. PL_JOIN_MITER, /* join type, one of PL_JOIN_*, det'd by mode */
  66. PL_DEFAULT_MITER_LIMIT, /* miter limit for line joins */
  67. DLWAFODS, /* line width in user coors [set by space()] */
  68. true, /* line width is (Plotter-specific) default? */
  69. 1.0, /* line width in device coordinates ["] */
  70. 1, /* line width, quantized to integer ["] */
  71. (double *)NULL, /* array of dash on/off lengths */
  72. 0, /* length of same */
  73. 0.0, /* offset distance into dash array (`phase') */
  74. false, /* dash array should override line mode? */
  75. 1, /* pen type (0 = none, 1 = present) */
  76. 0, /* fill type (0 = none, 1 = present,...) */
  77. 1, /* orientation of circles etc.(1=c'clockwise)*/
  78. /* 2. text-related attributes */
  79. "HersheySerif", /* font name [dummy, see g_openpl.c] */
  80. DFSAFODS, /* font size in user coordinates [dummy] */
  81. true, /* font size is (Plotter-specific) default? */
  82. 0.0, /* degrees counterclockwise, for labels */
  83. "HersheySerif", /* true font name [dummy] */
  84. 0.0, /* true font size in user coordinates (") */
  85. 0.0, /* font ascent in user coordinates (") */
  86. 0.0, /* font descent in user coordinates (") */
  87. 0.0, /* font capital height in user coors (") */
  88. PL_F_HERSHEY, /* font type [dummy] */
  89. 0, /* typeface index (in fontdb.h typeface table; this is Hershey Serif typeface) [dummy] */
  90. 1, /* font index (within typeface; this is Roman variant of Hershey Serif typeface) [dummy] */
  91. true, /* true means an ISO-Latin-1 font ["] */
  92. /* 3. color attributes (fgcolor and fillcolor are path-related; fgcolor
  93. affects other primitives too) */
  94. {0, 0, 0}, /* fg color, i.e., pen color (= black) */
  95. {0, 0, 0}, /* base fill color (= black) */
  96. {0, 0, 0}, /* true fill color (= black) */
  97. {65535, 65535, 65535}, /* background color for display (= white) */
  98. false, /* no actual background color? */
  99. /* Default values for certain modal attributes, used when an out-of-range
  100. value is requested. (These two are special because unlike all others,
  101. they're set by the initial call to space() or fsetmatrix(), which also
  102. sets the line width and font size fields above. Incidentally, space()
  103. and setmatrix() also invoke linewidth().) */
  104. 0.0, /* default line width in user coordinates */
  105. 0.0, /* default font size in user coordinates */
  106. /****************** DEVICE-DEPENDENT PART ***************************/
  107. /* elements specific to the HP-GL drawing state [DUMMY] */
  108. 0.001, /* pen width (frac of diag dist betw P1,P2) */
  109. /* elements specific to the Fig drawing state [DUMMIES] */
  110. 16, /* font size in fig's idea of points */
  111. -1, /* fig's fill level (-1 = transparent) */
  112. FIG_C_BLACK, /* fig's fg color (0=black) */
  113. FIG_C_BLACK, /* fig's fill color */
  114. /* elements specific to the PS drawing state [DUMMIES] */
  115. 0.0, /* RGB for PS fg color (floats) */
  116. 0.0,
  117. 0.0,
  118. 1.0, /* RGB for PS fill color (floats) */
  119. 1.0,
  120. 1.0,
  121. 0, /* idraw fg color (0=black, 9=white) */
  122. 9, /* idraw bg color (0=black, 9=white) */
  123. 0, /* shading (0=fg, 4=bg), if not transparent */
  124. /* elements specific to the GIF drawing state [all save last 3 are DUMMIES] */
  125. {0, 0, 0}, /* 24-bit RGB of pixel for drawing (= black) */
  126. {0, 0, 0}, /* 24-bit RGB of pixel for filling (= black) */
  127. {255, 255, 255}, /* 24-bit RGB of pixel for erasing (= white) */
  128. (unsigned char)0, /* drawing color index [dummy] */
  129. (unsigned char)0, /* filling color index [dummy] */
  130. (unsigned char)0, /* erasing color index [dummy] */
  131. false, /* drawing color index is genuine? */
  132. false, /* filling color index is genuine? */
  133. false, /* erasing color index is genuine? */
  134. #ifndef X_DISPLAY_MISSING
  135. /* elements spec. to X11, X11 Drawable drawingstates [nearly all: DUMMY] */
  136. 14, /* font pixel size */
  137. (XFontStruct *)NULL, /* font structure (used in x_alab_X.c) */
  138. (const unsigned char *)NULL, /* label (hint to font retrieval routine) */
  139. (GC)NULL, /* graphics context, for drawing */
  140. (GC)NULL, /* graphics context, for filling */
  141. (GC)NULL, /* graphics context, for erasing */
  142. {0, 0, 0}, /* pen color stored in GC (= black) */
  143. {0, 0, 0}, /* fill color stored in GC (= black) */
  144. {65535, 65535, 65535}, /* bg color stored in GC (= white) */
  145. (unsigned long)0, /* drawing pixel [dummy] */
  146. (unsigned long)0, /* filling pixel [dummy] */
  147. (unsigned long)0, /* erasing pixel [dummy] */
  148. false, /* drawing pixel is genuine? */
  149. false, /* filling pixel is genuine? */
  150. false, /* erasing pixel is genuine? */
  151. LineSolid, /* line style stored in drawing GC */
  152. CapButt, /* cap style stored in drawing GC */
  153. JoinMiter, /* join style stored in drawing GC */
  154. 0, /* line width stored in drawing GC */
  155. (char *)NULL, /* dash list stored in drawing GC */
  156. 0, /* length of dash list stored in drawing GC */
  157. 0, /* offset into dash sequence, in drawing GC */
  158. EvenOddRule, /* fill rule stored in filling GC */
  159. #endif /* X_DISPLAY_MISSING */
  160. /* pointer to previous drawing state */
  161. (plDrawState *)NULL /* pointer to previous state [must be null] */
  162. };