1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % PPPP AAA TTTTT TTTTT EEEEE RRRR N N %
7 % P P A A T T E R R NN N %
8 % PPPP AAAAA T T EEE RRRR N N N %
9 % P A A T T E R R N NN %
10 % P A A T T EEEEE R R N N %
11 % %
12 % %
13 % Read/Write Pattern Image Format %
14 % %
15 % Software Design %
16 % Cristy %
17 % May 2003 %
18 % %
19 % %
20 % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
22 % %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
25 % %
26 % https://imagemagick.org/script/license.php %
27 % %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
33 % %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38
39 /*
40 Include declarations.
41 */
42 #include "MagickCore/studio.h"
43 #include "MagickCore/blob.h"
44 #include "MagickCore/blob-private.h"
45 #include "MagickCore/exception.h"
46 #include "MagickCore/exception-private.h"
47 #include "MagickCore/image.h"
48 #include "MagickCore/image-private.h"
49 #include "MagickCore/list.h"
50 #include "MagickCore/magick.h"
51 #include "MagickCore/memory_.h"
52 #include "MagickCore/quantum-private.h"
53 #include "MagickCore/static.h"
54 #include "MagickCore/string_.h"
55 #include "MagickCore/module.h"
56
57 /*
58 Bricks pattern.
59 */
60 static const unsigned char
61 BricksImage[] =
62 {
63 0x50, 0x34, 0x0A, 0x31, 0x36, 0x20, 0x31, 0x36, 0x0A, 0x00, 0x01, 0x00,
64 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xFF,
65 0xFF, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
66 0x00, 0x01, 0x00, 0xFF, 0xFF
67 };
68
69 /*
70 Checkerboard pattern.
71 */
72 static const unsigned char
73 CheckerboardImage[]=
74 {
75 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x1E, 0x00, 0x1E, 0x00, 0xF0, 0x01,
76 0x00, 0x66, 0x66, 0x66, 0x99, 0x99, 0x99, 0x21, 0xF9, 0x04, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x1E, 0x00,
78 0x00, 0x02, 0x42, 0x8C, 0x8F, 0x09, 0xCB, 0xED, 0x09, 0x91, 0x9B, 0x2D,
79 0x5A, 0x8A, 0x6D, 0xC4, 0x54, 0x43, 0x3E, 0x79, 0x0A, 0x58, 0x89, 0x07,
80 0x59, 0x9A, 0x01, 0xCA, 0xA8, 0x06, 0xBB, 0xB8, 0x2B, 0x2C, 0xC3, 0x40,
81 0x4D, 0xBB, 0x36, 0xCE, 0xF2, 0x36, 0xEA, 0x23, 0x05, 0x41, 0x43, 0x4E,
82 0x31, 0xA3, 0xCB, 0xA9, 0x76, 0xC9, 0x5E, 0x13, 0xF8, 0x14, 0x46, 0x89,
83 0x53, 0x63, 0x15, 0xB9, 0x54, 0x9A, 0x98, 0xAA, 0x02, 0x00, 0x3B
84 };
85
86 /*
87 Circles pattern.
88 */
89 static const unsigned char
90 CirclesImage[] =
91 {
92 0x50, 0x34, 0x0A, 0x31, 0x36, 0x20, 0x31, 0x36, 0x0A, 0x07, 0xF0, 0x18,
93 0x0C, 0x20, 0x02, 0x40, 0x01, 0x40, 0x01, 0x80, 0x00, 0x80, 0x00, 0x80,
94 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x40, 0x01, 0x40,
95 0x01, 0x20, 0x02, 0x18, 0x0C
96 };
97
98 /*
99 CrossHatch pattern.
100 */
101 static const unsigned char
102 CrossHatchImage[] =
103 {
104 0x50, 0x34, 0x0A, 0x38, 0x20, 0x34, 0x0A, 0xFF, 0x11, 0x11, 0x11
105 };
106
107 /*
108 CrossHatch30 pattern.
109 */
110 static const unsigned char
111 CrossHatch30Image[] =
112 {
113 0x50, 0x34, 0x0A, 0x38, 0x20, 0x34, 0x0A, 0x81, 0x66, 0x18, 0x66
114 };
115
116 /*
117 CrossHatch45 pattern.
118 */
119 static const unsigned char
120 CrossHatch45Image[] =
121 {
122 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x88, 0x50, 0x20, 0x50, 0x88,
123 0x05, 0x02, 0x05
124 };
125
126 /*
127 FishScales pattern.
128 */
129 static const unsigned char
130 FishScalesImage[] =
131 {
132 0x50, 0x34, 0x0A, 0x31, 0x36, 0x20, 0x38, 0x0A, 0x02, 0x40, 0x0C, 0x30,
133 0x70, 0x0E, 0x80, 0x01, 0x40, 0x02, 0x30, 0x0C, 0x0E, 0x70, 0x01, 0x80
134 };
135
136 /*
137 Gray100 pattern.
138 */
139 static const unsigned char
140 Gray100Image[] =
141 {
142 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
153 0x00, 0x00, 0x00, 0x00, 0x00
154 };
155
156 /*
157 Gray95 pattern.
158 */
159 static const unsigned char
160 Gray95Image[] =
161 {
162 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11,
164 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
168 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 0x00, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11,
172 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
173 0x00, 0x10, 0x10, 0x10, 0x10
174 };
175
176 /*
177 Gray90 pattern.
178 */
179 static const unsigned char
180 Gray90Image[] =
181 {
182 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x08, 0x08, 0x08,
183 0x08, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00,
184 0x00, 0x80, 0x88, 0x80, 0x88, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22,
185 0x22, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
186 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
187 0x80, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00,
188 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22,
189 0x22, 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0x80, 0x88, 0x00, 0x00, 0x00,
190 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08,
191 0x08, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00,
192 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22,
193 0x22, 0x00, 0x00, 0x00, 0x00
194 };
195
196 /*
197 Gray85 pattern.
198 */
199 static const unsigned char
200 Gray85Image[] =
201 {
202 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x00, 0x00, 0x00,
203 0x00, 0x88, 0x8A, 0x88, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22,
204 0x22, 0x00, 0x00, 0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0x00, 0x00, 0x00,
205 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x88, 0x8A,
206 0x88, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00,
207 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22,
208 0x22, 0x00, 0x00, 0x00, 0x00, 0x88, 0x8A, 0x88, 0x8A, 0x00, 0x00, 0x00,
209 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0xA8, 0xA8, 0xA8,
210 0xA8, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00,
211 0x00, 0x8A, 0x88, 0x8A, 0x88, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22,
212 0x22, 0x00, 0x00, 0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0x00, 0x00, 0x00,
213 0x00, 0x22, 0x22, 0x22, 0x22
214 };
215
216 /*
217 Gray80 pattern.
218 */
219 static const unsigned char
220 Gray80Image[] =
221 {
222 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x00, 0x00, 0x00,
223 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x51, 0x11, 0x51,
224 0x11, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00,
225 0x00, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55,
226 0x55, 0x00, 0x00, 0x00, 0x00, 0x51, 0x51, 0x51, 0x51, 0x00, 0x00, 0x00,
227 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11,
228 0x11, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00,
229 0x00, 0x51, 0x11, 0x51, 0x11, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55,
230 0x55, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00,
231 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x51, 0x51, 0x51,
232 0x51, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00,
233 0x00, 0x11, 0x11, 0x11, 0x11
234 };
235
236 /*
237 Gray75 pattern.
238 */
239 static const unsigned char
240 Gray75Image[] =
241 {
242 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xAA, 0xAA, 0xAA,
243 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
244 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
245 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
246 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
247 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
248 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
249 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
250 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
251 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
252 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
253 0xAA, 0x00, 0x00, 0x00, 0x00
254 };
255
256 /*
257 Gray70 pattern.
258 */
259 static const unsigned char
260 Gray70Image[] =
261 {
262 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xAA, 0xAA, 0xAA,
263 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11,
264 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
265 0xAA, 0x01, 0x01, 0x01, 0x01, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
266 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA,
267 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x01, 0x11,
268 0x01, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
269 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00,
270 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x01, 0x01, 0x01, 0x01, 0xAA, 0xAA, 0xAA,
271 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11,
272 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA,
273 0xAA, 0x11, 0x01, 0x11, 0x01
274 };
275
276 /*
277 Gray65 pattern.
278 */
279 static const unsigned char
280 Gray65Image[] =
281 {
282 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x44, 0x44, 0x44,
283 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x01, 0x01, 0x01, 0x01, 0xAA, 0xAA, 0xAA,
284 0xAA, 0x44, 0x44, 0x44, 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x10, 0x11,
285 0x10, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x44, 0x44, 0x44, 0xAA, 0xAA, 0xAA,
286 0xAA, 0x01, 0x01, 0x01, 0x01, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x44, 0x44,
287 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x10, 0x10, 0x10, 0x10, 0xAA, 0xAA, 0xAA,
288 0xAA, 0x44, 0x44, 0x44, 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x01, 0x01, 0x01,
289 0x01, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x44, 0x44, 0x44, 0xAA, 0xAA, 0xAA,
290 0xAA, 0x11, 0x10, 0x11, 0x10, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x44, 0x44,
291 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x01, 0x01, 0x01, 0x01, 0xAA, 0xAA, 0xAA,
292 0xAA, 0x44, 0x44, 0x44, 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x10, 0x10, 0x10,
293 0x10, 0xAA, 0xAA, 0xAA, 0xAA
294 };
295
296 /*
297 Gray60 pattern.
298 */
299 static const unsigned char
300 Gray60Image[] =
301 {
302 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x11, 0x11, 0x11,
303 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x45, 0x44, 0x45, 0xAA, 0xAA, 0xAA,
304 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x54, 0x54, 0x54,
305 0x54, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA,
306 0xAA, 0x45, 0x44, 0x45, 0x44, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11,
307 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x54, 0x54, 0x54, 0x54, 0xAA, 0xAA, 0xAA,
308 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x45, 0x44,
309 0x45, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA,
310 0xAA, 0x54, 0x54, 0x54, 0x54, 0xAA, 0xAA, 0xAA, 0xAA, 0x11, 0x11, 0x11,
311 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x45, 0x44, 0x45, 0x44, 0xAA, 0xAA, 0xAA,
312 0xAA, 0x11, 0x11, 0x11, 0x11, 0xAA, 0xAA, 0xAA, 0xAA, 0x54, 0x54, 0x54,
313 0x54, 0xAA, 0xAA, 0xAA, 0xAA
314 };
315
316 /*
317 Gray55 pattern.
318 */
319 static const unsigned char
320 Gray55Image[] =
321 {
322 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x55, 0x55, 0x55,
323 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0x2A, 0x2A, 0x2A,
324 0x2A, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
325 0x55, 0x22, 0x22, 0x22, 0x22, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
326 0xAA, 0x55, 0x55, 0x55, 0x55, 0x22, 0x2A, 0x22, 0x2A, 0x55, 0x55, 0x55,
327 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0x22, 0x22, 0x22,
328 0x22, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
329 0x55, 0x2A, 0x2A, 0x2A, 0x2A, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
330 0xAA, 0x55, 0x55, 0x55, 0x55, 0x22, 0x22, 0x22, 0x22, 0x55, 0x55, 0x55,
331 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0x22, 0x2A, 0x22,
332 0x2A, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
333 0x55, 0x22, 0x22, 0x22, 0x22
334 };
335
336 /*
337 Gray50 pattern.
338 */
339 static const unsigned char
340 Gray50Image[] =
341 {
342 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xAA, 0xAA, 0xAA,
343 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
344 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
345 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
346 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
347 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
348 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
349 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
350 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
351 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
352 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
353 0xAA, 0x55, 0x55, 0x55, 0x55
354 };
355
356 /*
357 Gray45 pattern.
358 */
359 static const unsigned char
360 Gray45Image[] =
361 {
362 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xBB, 0xBB, 0xBB,
363 0xBB, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
364 0x55, 0xAB, 0xAB, 0xAB, 0xAB, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
365 0xAA, 0x55, 0x55, 0x55, 0x55, 0xBB, 0xBB, 0xBB, 0xBB, 0x55, 0x55, 0x55,
366 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xBB, 0xAB, 0xBB,
367 0xAB, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
368 0x55, 0xBB, 0xBB, 0xBB, 0xBB, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
369 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAB, 0xAB, 0xAB, 0xAB, 0x55, 0x55, 0x55,
370 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xBB, 0xBB, 0xBB,
371 0xBB, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55,
372 0x55, 0xBB, 0xAB, 0xBB, 0xAB, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA,
373 0xAA, 0x55, 0x55, 0x55, 0x55
374 };
375
376 /*
377 Gray40 pattern.
378 */
379 static const unsigned char
380 Gray40Image[] =
381 {
382 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xEE, 0xEE, 0xEE,
383 0xEE, 0x55, 0x55, 0x55, 0x55, 0xAB, 0xAB, 0xAB, 0xAB, 0x55, 0x55, 0x55,
384 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55, 0x55, 0xBB, 0xBA, 0xBB,
385 0xBA, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55,
386 0x55, 0xAB, 0xAB, 0xAB, 0xAB, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE,
387 0xEE, 0x55, 0x55, 0x55, 0x55, 0xBA, 0xBB, 0xBA, 0xBB, 0x55, 0x55, 0x55,
388 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55, 0x55, 0xAB, 0xAB, 0xAB,
389 0xAB, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55,
390 0x55, 0xBB, 0xBA, 0xBB, 0xBA, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE,
391 0xEE, 0x55, 0x55, 0x55, 0x55, 0xAB, 0xAB, 0xAB, 0xAB, 0x55, 0x55, 0x55,
392 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55, 0x55, 0xBA, 0xBB, 0xBA,
393 0xBB, 0x55, 0x55, 0x55, 0x55
394 };
395
396 /*
397 Gray35 pattern.
398 */
399 static const unsigned char
400 Gray35Image[] =
401 {
402 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xAA, 0xAA, 0xAA,
403 0xAA, 0xDD, 0xDD, 0xDD, 0xDD, 0xAA, 0xAA, 0xAA, 0xAA, 0x7F, 0x7F, 0x7F,
404 0x7F, 0xAA, 0xAA, 0xAA, 0xAA, 0xDD, 0xDD, 0xDD, 0xDD, 0xAA, 0xAA, 0xAA,
405 0xAA, 0x77, 0xF7, 0x77, 0xF7, 0xAA, 0xAA, 0xAA, 0xAA, 0xDD, 0xDD, 0xDD,
406 0xDD, 0xAA, 0xAA, 0xAA, 0xAA, 0x7F, 0x7F, 0x7F, 0x7F, 0xAA, 0xAA, 0xAA,
407 0xAA, 0xDD, 0xDD, 0xDD, 0xDD, 0xAA, 0xAA, 0xAA, 0xAA, 0xF7, 0xF7, 0xF7,
408 0xF7, 0xAA, 0xAA, 0xAA, 0xAA, 0xDD, 0xDD, 0xDD, 0xDD, 0xAA, 0xAA, 0xAA,
409 0xAA, 0x7F, 0x7F, 0x7F, 0x7F, 0xAA, 0xAA, 0xAA, 0xAA, 0xDD, 0xDD, 0xDD,
410 0xDD, 0xAA, 0xAA, 0xAA, 0xAA, 0x77, 0xF7, 0x77, 0xF7, 0xAA, 0xAA, 0xAA,
411 0xAA, 0xDD, 0xDD, 0xDD, 0xDD, 0xAA, 0xAA, 0xAA, 0xAA, 0x7F, 0x7F, 0x7F,
412 0x7F, 0xAA, 0xAA, 0xAA, 0xAA, 0xDD, 0xDD, 0xDD, 0xDD, 0xAA, 0xAA, 0xAA,
413 0xAA, 0xF7, 0xF7, 0xF7, 0xF7
414 };
415
416 /*
417 Gray30 pattern.
418 */
419 static const unsigned char
420 Gray30Image[] =
421 {
422 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xFF, 0xFF, 0xFF,
423 0xFF, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55,
424 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xFE, 0xEE,
425 0xFE, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
426 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
427 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFE, 0xFE, 0xFE, 0xFE, 0x55, 0x55, 0x55,
428 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE,
429 0xEE, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
430 0x55, 0xEE, 0xFE, 0xEE, 0xFE, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
431 0xFF, 0x55, 0x55, 0x55, 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0x55, 0x55,
432 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFE, 0xFE, 0xFE,
433 0xFE, 0x55, 0x55, 0x55, 0x55
434 };
435
436 /*
437 Gray25 pattern.
438 */
439 static const unsigned char
440 Gray25Image[] =
441 {
442 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xFF, 0xFF, 0xFF,
443 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
444 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
445 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
446 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
447 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
448 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
449 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
450 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
451 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55,
452 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xFF,
453 0xFF, 0x55, 0x55, 0x55, 0x55
454 };
455
456 /*
457 Gray20 pattern.
458 */
459 static const unsigned char
460 Gray20Image[] =
461 {
462 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xAA, 0xAA, 0xAA,
463 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xBB, 0xBB, 0xBB, 0xFF, 0xFF, 0xFF,
464 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0xBB, 0xBA,
465 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF,
466 0xFF, 0xBB, 0xBB, 0xBB, 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA, 0xAA,
467 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0xBA, 0xBA, 0xBA, 0xFF, 0xFF, 0xFF,
468 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xBB, 0xBB,
469 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF,
470 0xFF, 0xBA, 0xBB, 0xBA, 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA, 0xAA,
471 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xBB, 0xBB, 0xBB, 0xFF, 0xFF, 0xFF,
472 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0xBA, 0xBA,
473 0xBA, 0xFF, 0xFF, 0xFF, 0xFF
474 };
475
476 /*
477 Gray15 pattern.
478 */
479 static const unsigned char
480 Gray15Image[] =
481 {
482 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0x77, 0x77, 0x77,
483 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0x5D, 0x5D, 0x5D, 0xFF, 0xFF, 0xFF,
484 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xD5, 0xDD, 0xD5,
485 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF,
486 0xFF, 0xDD, 0x5D, 0x5D, 0x5D, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77,
487 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xD5, 0xDD, 0xD5, 0xFF, 0xFF, 0xFF,
488 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0x5D, 0x5D,
489 0x5D, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF,
490 0xFF, 0xD5, 0xDD, 0xD5, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77,
491 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0x5D, 0x5D, 0x5D, 0xFF, 0xFF, 0xFF,
492 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xD5, 0xDD,
493 0xD5, 0xFF, 0xFF, 0xFF, 0xFF
494 };
495
496 /*
497 Gray10 pattern.
498 */
499 static const unsigned char
500 Gray10Image[] =
501 {
502 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xFF, 0xFF, 0xFF,
503 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF, 0xDF,
504 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF,
505 0xFF, 0xFD, 0xDD, 0xFD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77,
506 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF,
507 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFD, 0xFD,
508 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF,
509 0xFF, 0xDF, 0xDF, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77,
510 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDD, 0xFD, 0xDD, 0xFF, 0xFF, 0xFF,
511 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF, 0xDF,
512 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF,
513 0xFF, 0xFD, 0xFD, 0xFD, 0xFD
514 };
515
516 /*
517 Gray5 pattern.
518 */
519 static const unsigned char
520 Gray5Image[] =
521 {
522 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xFF, 0xFF, 0xFF,
523 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xDD, 0xDD,
524 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
525 0xFF, 0xDF, 0xDF, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
526 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xDD, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF,
527 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF, 0xDF,
528 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
529 0xFF, 0xDD, 0xDD, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
530 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF,
531 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xDD, 0xDD,
532 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
533 0xFF, 0xDF, 0xDF, 0xDF, 0xDF
534 };
535
536 /*
537 Gray0 pattern.
538 */
539 static const unsigned char
540 Gray0Image[] =
541 {
542 0x50, 0x34, 0x0A, 0x33, 0x32, 0x20, 0x33, 0x32, 0x0A, 0xFF, 0xFF, 0xFF,
543 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
544 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
545 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
546 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
547 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
548 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
549 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
550 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
551 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
552 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
553 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
554 };
555
556 /*
557 Hexagons pattern.
558 */
559 static const unsigned char
560 HexagonsImage[] =
561 {
562 0x50, 0x34, 0x0A, 0x33, 0x30, 0x20, 0x31, 0x38, 0x0A, 0x10, 0x01, 0x00,
563 0x00, 0x10, 0x01, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x20, 0x00, 0x80,
564 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x20,
565 0x00, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1F, 0xFC, 0x80, 0x00, 0x20,
566 0x00, 0x80, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
567 0x00, 0x20, 0x00, 0x80, 0x00, 0x20, 0x00, 0x80, 0x00, 0x10, 0x01, 0x00,
568 0x00, 0x10, 0x01, 0x00, 0x00, 0x0F, 0xFE, 0x00, 0x00
569 };
570
571 /*
572 Horizontal pattern.
573 */
574 static const unsigned char
575 HorizontalImage[] =
576 {
577 0x50, 0x34, 0x0A, 0x38, 0x20, 0x34, 0x0A, 0xFF, 0x00, 0x00, 0x00
578 };
579
580 /*
581 Horizontal-2 pattern.
582 */
583 static const unsigned char
584 Horizontal2Image[] =
585 {
586 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
587 0x00, 0xFF, 0x00
588 };
589
590 /*
591 Horizontal-3 pattern.
592 */
593 static const unsigned char
594 Horizontal3Image[] =
595 {
596 0x50, 0x34, 0x0A, 0x39, 0x20, 0x39, 0x0A, 0x00, 0x00, 0x00, 0x00, 0xFF,
597 0x80, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0xFF,
598 0x80,
599 };
600
601 /*
602 HorizontalSaw pattern.
603 */
604 static const unsigned char
605 HorizontalSawImage[] =
606 {
607 0x50, 0x34, 0x0A, 0x31, 0x36, 0x20, 0x38, 0x0A, 0x00, 0x00, 0x00, 0x00,
608 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x01, 0x01
609 };
610
611 /*
612 HS_BDIAGONAL pattern (Windows GDI HS_BDIAGONAL)
613 */
614 static const unsigned char
615 HS_BDIAGONALImage[] =
616 {
617 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x01, 0x02, 0x04, 0x08, 0x10,
618 0x20, 0x40, 0x80
619 };
620
621 /*
622 HS_CROSS pattern (Windows GDI HS_CROSS)
623 */
624 static const unsigned char
625 HS_CROSSImage[] =
626 {
627 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x10, 0x10, 0x10, 0xFF, 0x10,
628 0x10, 0x10, 0x10
629 };
630
631 /*
632 HS_DIAGCROSS pattern (Windows GDI HS_DIAGCROSS)
633 */
634 static const unsigned char
635 HS_DIAGCROSSImage[] =
636 {
637 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x81, 0x42, 0x24, 0x18, 0x18,
638 0x24, 0x42, 0x81
639 };
640
641 /*
642 HS_FDIAGONAL pattern (Windows GDI HS_FDIAGONAL)
643 */
644 static const unsigned char
645 HS_FDIAGONALImage[] =
646 {
647 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x80, 0x40, 0x20, 0x10, 0x08,
648 0x04, 0x02, 0x01
649 };
650
651 /*
652 HS_HORIZONTAL pattern (Windows GDI HS_HORIZONTAL)
653 */
654 static const unsigned char
655 HS_HORIZONTALImage[] =
656 {
657 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x00, 0x00, 0x00, 0xFF, 0x00,
658 0x00, 0x00, 0x00
659 };
660
661 /*
662 HS_VERTICAL pattern (Windows GDI HS_VERTICAL)
663 */
664 static const unsigned char
665 HS_VERTICALImage[] =
666 {
667 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x10, 0x10, 0x10, 0x10, 0x10,
668 0x10, 0x10, 0x10
669 };
670
671 /*
672 Left30 pattern.
673 */
674 static const unsigned char
675 Left30Image[] =
676 {
677 0x50, 0x34, 0x0A, 0x38, 0x20, 0x34, 0x0A, 0xC0, 0x30, 0x0C, 0x03
678 };
679
680 /*
681 Left45 pattern.
682 */
683 static const unsigned char
684 Left45Image[] =
685 {
686 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x80, 0x40, 0x20, 0x10, 0x08,
687 0x04, 0x02, 0x01
688 };
689
690 /*
691 LeftShingle pattern.
692 */
693 static const unsigned char
694 LeftShingleImage[] =
695 {
696 0x50, 0x34, 0x0A, 0x32, 0x34, 0x20, 0x32, 0x34, 0x0A, 0x00, 0x00, 0x01,
697 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04,
698 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00,
699 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00,
700 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x00,
701 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00,
702 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0xFF, 0xFF, 0xFF
703 };
704
705 /*
706 Octagons image declaration.
707 */
708 static const unsigned char
709 OctagonsImage[] =
710 {
711 0x50, 0x34, 0x0A, 0x31, 0x36, 0x20, 0x31, 0x36, 0x0A, 0x07, 0xF0, 0x08,
712 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01, 0x80, 0x00, 0x80, 0x00, 0x80,
713 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x40, 0x01, 0x20,
714 0x02, 0x10, 0x04, 0x08, 0x08
715 };
716
717 /*
718 Right30 pattern.
719 */
720 static const unsigned char
721 Right30Image[] =
722 {
723 0x50, 0x34, 0x0A, 0x38, 0x20, 0x34, 0x0A, 0x03, 0x0C, 0x30, 0xC0
724 };
725
726 /*
727 Right45 pattern.
728 */
729 static const unsigned char
730 Right45Image[] =
731 {
732 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x01, 0x02, 0x04, 0x08, 0x10,
733 0x20, 0x40, 0x80
734 };
735
736 /*
737 RightShingle pattern.
738 */
739 static const unsigned char
740 RightShingleImage[] =
741 {
742 0x50, 0x34, 0x0A, 0x32, 0x34, 0x20, 0x32, 0x34, 0x0A, 0x00, 0x00, 0x08,
743 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02,
744 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0x00, 0x08, 0x00,
745 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00,
746 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x08, 0x00, 0x00,
747 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00,
748 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF
749 };
750
751 /*
752 SmallFishScales pattern.
753 */
754 static const unsigned char
755 SmallFishScalesImage[] =
756 {
757 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x80, 0x80, 0x41, 0x36, 0x08,
758 0x08, 0x14, 0x63
759 };
760
761 /*
762 Vertical pattern.
763 */
764 static const unsigned char
765 VerticalImage[] =
766 {
767 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0x11, 0x11, 0x11, 0x11, 0x11,
768 0x11, 0x11, 0x11
769 };
770
771 /*
772 Vertical-2 pattern.
773 */
774 static const unsigned char
775 Vertical2Image[] =
776 {
777 0x50, 0x34, 0x0A, 0x38, 0x20, 0x38, 0x0A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
778 0xAA, 0xAA, 0xAA
779 };
780
781 /*
782 Vertical-2 pattern.
783 */
784 static const unsigned char
785 Vertical3Image[] =
786 {
787 0x50, 0x34, 0x0A, 0x39, 0x20, 0x39, 0x0A, 0x24, 0x80, 0x24, 0x80, 0x24,
788 0x80, 0x24, 0x80, 0x24, 0x80, 0x24, 0x80, 0x24, 0x80, 0x24, 0x80, 0x24,
789 0x80
790 };
791
792 /*
793 VerticalBricks pattern.
794 */
795 static const unsigned char
796 VerticalBricksImage[] =
797 {
798 0x50, 0x34, 0x0A, 0x31, 0x36, 0x20, 0x31, 0x36, 0x0A, 0xFF, 0x01, 0x01,
799 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
800 0x01, 0x01, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
801 0x01, 0x01, 0x01, 0x01, 0x01
802 };
803
804 /*
805 VerticalLeftShingle pattern.
806 */
807 static const unsigned char
808 VerticalLeftShingleImage[] =
809 {
810 0x50, 0x34, 0x0A, 0x32, 0x34, 0x20, 0x32, 0x34, 0x0A, 0x01, 0x01, 0x01,
811 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81,
812 0x01, 0x01, 0x61, 0x01, 0x01, 0x19, 0x01, 0x01, 0x07, 0x01, 0x01, 0x01,
813 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x01,
814 0x01, 0x61, 0x01, 0x01, 0x19, 0x01, 0x01, 0x07, 0x01, 0x01, 0x01, 0x01,
815 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x01, 0x01,
816 0x61, 0x01, 0x01, 0x19, 0x01, 0x01, 0x07, 0x01, 0x01
817 };
818
819 /*
820 VerticalRightShingle pattern.
821 */
822 static const unsigned char
823 VerticalRightShingleImage[] =
824 {
825 0x50, 0x34, 0x0A, 0x32, 0x34, 0x20, 0x32, 0x34, 0x0A, 0x01, 0x01, 0x01,
826 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01,
827 0x01, 0x0D, 0x01, 0x01, 0x31, 0x01, 0x01, 0xC1, 0x01, 0x01, 0x01, 0x01,
828 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
829 0x01, 0x01, 0x0D, 0x01, 0x01, 0x31, 0x01, 0x01, 0xC1, 0x01, 0x01, 0x01,
830 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01,
831 0x0D, 0x01, 0x01, 0x31, 0x01, 0x01, 0xC1, 0x01, 0x01
832 };
833
834 /*
835 VerticalSaw pattern.
836 */
837 static const unsigned char
838 VerticalSawImage[] =
839 {
840 0x50, 0x34, 0x0A, 0x38, 0x20, 0x31, 0x36, 0x0A, 0x40, 0x20, 0x10, 0x08,
841 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80
842 };
843
844 typedef struct _PatternInfo
845 {
846 char
847 name[MagickPathExtent],
848 magick[MagickPathExtent];
849
850 const void
851 *blob;
852
853 size_t
854 extent;
855 } PatternInfo;
856
857 static const PatternInfo
858 PatternImageList[] =
859 {
860 { "BRICKS", "PBM", BricksImage, sizeof(BricksImage) },
861 { "CHECKERBOARD", "GIF", CheckerboardImage, sizeof(CheckerboardImage) },
862 { "CIRCLES", "PBM", CirclesImage, sizeof(CirclesImage) },
863 { "CROSSHATCH", "PBM", CrossHatchImage, sizeof(CrossHatchImage) },
864 { "CROSSHATCH30", "PBM", CrossHatch30Image, sizeof(CrossHatch30Image) },
865 { "CROSSHATCH45", "PBM", CrossHatch45Image, sizeof(CrossHatch45Image) },
866 { "FISHSCALES", "PBM", FishScalesImage, sizeof(FishScalesImage) },
867 { "GRAY0", "PBM", Gray0Image, sizeof(Gray0Image) },
868 { "GRAY5", "PBM", Gray5Image, sizeof(Gray5Image) },
869 { "GRAY10", "PBM", Gray10Image, sizeof(Gray10Image) },
870 { "GRAY15", "PBM", Gray15Image, sizeof(Gray15Image) },
871 { "GRAY20", "PBM", Gray20Image, sizeof(Gray20Image) },
872 { "GRAY25", "PBM", Gray25Image, sizeof(Gray25Image) },
873 { "GRAY30", "PBM", Gray30Image, sizeof(Gray30Image) },
874 { "GRAY35", "PBM", Gray35Image, sizeof(Gray35Image) },
875 { "GRAY40", "PBM", Gray40Image, sizeof(Gray40Image) },
876 { "GRAY45", "PBM", Gray45Image, sizeof(Gray45Image) },
877 { "GRAY50", "PBM", Gray50Image, sizeof(Gray50Image) },
878 { "GRAY55", "PBM", Gray55Image, sizeof(Gray55Image) },
879 { "GRAY60", "PBM", Gray60Image, sizeof(Gray60Image) },
880 { "GRAY65", "PBM", Gray65Image, sizeof(Gray65Image) },
881 { "GRAY70", "PBM", Gray70Image, sizeof(Gray70Image) },
882 { "GRAY75", "PBM", Gray75Image, sizeof(Gray75Image) },
883 { "GRAY80", "PBM", Gray80Image, sizeof(Gray80Image) },
884 { "GRAY85", "PBM", Gray85Image, sizeof(Gray85Image) },
885 { "GRAY90", "PBM", Gray90Image, sizeof(Gray90Image) },
886 { "GRAY95", "PBM", Gray95Image, sizeof(Gray95Image) },
887 { "GRAY100", "PBM", Gray100Image, sizeof(Gray100Image) },
888 { "HEXAGONS", "PBM", HexagonsImage, sizeof(HexagonsImage) },
889 { "HORIZONTAL", "PBM", HorizontalImage, sizeof(HorizontalImage) },
890 { "HORIZONTAL2", "PBM", Horizontal2Image, sizeof(Horizontal2Image) },
891 { "HORIZONTAL3", "PBM", Horizontal3Image, sizeof(Horizontal3Image) },
892 { "HORIZONTALSAW", "PBM", HorizontalSawImage, sizeof(HorizontalSawImage) },
893 { "HS_BDIAGONAL", "PBM", HS_BDIAGONALImage, sizeof(HS_BDIAGONALImage) },
894 { "HS_CROSS", "PBM", HS_CROSSImage, sizeof(HS_CROSSImage) },
895 { "HS_DIAGCROSS", "PBM", HS_DIAGCROSSImage, sizeof(HS_DIAGCROSSImage) },
896 { "HS_FDIAGONAL", "PBM", HS_FDIAGONALImage, sizeof(HS_FDIAGONALImage) },
897 { "HS_HORIZONTAL", "PBM", HS_HORIZONTALImage, sizeof(HS_HORIZONTALImage) },
898 { "HS_VERTICAL", "PBM", HS_VERTICALImage, sizeof(HS_VERTICALImage) },
899 { "LEFT30", "PBM", Left30Image, sizeof(Left30Image) },
900 { "LEFT45", "PBM", Left45Image, sizeof(Left45Image) },
901 { "LEFTSHINGLE", "PBM", LeftShingleImage, sizeof(LeftShingleImage) },
902 { "OCTAGONS", "PBM", OctagonsImage, sizeof(OctagonsImage) },
903 { "RIGHT30", "PBM", Right30Image, sizeof(Right30Image) },
904 { "RIGHT45", "PBM", Right45Image, sizeof(Right45Image) },
905 { "RIGHTSHINGLE", "PBM", RightShingleImage, sizeof(RightShingleImage) },
906 { "SMALLFISHSCALES", "PBM", SmallFishScalesImage,
907 sizeof(SmallFishScalesImage) },
908 { "VERTICAL", "PBM", VerticalImage, sizeof(VerticalImage) },
909 { "VERTICAL2", "PBM", Vertical2Image, sizeof(Vertical2Image) },
910 { "VERTICAL3", "PBM", Vertical3Image, sizeof(Vertical3Image) },
911 { "VERTICALBRICKS", "PBM", VerticalBricksImage,
912 sizeof(VerticalBricksImage) },
913 { "VERTICALLEFTSHINGLE", "PBM", VerticalLeftShingleImage,
914 sizeof(VerticalLeftShingleImage) },
915 { "VERTICALRIGHTSHINGLE", "PBM", VerticalRightShingleImage,
916 sizeof(VerticalRightShingleImage) },
917 { "VERTICALSAW", "PBM", VerticalSawImage, sizeof(VerticalSawImage) },
918 { "", "", (const void *) NULL, 0 }
919 };
920
921 /*
922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
923 % %
924 % %
925 % %
926 % R e a d P A T T E R N I m a g e %
927 % %
928 % %
929 % %
930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
931 %
932 % ReadPATTERNImage() reads a PATTERN image file and returns it. It
933 % allocates the memory necessary for the new Image structure and returns a
934 % pointer to the new image.
935 %
936 % The format of the ReadPATTERNImage method is:
937 %
938 % Image *ReadPATTERNImage(const ImageInfo *image_info,
939 % ExceptionInfo *exception)
940 %
941 % A description of each parameter follows:
942 %
943 % o image_info: the image info.
944 %
945 % o exception: return any errors or warnings in this structure.
946 %
947 */
ReadPATTERNImage(const ImageInfo * image_info,ExceptionInfo * exception)948 static Image *ReadPATTERNImage(const ImageInfo *image_info,
949 ExceptionInfo *exception)
950 {
951 const void
952 *blob;
953
954 Image
955 *image;
956
957 ImageInfo
958 *blob_info;
959
960 register ssize_t
961 i;
962
963 size_t
964 extent;
965
966 blob_info=CloneImageInfo(image_info);
967 image=(Image *) NULL;
968 blob=(const void *) NULL;
969 extent=0;
970 for (i=0; PatternImageList[i].blob != (const void *) NULL; i++)
971 if (LocaleCompare(blob_info->filename,PatternImageList[i].name) == 0)
972 {
973 (void) CopyMagickString(blob_info->magick,PatternImageList[i].magick,
974 MagickPathExtent);
975 blob=PatternImageList[i].blob;
976 extent=PatternImageList[i].extent;
977 break;
978 }
979 if (blob == (const void *) NULL)
980 {
981 blob_info=DestroyImageInfo(blob_info);
982 ThrowReaderException(OptionError,"UnrecognizedImageFormat");
983 }
984 image=BlobToImage(blob_info,blob,extent,exception);
985 if (image_info->size != (char *) NULL)
986 {
987 Image
988 *pattern_image;
989
990 /*
991 Tile pattern across image canvas.
992 */
993 pattern_image=image;
994 image=AcquireImage(image_info,exception);
995 (void) TextureImage(image,pattern_image,exception);
996 pattern_image=DestroyImage(pattern_image);
997 }
998 blob_info=DestroyImageInfo(blob_info);
999 return(GetFirstImageInList(image));
1000 }
1001 /*
1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1003 % %
1004 % %
1005 % %
1006 % R e g i s t e r P A T T E R N I m a g e %
1007 % %
1008 % %
1009 % %
1010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1011 %
1012 % RegisterPATTERNImage() adds attributes for the BRICKS, CHECKERBOARD,
1013 % CIRCLES, etc., image formats to the list of supported formats. The attributes
1014 % include the image format tag, a method to read and/or write the format,
1015 % whether the format supports the saving of more than one frame to the same
1016 % file or blob, whether the format supports native in-memory I/O, and a
1017 % brief description of the format.
1018 %
1019 % The format of the RegisterPATTERNImage method is:
1020 %
1021 % size_t RegisterPATTERNImage(void)
1022 %
1023 */
RegisterPATTERNImage(void)1024 ModuleExport size_t RegisterPATTERNImage(void)
1025 {
1026 MagickInfo
1027 *entry;
1028
1029 entry=AcquireMagickInfo("PATTERN","PATTERN","Predefined pattern");
1030 entry->decoder=(DecodeImageHandler *) ReadPATTERNImage;
1031 entry->flags^=CoderAdjoinFlag;
1032 (void) RegisterMagickInfo(entry);
1033 return(MagickImageCoderSignature);
1034 }
1035
1036 /*
1037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1038 % %
1039 % %
1040 % %
1041 % U n r e g i s t e r P A T T E R N I m a g e %
1042 % %
1043 % %
1044 % %
1045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1046 %
1047 % UnregisterPATTERNImage() removes format registrations made by the
1048 % PATTERN module from the list of supported formats.
1049 %
1050 % The format of the UnregisterPATTERNImage method is:
1051 %
1052 % UnregisterPATTERNImage(void)
1053 %
1054 */
UnregisterPATTERNImage(void)1055 ModuleExport void UnregisterPATTERNImage(void)
1056 {
1057 (void) UnregisterMagickInfo("PATTERN");
1058 }
1059