File: g_defstate.c

package info (click to toggle)
plotutils 2.4.1-15
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 11,072 kB
  • ctags: 6,952
  • sloc: ansic: 76,305; cpp: 12,402; sh: 8,475; yacc: 2,604; makefile: 894; lex: 144
file content (163 lines) | stat: -rw-r--r-- 7,955 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* Initialization for the first drawing state on the stack of drawing
   states maintained by any Plotter.  Its components include drawing
   attributes, and the state of any uncompleted path object.  (At
   initialization, there is none.) */
   
/* This is copied to the first state on the stack, in g_savestate.c.  The
   four fields, `font_name', `font_type', `typeface_index', and
   `font_index' are special: they are filled in at that time, since they
   are Plotter-dependent.  So the values for them below (respectively
   "HersheySerif", F_HERSHEY, 0, and 1) are really dummies. */

/* Two other fields (font size and line width in user coordinates) play an
   important role at later times, e.g. a bad font size resets the font size
   to the default.  For that reason, those variables are filled in when
   space() or fsetmatrix() is called (see g_concat.c).  They are computed
   using the two quantities DEFAULT_FONT_SIZE_AS_FRACTION_OF_DISPLAY_SIZE
   and DEFAULT_LINE_WIDTH_AS_FRACTION_OF_DISPLAY_SIZE (defined in
   extern.h). */

#include "sys-defines.h"
#include "extern.h"

/* save keystrokes */
#define DFSAFODS DEFAULT_FONT_SIZE_AS_FRACTION_OF_DISPLAY_SIZE
#define DLWAFODS DEFAULT_LINE_WIDTH_AS_FRACTION_OF_DISPLAY_SIZE

const plDrawState _default_drawstate = {

/***************** DEVICE-INDEPENDENT PART **************************/

/* graphics cursor position */
  {0.0, 0.0},			/* cursor position, in user coordinates */

/* affine transformation from user coordinates to normalized device
   coordinates, and affine transformation to actual device coordinates
   (derived from it) */
  {
    {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}, /* user->NDC transformation matrix */
    {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}, /* user->device transformation [dummy] */
    true,			/* transf. scaling is uniform? [dummy] */
    true,			/* transf. preserves axis dirs? [dummy] */
    true			/* transf. doesn't reflect? [dummy] */
  },

/* the compound path being drawn, if any */
  (plPath *)NULL,		/* simple path being drawn */
  (plPath **)NULL,		/* previously drawn simple paths */
  0,				/* number of previously drawn simple paths */
  {0.0, 0.0},			/* starting point (used by closepath()) */

/* modal drawing attributes */
  /* 1. path-related attributes */
  "even-odd",			/* fill mode ["even-odd" / "nonzero-winding"]*/
  FILL_ODD_WINDING,		/* fill type, one of FILL_*, det'd by mode */
  "solid",			/* line mode [must be valid] */
  L_SOLID,			/* line type, one of L_*, det'd by line mode */
  true,				/* if not set, paths are "disconnected" */
  "butt",			/* cap mode [must be valid] */
  CAP_BUTT,			/* cap type, one of CAP_*, det'd by cap mode */
  "miter",			/* join mode [must be valid] */
  JOIN_MITER,			/* join type, one of JOIN_*, det'd by mode */
  DEFAULT_MITER_LIMIT,		/* miter limit for line joins */
  DLWAFODS,			/* line width in user coors [set by space()] */
  true,				/* line width is (Plotter-specific) default? */
  1.0,				/* line width in device coordinates ["] */
  1,				/* line width, quantized to integer ["] */
  (double *)NULL,		/* array of dash on/off lengths */
  0,				/* length of same */
  0.0,				/* offset distance into dash array (`phase') */
  false,			/* dash array should override line mode? */
  1,				/* pen type (0 = none, 1 = present) */
  0,				/* fill type (0 = none, 1 = present,...) */
  1,				/* orientation of circles etc.(1=c'clockwise)*/
  /* 2. text-related attributes */
  "HersheySerif",		/* font name [dummy, see g_openpl.c] */
  DFSAFODS,			/* font size in user coordinates [dummy] */
  true,				/* font size is (Plotter-specific) default? */
  0.0,				/* degrees counterclockwise, for labels */
  "HersheySerif",		/* true font name [dummy] */
  0.0,				/* true font size in user coordinates (") */  
  0.0,				/* font ascent in user coordinates (") */
  0.0,				/* font descent in user coordinates (") */
  0.0,				/* font capital height in user coors (") */
  F_HERSHEY,			/* font type [dummy] */
  0,				/* typeface index (in fontdb.h typeface table; this is Hershey Serif typeface) [dummy] */
  1,				/* font index (within typeface; this is Roman variant of Hershey Serif typeface) [dummy] */
  true,				/* true means an ISO-Latin-1 font ["] */
  /* 3. color attributes (fgcolor and fillcolor are path-related; fgcolor
     affects other primitives too) */
  {0, 0, 0},			/* fg color, i.e., pen color (= black) */
  {0, 0, 0},			/* base fill color (= black) */
  {0, 0, 0},			/* true fill color (= black) */
  {65535, 65535, 65535},	/* background color for display (= white) */
  false,			/* no actual background color? */

/* Default values for certain modal attributes, used when an out-of-range
   value is requested. (These two are special because unlike all others,
   they're set by the initial call to space() or fsetmatrix(), which also
   sets the line width and font size fields above. Incidentally, space()
   and setmatrix() also invoke linewidth().) */
  0.0,				/* default line width in user coordinates */
  0.0,				/* default font size in user coordinates */

/****************** DEVICE-DEPENDENT PART ***************************/

/* elements specific to the HP-GL drawing state [DUMMY] */
  0.001,			/* pen width (frac of diag dist betw P1,P2) */
/* elements specific to the Fig drawing state [DUMMIES] */
  16,				/* font size in fig's idea of points */
  -1,				/* fig's fill level (-1 = transparent) */
  C_BLACK,			/* fig's fg color (0=black, see colordb2.c) */
  C_BLACK,			/* fig's fill color (see list in colordb2.c) */
/* elements specific to the PS drawing state [DUMMIES] */
  0.0,				/* RGB for PS fg color (floats) */
  0.0,
  0.0,
  1.0,				/* RGB for PS fill color (floats) */
  1.0,
  1.0,
  0,				/* idraw fg color (0=black, 9=white) */
  9,				/* idraw bg color (0=black, 9=white) */
  0,				/* shading (0=fg, 4=bg), if not transparent */
/* elements specific to the GIF drawing state [all save last 3 are DUMMIES] */
  {0, 0, 0},			/* 24-bit RGB of pixel for drawing (= black) */
  {0, 0, 0},			/* 24-bit RGB of pixel for filling (= black) */
  {255, 255, 255},		/* 24-bit RGB of pixel for erasing (= white) */
  (unsigned char)0,		/* drawing color index [dummy] */
  (unsigned char)0,		/* filling color index [dummy] */
  (unsigned char)0,		/* erasing color index [dummy] */
  false,			/* drawing color index is genuine? */
  false,			/* filling color index is genuine? */
  false,			/* erasing color index is genuine? */
#ifndef X_DISPLAY_MISSING
/* elements spec. to X11, X11 Drawable drawingstates [nearly all: DUMMY] */
  {14.0, 0.0, 0.0, 14.0},	/* pixel matrix, parsed from font name */
  true,				/* if set, can use XDrawString() etc. */
  (XFontStruct *)NULL,		/* font structure (used in x_alab_X.c) */
  (const unsigned char *)NULL,	/* label (hint to font retrieval routine) */
  (GC)NULL,			/* graphics context, for drawing */
  (GC)NULL,			/* graphics context, for filling */
  (GC)NULL,			/* graphics context, for erasing */
  {0, 0, 0},			/* pen color stored in GC (= black) */
  {0, 0, 0},			/* fill color stored in GC (= black) */
  {65535, 65535, 65535},	/* bg color stored in GC (= white) */
  (unsigned long)0,		/* drawing pixel [dummy] */
  (unsigned long)0,		/* filling pixel [dummy] */
  (unsigned long)0,		/* erasing pixel [dummy] */
  false,			/* drawing pixel is genuine? */
  false,			/* filling pixel is genuine? */
  false,			/* erasing pixel is genuine? */
  LineSolid,			/* line style stored in drawing GC */
  CapButt,			/* cap style stored in drawing GC */
  JoinMiter,			/* join style stored in drawing GC */
  0,				/* line width stored in drawing GC */
  (char *)NULL,			/* dash list stored in drawing GC */
  0,				/* length of dash list stored in drawing GC */
  0,				/* offset into dash sequence, in drawing GC */
  EvenOddRule,			/* fill rule stored in filling GC */
#endif /* X_DISPLAY_MISSING */

/* pointer to previous drawing state */
  (plDrawState *)NULL		/* pointer to previous state [must be null] */
};