1 /*
2  * Grace - Graphics for Exploratory Data Analysis
3  *
4  * Home page: http://plasma-gate.weizmann.ac.il/Grace/
5  *
6  * Copyright (c) 1991-95 Paul J Turner, Portland, OR
7  * Copyright (c) 1996-98 GRACE Development Team
8  *
9  * Maintained by Evgeny Stambulchik
10  *
11  *
12  *                           All Rights Reserved
13  *
14  *    This program is free software; you can redistribute it and/or modify
15  *    it under the terms of the GNU General Public License as published by
16  *    the Free Software Foundation; either version 2 of the License, or
17  *    (at your option) any later version.
18  *
19  *    This program is distributed in the hope that it will be useful,
20  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *    GNU General Public License for more details.
23  *
24  *    You should have received a copy of the GNU General Public License
25  *    along with this program; if not, write to the Free Software
26  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28 
29 #ifndef __PATTERNS_H_
30 #define __PATTERNS_H_
31 
32 static  unsigned char pat0_bits[] = {
33    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
36 static  unsigned char pat1_bits[] = {
37    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
38    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
39    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
40 static  unsigned char pat2_bits[] = {
41    0xee, 0xee, 0xff, 0xff, 0xbb, 0xbb, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff,
42    0xbb, 0xbb, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xbb, 0xbb, 0xff, 0xff,
43    0xee, 0xee, 0xff, 0xff, 0xbb, 0xbb, 0xff, 0xff};
44 static  unsigned char pat3_bits[] = {
45    0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb,
46    0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb,
47    0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb};
48 static  unsigned char pat4_bits[] = {
49    0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
50    0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
51    0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa};
52 static  unsigned char pat5_bits[] = {
53    0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
54    0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
55    0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44};
56 static  unsigned char pat6_bits[] = {
57    0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00,
58    0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
59    0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00};
60 static  unsigned char pat7_bits[] = {
61    0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
62    0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63    0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
64 static  unsigned char pat8_bits[] = {
65    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
68 static  unsigned char pat9_bits[] = {
69    0x1e, 0x1e, 0x0f, 0x0f, 0x87, 0x87, 0xc3, 0xc3, 0xe1, 0xe1, 0xf0, 0xf0,
70    0x78, 0x78, 0x3c, 0x3c, 0x1e, 0x1e, 0x0f, 0x0f, 0x87, 0x87, 0xc3, 0xc3,
71    0xe1, 0xe1, 0xf0, 0xf0, 0x78, 0x78, 0x3c, 0x3c};
72 static  unsigned char pat10_bits[] = {
73    0x78, 0x78, 0xf0, 0xf0, 0xe1, 0xe1, 0xc3, 0xc3, 0x87, 0x87, 0x0f, 0x0f,
74    0x1e, 0x1e, 0x3c, 0x3c, 0x78, 0x78, 0xf0, 0xf0, 0xe1, 0xe1, 0xc3, 0xc3,
75    0x87, 0x87, 0x0f, 0x0f, 0x1e, 0x1e, 0x3c, 0x3c};
76 static  unsigned char pat11_bits[] = {
77    0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
78    0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
79    0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33};
80 static  unsigned char pat12_bits[] = {
81    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
82    0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
83    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00};
84 static  unsigned char pat13_bits[] = {
85    0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24,
86    0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18,
87    0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81};
88 static  unsigned char pat14_bits[] = {
89    0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04,
90    0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10,
91    0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01};
92 static  unsigned char pat15_bits[] = {
93    0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20,
94    0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
95    0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80};
96 static unsigned char pat16_bits[] = {
97    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
98    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
99    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22};
100 static unsigned char pat17_bits[] = {
101    0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
102    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
103    0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00};
104 static unsigned char pat18_bits[] = {
105    0x22, 0x22, 0xff, 0xff, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0xff, 0xff,
106    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0xff, 0xff, 0x22, 0x22, 0x22, 0x22,
107    0x22, 0x22, 0xff, 0xff, 0x22, 0x22, 0x22, 0x22};
108 static unsigned char pat19_bits[] = {
109    0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff,
110    0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33,
111    0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33};
112 static unsigned char pat20_bits[] = {
113    0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0,
114    0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
115    0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0};
116 static unsigned char pat21_bits[] = {
117    0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00,
118    0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
119    0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff};
120 static unsigned char pat22_bits[] = {
121    0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
122    0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
123    0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};
124 static unsigned char pat23_bits[] = {
125    0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03,
126    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xc0, 0x03,
127    0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03};
128 static unsigned char pat24_bits[] = {
129    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xff, 0xff, 0x40, 0x40, 0x40, 0x40,
130    0x40, 0x40, 0xff, 0xff, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xff, 0xff,
131    0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xff, 0xff};
132 static unsigned char pat25_bits[] = {
133    0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
134    0xff, 0xff, 0xff, 0xff, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18,
135    0x00, 0x18, 0x00, 0x18, 0xff, 0xff, 0xff, 0xff};
136 static unsigned char pat26_bits[] = {
137    0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a, 0x11, 0x11, 0xa3, 0xa3,
138    0xc7, 0xc7, 0x8b, 0x8b, 0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a,
139    0x11, 0x11, 0xa3, 0xa3, 0xc7, 0xc7, 0x8b, 0x8b};
140 static unsigned char pat27_bits[] = {
141    0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0xc7, 0xc7, 0x01, 0x01, 0x01, 0x01,
142    0x82, 0x82, 0x7c, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0xc7, 0xc7,
143    0x01, 0x01, 0x01, 0x01, 0x82, 0x82, 0x7c, 0x7c};
144 static unsigned char pat28_bits[] = {
145    0x1c, 0x1c, 0x12, 0x12, 0x11, 0x11, 0x21, 0x21, 0xc1, 0xc1, 0x21, 0x21,
146    0x11, 0x11, 0x12, 0x12, 0x1c, 0x1c, 0x12, 0x12, 0x11, 0x11, 0x21, 0x21,
147    0xc1, 0xc1, 0x21, 0x21, 0x11, 0x11, 0x12, 0x12};
148 static unsigned char pat29_bits[] = {
149    0x3e, 0x3e, 0x41, 0x41, 0x80, 0x80, 0x80, 0x80, 0xe3, 0xe3, 0x14, 0x14,
150    0x08, 0x08, 0x08, 0x08, 0x3e, 0x3e, 0x41, 0x41, 0x80, 0x80, 0x80, 0x80,
151    0xe3, 0xe3, 0x14, 0x14, 0x08, 0x08, 0x08, 0x08};
152 static unsigned char pat30_bits[] = {
153    0x48, 0x48, 0x88, 0x88, 0x84, 0x84, 0x83, 0x83, 0x84, 0x84, 0x88, 0x88,
154    0x48, 0x48, 0x38, 0x38, 0x48, 0x48, 0x88, 0x88, 0x84, 0x84, 0x83, 0x83,
155    0x84, 0x84, 0x88, 0x88, 0x48, 0x48, 0x38, 0x38};
156 static unsigned char pat31_bits[] = {
157    0x03, 0x03, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x0c, 0x12, 0x12,
158    0x21, 0x21, 0xc0, 0xc0, 0x03, 0x03, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08,
159    0x0c, 0x0c, 0x12, 0x12, 0x21, 0x21, 0xc0, 0xc0};
160 
161 static unsigned char *pat_bits[MAXPATTERNS] = {
162     pat0_bits,
163     pat1_bits,
164     pat2_bits,
165     pat3_bits,
166     pat4_bits,
167     pat5_bits,
168     pat6_bits,
169     pat7_bits,
170     pat8_bits,
171     pat9_bits,
172     pat10_bits,
173     pat11_bits,
174     pat12_bits,
175     pat13_bits,
176     pat14_bits,
177     pat15_bits,
178     pat16_bits,
179     pat17_bits,
180     pat18_bits,
181     pat19_bits,
182     pat20_bits,
183     pat21_bits,
184     pat22_bits,
185     pat23_bits,
186     pat24_bits,
187     pat25_bits,
188     pat26_bits,
189     pat27_bits,
190     pat28_bits,
191     pat29_bits,
192     pat30_bits,
193     pat31_bits,
194 };
195 
196 
197 static char dash_array0[2] =
198 {0, 1};
199 static char dash_array1[2] =
200 {1, 0};
201 static char dash_array2[2] =
202 {1, 3};
203 static char dash_array3[2] =
204 {5, 3};
205 static char dash_array4[2] =
206 {7, 3};
207 static char dash_array5[4] =
208 {1, 3, 5, 3};
209 static char dash_array6[4] =
210 {1, 3, 7, 3};
211 static char dash_array7[6] =
212 {1, 3, 5, 3, 1, 3};
213 static char dash_array8[6] =
214 {5, 3, 1, 3, 5, 3};
215 
216 static char *dash_array[MAXLINESTYLES] =
217 {
218     dash_array0,
219     dash_array1,
220     dash_array2,
221     dash_array3,
222     dash_array4,
223     dash_array5,
224     dash_array6,
225     dash_array7,
226     dash_array8
227 };
228 
229 static int dash_array_length[] =
230 {2, 2, 2, 2, 2, 4, 4, 6, 6};
231 
232 #endif /* __PATTERNS_H_ */
233