0024228: TKOpenGL - destroy GL context at view close
[occt.git] / src / OpenGl / OpenGl_AspectMarker.cxx
CommitLineData
b311480e 1// Created on: 2011-07-14
2// Created by: Sergey ZERCHANINOV
3// Copyright (c) 2011-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
2166f0fa 20#include <OpenGl_AspectMarker.hxx>
a577aaab 21#include <OpenGl_Context.hxx>
22#include <OpenGl_GraphicDriver.hxx>
23#include <OpenGl_PointSprite.hxx>
bf75be98 24#include <OpenGl_Workspace.hxx>
2166f0fa 25
a577aaab 26#include <Image_PixMap.hxx>
27#include <Graphic3d_MarkerImage.hxx>
28#include <NCollection_Vec4.hxx>
fd4a6963 29#include <TColStd_HArray1OfByte.hxx>
a577aaab 30
2166f0fa
SK
31static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
32
a577aaab 33// Following Section relates to default markers
2166f0fa 34
a577aaab 35#define TEL_NO_OF_SIZES 13
36#define TEL_PM_START_SIZE 1.0
37#define TEL_PM_END_SIZE 7.0
38
39struct PM_FONT_INFO
40{
41 Tfloat width, height;
42 Tint offset;
43};
44typedef PM_FONT_INFO* pm_font_info;
45
46#define PM_PLUS_10_NUM 9*2
47#define PM_PLUS_15_NUM 11*2
48#define PM_PLUS_20_NUM 13*2
49#define PM_PLUS_25_NUM 15*2
50#define PM_PLUS_30_NUM 17*3
51#define PM_PLUS_35_NUM 19*3
52#define PM_PLUS_40_NUM 21*3
53#define PM_PLUS_45_NUM 23*3
54#define PM_PLUS_50_NUM 25*4
55#define PM_PLUS_55_NUM 27*4
56#define PM_PLUS_60_NUM 29*4
57#define PM_PLUS_65_NUM 31*4
58#define PM_PLUS_70_NUM 32*4
59
60#define PM_STAR_10_NUM 9
61#define PM_STAR_15_NUM 11*2
62#define PM_STAR_20_NUM 13*2
63#define PM_STAR_25_NUM 15*2
64#define PM_STAR_30_NUM 17*2
65#define PM_STAR_35_NUM 19*2
66#define PM_STAR_40_NUM 21*3
67#define PM_STAR_45_NUM 23*3
68#define PM_STAR_50_NUM 25*3
69#define PM_STAR_55_NUM 27*3
70#define PM_STAR_60_NUM 29*4
71#define PM_STAR_65_NUM 32*4
72#define PM_STAR_70_NUM 32*4
73
74#define PM_CIRC_10_NUM 7
75#define PM_CIRC_15_NUM 9*2
76#define PM_CIRC_20_NUM 9*2
77#define PM_CIRC_25_NUM 11*2
78#define PM_CIRC_30_NUM 13*2
79#define PM_CIRC_35_NUM 15*2
80#define PM_CIRC_40_NUM 17*3
81#define PM_CIRC_45_NUM 19*3
82#define PM_CIRC_50_NUM 21*3
83#define PM_CIRC_55_NUM 23*3
84#define PM_CIRC_60_NUM 25*4
85#define PM_CIRC_65_NUM 27*4
86#define PM_CIRC_70_NUM 29*4
87
88#define PM_CROSS_10_NUM 7
89#define PM_CROSS_15_NUM 9*2
90#define PM_CROSS_20_NUM 11*2
91#define PM_CROSS_25_NUM 13*2
92#define PM_CROSS_30_NUM 15*2
93#define PM_CROSS_35_NUM 17*3
94#define PM_CROSS_40_NUM 19*3
95#define PM_CROSS_45_NUM 21*3
96#define PM_CROSS_50_NUM 23*3
97#define PM_CROSS_55_NUM 25*4
98#define PM_CROSS_60_NUM 27*4
99#define PM_CROSS_65_NUM 32*4
100#define PM_CROSS_70_NUM 32*4
2166f0fa 101
a577aaab 102#define PM_PLUS_10_OFT 0
103#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM
104#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM
105#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM
106#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM
107#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM
108#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM
109#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM
110#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM
111#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM
112#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM
113#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM
114#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM
2166f0fa 115
a577aaab 116#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM
117#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM
118#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM
119#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM
120#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM
121#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM
122#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM
123#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM
124#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM
125#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM
126#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM
127#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM
128#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM
129
130#define PM_CIRC_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM
131#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM
132#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM
133#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM
134#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM
135#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM
136#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM
137#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM
138#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM
139#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM
140#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM
141#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM
142#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM
143
144#define PM_CROSS_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM
145#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM
146#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM
147#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM
148#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM
149#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM
150#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM
151#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM
152#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM
153#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM
154#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM
155#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM
156#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM
157
158static const PM_FONT_INFO arrPMFontInfo[][TEL_NO_OF_SIZES] =
2166f0fa 159{
a577aaab 160 // TOM_POINT - not used
161 {{0},
162 {0},
163 {0},
164 {0},
165 {0},
166 {0},
167 {0},
168 {0},
169 {0},
170 {0},
171 {0},
172 {0},
173 {0}},
174
175 // TOM_PLUS
176 {{ 9.f, 9.f, PM_PLUS_10_OFT},
177 {11.f, 11.f, PM_PLUS_15_OFT},
178 {13.f, 13.f, PM_PLUS_20_OFT},
179 {15.f, 15.f, PM_PLUS_25_OFT},
180 {17.f, 17.f, PM_PLUS_30_OFT},
181 {19.f, 19.f, PM_PLUS_35_OFT},
182 {21.f, 21.f, PM_PLUS_40_OFT},
183 {23.f, 23.f, PM_PLUS_45_OFT},
184 {25.f, 25.f, PM_PLUS_50_OFT},
185 {27.f, 27.f, PM_PLUS_55_OFT},
186 {29.f, 29.f, PM_PLUS_60_OFT},
187 {31.f, 31.f, PM_PLUS_65_OFT},
188 {32.f, 32.f, PM_PLUS_70_OFT}},
189
190 // TOM_STAR
191 {{ 7.f, 9.f, PM_STAR_10_OFT},
192 {9.f, 11.f, PM_STAR_15_OFT},
193 {11.f, 13.f, PM_STAR_20_OFT},
194 {13.f, 15.f, PM_STAR_25_OFT},
195 {13.f, 17.f, PM_STAR_30_OFT},
196 {15.f, 19.f, PM_STAR_35_OFT},
197 {17.f, 21.f, PM_STAR_40_OFT},
198 {19.f, 23.f, PM_STAR_45_OFT},
199 {21.f, 25.f, PM_STAR_50_OFT},
200 {23.f, 27.f, PM_STAR_55_OFT},
201 {25.f, 29.f, PM_STAR_60_OFT},
202 {32.f, 32.f, PM_STAR_65_OFT},
203 {32.f, 32.f, PM_STAR_70_OFT}},
204
205 // TOM_X
206 {{ 7.f, 7.f, PM_CROSS_10_OFT},
207 { 9.f, 9.f, PM_CROSS_15_OFT},
208 {11.f, 11.f, PM_CROSS_20_OFT},
209 {13.f, 13.f, PM_CROSS_25_OFT},
210 {15.f, 15.f, PM_CROSS_30_OFT},
211 {17.f, 17.f, PM_CROSS_35_OFT},
212 {19.f, 19.f, PM_CROSS_40_OFT},
213 {21.f, 21.f, PM_CROSS_45_OFT},
214 {23.f, 23.f, PM_CROSS_50_OFT},
215 {25.f, 25.f, PM_CROSS_55_OFT},
216 {27.f, 27.f, PM_CROSS_60_OFT},
217 {32.f, 32.f, PM_CROSS_65_OFT},
218 {32.f, 32.f, PM_CROSS_70_OFT}},
219
220 // TOM_O
221 {{ 7.f, 7.f, PM_CIRC_10_OFT},
222 { 9.f, 9.f, PM_CIRC_15_OFT},
223 { 9.f, 9.f, PM_CIRC_20_OFT},
224 {11.f, 11.f, PM_CIRC_25_OFT},
225 {13.f, 13.f, PM_CIRC_30_OFT},
226 {15.f, 15.f, PM_CIRC_35_OFT},
227 {17.f, 17.f, PM_CIRC_40_OFT},
228 {19.f, 19.f, PM_CIRC_45_OFT},
229 {21.f, 21.f, PM_CIRC_50_OFT},
230 {23.f, 23.f, PM_CIRC_55_OFT},
231 {25.f, 25.f, PM_CIRC_60_OFT},
232 {27.f, 27.f, PM_CIRC_65_OFT},
233 {29.f, 29.f, PM_CIRC_70_OFT}}
234};
235
236static const Standard_Byte OpenGl_AspectMarker_myMarkerRaster[] =
237{
238 // TYPE = PLUS
239
240 0x08,0x00,
241 0x08,0x00,
242 0x08,0x00,
243 0x08,0x00,
244 0xff,0x80,
245 0x08,0x00,
246 0x08,0x00,
247 0x08,0x00,
248 0x08,0x00, // PLUS 9x9 = 1.0
249
250 0x04,0x00,
251 0x04,0x00,
252 0x04,0x00,
253 0x04,0x00,
254 0x04,0x00,
255 0xff,0xe0,
256 0x04,0x00,
257 0x04,0x00,
258 0x04,0x00,
259 0x04,0x00,
260 0x04,0x00, // PLUS 11x11 = 1.5
261
262 0x02,0x00,
263 0x02,0x00,
264 0x02,0x00,
265 0x02,0x00,
266 0x02,0x00,
267 0x02,0x00,
268 0xff,0xf8,
269 0x02,0x00,
270 0x02,0x00,
271 0x02,0x00,
272 0x02,0x00,
273 0x02,0x00,
274 0x02,0x00, // PLUS 13x13 = 2.0
275
276 0x01,0x00,
277 0x01,0x00,
278 0x01,0x00,
279 0x01,0x00,
280 0x01,0x00,
281 0x01,0x00,
282 0x01,0x00,
283 0xff,0xfe,
284 0x01,0x00,
285 0x01,0x00,
286 0x01,0x00,
287 0x01,0x00,
288 0x01,0x00,
289 0x01,0x00,
290 0x01,0x00, // PLUS 15x15 = 2.5
291
292 0x00,0x80, 0x00,
293 0x00,0x80, 0x00,
294 0x00,0x80, 0x00,
295 0x00,0x80, 0x00,
296 0x00,0x80, 0x00,
297 0x00,0x80, 0x00,
298 0x00,0x80, 0x00,
299 0x00,0x80, 0x00,
300 0xff,0xff, 0x80,
301 0x00,0x80, 0x00,
302 0x00,0x80, 0x00,
303 0x00,0x80, 0x00,
304 0x00,0x80, 0x00,
305 0x00,0x80, 0x00,
306 0x00,0x80, 0x00,
307 0x00,0x80, 0x00,
308 0x00,0x80, 0x00, // PLUS 17x17 = 3.0
309
310 0x00,0x40, 0x00,
311 0x00,0x40, 0x00,
312 0x00,0x40, 0x00,
313 0x00,0x40, 0x00,
314 0x00,0x40, 0x00,
315 0x00,0x40, 0x00,
316 0x00,0x40, 0x00,
317 0x00,0x40, 0x00,
318 0x00,0x40, 0x00,
319 0xff,0xff, 0xe0,
320 0x00,0x40, 0x00,
321 0x00,0x40, 0x00,
322 0x00,0x40, 0x00,
323 0x00,0x40, 0x00,
324 0x00,0x40, 0x00,
325 0x00,0x40, 0x00,
326 0x00,0x40, 0x00,
327 0x00,0x40, 0x00,
328 0x00,0x40, 0x00, // PLUS 19x19 = 3.5
329
330 0x00,0x20, 0x00,
331 0x00,0x20, 0x00,
332 0x00,0x20, 0x00,
333 0x00,0x20, 0x00,
334 0x00,0x20, 0x00,
335 0x00,0x20, 0x00,
336 0x00,0x20, 0x00,
337 0x00,0x20, 0x00,
338 0x00,0x20, 0x00,
339 0x00,0x20, 0x00,
340 0xff,0xff, 0xf8,
341 0x00,0x20, 0x00,
342 0x00,0x20, 0x00,
343 0x00,0x20, 0x00,
344 0x00,0x20, 0x00,
345 0x00,0x20, 0x00,
346 0x00,0x20, 0x00,
347 0x00,0x20, 0x00,
348 0x00,0x20, 0x00,
349 0x00,0x20, 0x00,
350 0x00,0x20, 0x00, // PLUS 21x21 = 4.0
351
352 0x00,0x10, 0x00,
353 0x00,0x10, 0x00,
354 0x00,0x10, 0x00,
355 0x00,0x10, 0x00,
356 0x00,0x10, 0x00,
357 0x00,0x10, 0x00,
358 0x00,0x10, 0x00,
359 0x00,0x10, 0x00,
360 0x00,0x10, 0x00,
361 0x00,0x10, 0x00,
362 0x00,0x10, 0x00,
363 0xff,0xff, 0xfe,
364 0x00,0x10, 0x00,
365 0x00,0x10, 0x00,
366 0x00,0x10, 0x00,
367 0x00,0x10, 0x00,
368 0x00,0x10, 0x00,
369 0x00,0x10, 0x00,
370 0x00,0x10, 0x00,
371 0x00,0x10, 0x00,
372 0x00,0x10, 0x00,
373 0x00,0x10, 0x00,
374 0x00,0x10, 0x00, // PLUS 23x23 = 4.5
375
376 0x00,0x08, 0x00,0x00,
377 0x00,0x08, 0x00,0x00,
378 0x00,0x08, 0x00,0x00,
379 0x00,0x08, 0x00,0x00,
380 0x00,0x08, 0x00,0x00,
381 0x00,0x08, 0x00,0x00,
382 0x00,0x08, 0x00,0x00,
383 0x00,0x08, 0x00,0x00,
384 0x00,0x08, 0x00,0x00,
385 0x00,0x08, 0x00,0x00,
386 0x00,0x08, 0x00,0x00,
387 0x00,0x08, 0x00,0x00,
388 0xff,0xff, 0xff,0x80,
389 0x00,0x08, 0x00,0x00,
390 0x00,0x08, 0x00,0x00,
391 0x00,0x08, 0x00,0x00,
392 0x00,0x08, 0x00,0x00,
393 0x00,0x08, 0x00,0x00,
394 0x00,0x08, 0x00,0x00,
395 0x00,0x08, 0x00,0x00,
396 0x00,0x08, 0x00,0x00,
397 0x00,0x08, 0x00,0x00,
398 0x00,0x08, 0x00,0x00,
399 0x00,0x08, 0x00,0x00,
400 0x00,0x08, 0x00,0x00, // PLUS 25x25 = 5.0
401
402 0x00,0x04, 0x00,0x00,
403 0x00,0x04, 0x00,0x00,
404 0x00,0x04, 0x00,0x00,
405 0x00,0x04, 0x00,0x00,
406 0x00,0x04, 0x00,0x00,
407 0x00,0x04, 0x00,0x00,
408 0x00,0x04, 0x00,0x00,
409 0x00,0x04, 0x00,0x00,
410 0x00,0x04, 0x00,0x00,
411 0x00,0x04, 0x00,0x00,
412 0x00,0x04, 0x00,0x00,
413 0x00,0x04, 0x00,0x00,
414 0x00,0x04, 0x00,0x00,
415 0xff,0xff, 0xff,0xe0,
416 0x00,0x04, 0x00,0x00,
417 0x00,0x04, 0x00,0x00,
418 0x00,0x04, 0x00,0x00,
419 0x00,0x04, 0x00,0x00,
420 0x00,0x04, 0x00,0x00,
421 0x00,0x04, 0x00,0x00,
422 0x00,0x04, 0x00,0x00,
423 0x00,0x04, 0x00,0x00,
424 0x00,0x04, 0x00,0x00,
425 0x00,0x04, 0x00,0x00,
426 0x00,0x04, 0x00,0x00,
427 0x00,0x04, 0x00,0x00,
428 0x00,0x04, 0x00,0x00, // PLUS 27x27 = 5.5
429
430 0x00,0x02, 0x00,0x00,
431 0x00,0x02, 0x00,0x00,
432 0x00,0x02, 0x00,0x00,
433 0x00,0x02, 0x00,0x00,
434 0x00,0x02, 0x00,0x00,
435 0x00,0x02, 0x00,0x00,
436 0x00,0x02, 0x00,0x00,
437 0x00,0x02, 0x00,0x00,
438 0x00,0x02, 0x00,0x00,
439 0x00,0x02, 0x00,0x00,
440 0x00,0x02, 0x00,0x00,
441 0x00,0x02, 0x00,0x00,
442 0x00,0x02, 0x00,0x00,
443 0x00,0x02, 0x00,0x00,
444 0xff,0xff, 0xff,0xf8,
445 0x00,0x02, 0x00,0x00,
446 0x00,0x02, 0x00,0x00,
447 0x00,0x02, 0x00,0x00,
448 0x00,0x02, 0x00,0x00,
449 0x00,0x02, 0x00,0x00,
450 0x00,0x02, 0x00,0x00,
451 0x00,0x02, 0x00,0x00,
452 0x00,0x02, 0x00,0x00,
453 0x00,0x02, 0x00,0x00,
454 0x00,0x02, 0x00,0x00,
455 0x00,0x02, 0x00,0x00,
456 0x00,0x02, 0x00,0x00,
457 0x00,0x02, 0x00,0x00,
458 0x00,0x02, 0x00,0x00, // PLUS 29x29 = 6.0
459
460 0x00,0x01, 0x00,0x00,
461 0x00,0x01, 0x00,0x00,
462 0x00,0x01, 0x00,0x00,
463 0x00,0x01, 0x00,0x00,
464 0x00,0x01, 0x00,0x00,
465 0x00,0x01, 0x00,0x00,
466 0x00,0x01, 0x00,0x00,
467 0x00,0x01, 0x00,0x00,
468 0x00,0x01, 0x00,0x00,
469 0x00,0x01, 0x00,0x00,
470 0x00,0x01, 0x00,0x00,
471 0x00,0x01, 0x00,0x00,
472 0x00,0x01, 0x00,0x00,
473 0x00,0x01, 0x00,0x00,
474 0x00,0x01, 0x00,0x00,
475 0xff,0xff, 0xff,0xfd,
476 0x00,0x01, 0x00,0x00,
477 0x00,0x01, 0x00,0x00,
478 0x00,0x01, 0x00,0x00,
479 0x00,0x01, 0x00,0x00,
480 0x00,0x01, 0x00,0x00,
481 0x00,0x01, 0x00,0x00,
482 0x00,0x01, 0x00,0x00,
483 0x00,0x01, 0x00,0x00,
484 0x00,0x01, 0x00,0x00,
485 0x00,0x01, 0x00,0x00,
486 0x00,0x01, 0x00,0x00,
487 0x00,0x01, 0x00,0x00,
488 0x00,0x01, 0x00,0x00,
489 0x00,0x01, 0x00,0x00,
490 0x00,0x01, 0x00,0x00, // PLUS 31x31 = 6.5
491
492 0x00,0x00, 0x80,0x00,
493 0x00,0x00, 0x80,0x00,
494 0x00,0x00, 0x80,0x00,
495 0x00,0x00, 0x80,0x00,
496 0x00,0x00, 0x80,0x00,
497 0x00,0x00, 0x80,0x00,
498 0x00,0x00, 0x80,0x00,
499 0x00,0x00, 0x80,0x00,
500 0x00,0x00, 0x80,0x00,
501 0x00,0x00, 0x80,0x00,
502 0x00,0x00, 0x80,0x00,
503 0x00,0x00, 0x80,0x00,
504 0x00,0x00, 0x80,0x00,
505 0x00,0x00, 0x80,0x00,
506 0x00,0x00, 0x80,0x00,
507 0x00,0x00, 0x80,0x00,
508 0xff,0xff, 0xff,0xff,
509 0x00,0x00, 0x80,0x00,
510 0x00,0x00, 0x80,0x00,
511 0x00,0x00, 0x80,0x00,
512 0x00,0x00, 0x80,0x00,
513 0x00,0x00, 0x80,0x00,
514 0x00,0x00, 0x80,0x00,
515 0x00,0x00, 0x80,0x00,
516 0x00,0x00, 0x80,0x00,
517 0x00,0x00, 0x80,0x00,
518 0x00,0x00, 0x80,0x00,
519 0x00,0x00, 0x80,0x00,
520 0x00,0x00, 0x80,0x00,
521 0x00,0x00, 0x80,0x00,
522 0x00,0x00, 0x80,0x00,
523 0x00,0x00, 0x80,0x00, // PLUS 32x32 = 7.0
524
525 // TYPE = STAR
526
527 0x10,
528 0x10,
529 0xd6,
530 0x38,
531 0x10,
532 0x38,
533 0xd6,
534 0x10,
535 0x10, // STAR 7x9 = 1.0
536
537 0x08,0x00,
538 0x08,0x00,
539 0x08,0x00,
540 0xc9,0x80,
541 0x3e,0x00,
542 0x08,0x00,
543 0x3e,0x00,
544 0xc9,0x80,
545 0x08,0x00,
546 0x08,0x00,
547 0x08,0x00, // STAR 9x11 = 1.5
548
549 0x04,0x00,
550 0x04,0x00,
551 0x04,0x00,
552 0x84,0x20,
553 0x64,0xc0,
554 0x1f,0x00,
555 0x04,0x00,
556 0x1f,0x00,
557 0x64,0xc0,
558 0x84,0x20,
559 0x04,0x00,
560 0x04,0x00,
561 0x04,0x00, // STAR 11x13 = 2.0
562
563 0x02,0x00,
564 0x02,0x00,
565 0x02,0x00,
566 0x02,0x00,
567 0x82,0x18,
568 0x62,0x60,
569 0x1b,0x80,
570 0x06,0x00,
571 0x1b,0x80,
572 0x62,0x60,
573 0x82,0x18,
574 0x02,0x00,
575 0x02,0x00,
576 0x02,0x00,
577 0x02,0x00, // STAR 13x15 = 2.5
578
579 0x02,0x00,
580 0x02,0x00,
581 0x02,0x00,
582 0x02,0x00,
583 0x82,0x08,
584 0x62,0x30,
585 0x12,0x40,
586 0x0f,0x80,
587 0x02,0x00,
588 0x0f,0x80,
589 0x12,0x40,
590 0x62,0x30,
591 0x82,0x08,
592 0x02,0x00,
593 0x02,0x00,
594 0x02,0x00,
595 0x02,0x00, // STAR 13x17 = 3.0
596
597 0x01,0x00,
598 0x01,0x00,
599 0x01,0x00,
600 0x01,0x00,
601 0x01,0x00,
602 0xc1,0x06,
603 0x21,0x18,
604 0x19,0x20,
605 0x07,0xc0,
606 0x01,0x00,
607 0x07,0xc0,
608 0x19,0x20,
609 0x21,0x18,
610 0xc1,0x06,
611 0x01,0x00,
612 0x01,0x00,
613 0x01,0x00,
614 0x01,0x00,
615 0x01,0x00, // STAR 15x19 = 3.5
616
617 0x00,0x80, 0x00,
618 0x00,0x80, 0x00,
619 0x00,0x80, 0x00,
620 0x00,0x80, 0x00,
621 0x00,0x80, 0x00,
622 0x80,0x80, 0x80,
623 0x60,0x83, 0x00,
624 0x10,0x8c, 0x00,
625 0x0c,0x90, 0x00,
626 0x03,0xe0, 0x00,
627 0x00,0x80, 0x00,
628 0x03,0xe0, 0x00,
629 0x0c,0x90, 0x00,
630 0x10,0x8c, 0x00,
631 0x60,0x83, 0x00,
632 0x80,0x80, 0x80,
633 0x00,0x80, 0x00,
634 0x00,0x80, 0x00,
635 0x00,0x80, 0x00,
636 0x00,0x80, 0x00,
637 0x00,0x80, 0x00, // STAR 17x21 = 4.0
638
639 0x00,0x40, 0x00,
640 0x00,0x40, 0x00,
641 0x00,0x40, 0x00,
642 0x00,0x40, 0x00,
643 0x00,0x40, 0x00,
644 0x00,0x40, 0x00,
645 0xc0,0x40, 0x60,
646 0x30,0x41, 0x80,
647 0x08,0x42, 0x00,
648 0x06,0x4c, 0x00,
649 0x01,0xf0, 0x00,
650 0x00,0x40, 0x00,
651 0x01,0xf0, 0x00,
652 0x06,0x4c, 0x00,
653 0x08,0x42, 0x00,
654 0x30,0x41, 0x80,
655 0xc0,0x40, 0x60,
656 0x00,0x40, 0x00,
657 0x00,0x40, 0x00,
658 0x00,0x40, 0x00,
659 0x00,0x40, 0x00,
660 0x00,0x40, 0x00,
661 0x00,0x40, 0x00, // STAR 19x23 = 4.5
662
663 0x00,0x20, 0x00,
664 0x00,0x20, 0x00,
665 0x00,0x20, 0x00,
666 0x00,0x20, 0x00,
667 0x00,0x20, 0x00,
668 0x00,0x20, 0x00,
669 0x80,0x20, 0x08,
670 0x60,0x20, 0x30,
671 0x18,0x20, 0xc0,
672 0x04,0x21, 0x00,
673 0x03,0x26, 0x00,
674 0x00,0xf8, 0x00,
675 0x00,0x20, 0x00,
676 0x00,0xf8, 0x00,
677 0x03,0x26, 0x00,
678 0x04,0x21, 0x00,
679 0x18,0x20, 0xc0,
680 0x60,0x20, 0x30,
681 0x80,0x20, 0x08,
682 0x00,0x20, 0x00,
683 0x00,0x20, 0x00,
684 0x00,0x20, 0x00,
685 0x00,0x20, 0x00,
686 0x00,0x20, 0x00,
687 0x00,0x20, 0x00, // STAR 21x25 = 5.0
688
689 0x00,0x10, 0x00,
690 0x00,0x10, 0x00,
691 0x00,0x10, 0x00,
692 0x00,0x10, 0x00,
693 0x00,0x10, 0x00,
694 0x00,0x10, 0x00,
695 0x00,0x10, 0x00,
696 0xc0,0x10, 0x06,
697 0x30,0x10, 0x18,
698 0x08,0x10, 0x60,
699 0x06,0x10, 0x80,
700 0x01,0x93, 0x00,
701 0x00,0x7c, 0x00,
702 0x00,0x10, 0x00,
703 0x00,0x7c, 0x00,
704 0x01,0x93, 0x00,
705 0x06,0x10, 0x80,
706 0x08,0x10, 0x60,
707 0x30,0x10, 0x18,
708 0xc0,0x10, 0x06,
709 0x00,0x10, 0x00,
710 0x00,0x10, 0x00,
711 0x00,0x10, 0x00,
712 0x00,0x10, 0x00,
713 0x00,0x10, 0x00,
714 0x00,0x10, 0x00,
715 0x00,0x10, 0x00, // STAR 23x27 = 5.5
716
717 0x00,0x08, 0x00,0x00,
718 0x00,0x08, 0x00,0x00,
719 0x00,0x08, 0x00,0x00,
720 0x00,0x08, 0x00,0x00,
721 0x00,0x08, 0x00,0x00,
722 0x00,0x08, 0x00,0x00,
723 0x00,0x08, 0x00,0x00,
724 0x80,0x08, 0x00,0x80,
725 0x60,0x08, 0x03,0x00,
726 0x18,0x08, 0x0c,0x00,
727 0x04,0x08, 0x30,0x00,
728 0x03,0x08, 0x40,0x00,
729 0x00,0xc9, 0x80,0x00,
730 0x00,0x3e, 0x00,0x00,
731 0x00,0x08, 0x00,0x00,
732 0x00,0x3e, 0x00,0x00,
733 0x00,0xc9, 0x80,0x00,
734 0x03,0x08, 0x40,0x00,
735 0x04,0x08, 0x30,0x00,
736 0x18,0x08, 0x0c,0x00,
737 0x60,0x08, 0x03,0x00,
738 0x80,0x08, 0x00,0x80,
739 0x00,0x08, 0x00,0x00,
740 0x00,0x08, 0x00,0x00,
741 0x00,0x08, 0x00,0x00,
742 0x00,0x08, 0x00,0x00,
743 0x00,0x08, 0x00,0x00,
744 0x00,0x08, 0x00,0x00,
745 0x00,0x08, 0x00,0x00, // STAR 25x29 = 6.0
746
747 0x00,0x00, 0x80,0x00,
748 0x00,0x00, 0x80,0x00,
749 0x00,0x00, 0x80,0x00,
750 0x00,0x00, 0x80,0x00,
751 0x00,0x00, 0x80,0x00,
752 0x00,0x00, 0x80,0x00,
753 0x00,0x00, 0x80,0x00,
754 0x00,0x00, 0x80,0x00,
755 0x00,0x00, 0x80,0x00,
756 0x30,0x00, 0x80,0x06,
757 0x0c,0x00, 0x80,0x18,
758 0x03,0x00, 0x80,0x60,
759 0x00,0xc0, 0x81,0x80,
760 0x00,0x30, 0x86,0x00,
761 0x00,0x0c, 0x98,0x00,
762 0x00,0x03, 0xe0,0x00,
763 0x00,0x03, 0xe0,0x00,
764 0x00,0x0c, 0x98,0x00,
765 0x00,0x30, 0x86,0x00,
766 0x00,0xc0, 0x81,0x80,
767 0x03,0x00, 0x80,0x60,
768 0x0c,0x00, 0x80,0x18,
769 0x30,0x00, 0x80,0x06,
770 0x00,0x00, 0x80,0x00,
771 0x00,0x00, 0x80,0x00,
772 0x00,0x00, 0x80,0x00,
773 0x00,0x00, 0x80,0x00,
774 0x00,0x00, 0x80,0x00,
775 0x00,0x00, 0x80,0x00,
776 0x00,0x00, 0x80,0x00,
777 0x00,0x00, 0x00,0x00,
778 0x00,0x00, 0x00,0x00, // STAR 32x32 = 6.5
779
780 0x00, 0x00, 0x80, 0x00,
781 0x00, 0x00, 0x80, 0x00,
782 0x00, 0x00, 0x80, 0x00,
783 0x00, 0x00, 0x80, 0x00,
784 0x00, 0x00, 0x80, 0x00,
785 0x00, 0x00, 0x80, 0x00,
786 0x00, 0x00, 0x80, 0x00,
787 0x00, 0x00, 0x80, 0x00,
788 0x10, 0x00, 0x80, 0x04,
789 0x0c, 0x00, 0x80, 0x18,
790 0x02, 0x00, 0x80, 0x20,
791 0x01, 0x80, 0x80, 0xc0,
792 0x00, 0x40, 0x81, 0x00,
793 0x00, 0x30, 0x86, 0x00,
794 0x00, 0x08, 0x88, 0x00,
795 0x00, 0x06, 0xb0, 0x00,
796 0x00, 0x01, 0xc0, 0x00,
797 0x00, 0x06, 0xb0, 0x00,
798 0x00, 0x08, 0x88, 0x00,
799 0x00, 0x30, 0x86, 0x00,
800 0x00, 0x40, 0x81, 0x00,
801 0x01, 0x80, 0x80, 0xc0,
802 0x02, 0x00, 0x80, 0x20,
803 0x0c, 0x00, 0x80, 0x18,
804 0x10, 0x00, 0x80, 0x04,
805 0x00, 0x00, 0x80, 0x00,
806 0x00, 0x00, 0x80, 0x00,
807 0x00, 0x00, 0x80, 0x00,
808 0x00, 0x00, 0x80, 0x00,
809 0x00, 0x00, 0x80, 0x00,
810 0x00, 0x00, 0x80, 0x00,
811 0x00, 0x00, 0x80, 0x00, // STAR 32x32 = 7.0
812
813 // TYPE = CIRC
814
815 0x38,
816 0x44,
817 0x82,
818 0x82,
819 0x82,
820 0x44,
821 0x38, // CIRC 7x7 = 1.0
822
823 0x3c,0x00,
824 0x42,0x00,
825 0x81,0x00,
826 0x81,0x00,
827 0x81,0x00,
828 0x81,0x00,
829 0x42,0x00,
830 0x3c,0x00,
831 0x00,0x00, //CIRC 9x9 = 1.5
832
833 0x3e,0x00,
834 0x41,0x00,
835 0x81,0x80,
836 0x80,0x80,
837 0x80,0x80,
838 0x80,0x80,
839 0x81,0x80,
840 0x41,0x00,
841 0x3e,0x00, // CIRC 9x9 = 2.0
842
843 0x1f,0x00,
844 0x20,0x80,
845 0x40,0x40,
846 0x80,0x20,
847 0x80,0x20,
848 0x80,0x20,
849 0x80,0x20,
850 0x80,0x20,
851 0x40,0x40,
852 0x20,0x80,
853 0x1f,0x00, // CIRC 11x11 = 2.5
854
855 0x0f,0x80,
856 0x10,0x40,
857 0x20,0x20,
858 0x40,0x10,
859 0x80,0x08,
860 0x80,0x08,
861 0x80,0x08,
862 0x80,0x08,
863 0x80,0x08,
864 0x40,0x10,
865 0x20,0x20,
866 0x10,0x40,
867 0x0f,0x80, // CIRC 13x13 = 3.0
868
869 0x07,0xc0,
870 0x18,0x30,
871 0x20,0x08,
872 0x40,0x04,
873 0x40,0x04,
874 0x80,0x02,
875 0x80,0x02,
876 0x80,0x02,
877 0x80,0x02,
878 0x80,0x02,
879 0x40,0x04,
880 0x40,0x04,
881 0x20,0x08,
882 0x18,0x30,
883 0x07,0xc0, // CIRC 15x15 = 3.5
884
885 0x03,0xe0, 0x00,
886 0x0c,0x18, 0x00,
887 0x10,0x04, 0x00,
888 0x20,0x02, 0x00,
889 0x40,0x01, 0x00,
890 0x40,0x01, 0x00,
891 0x80,0x00, 0x80,
892 0x80,0x00, 0x80,
893 0x80,0x00, 0x80,
894 0x80,0x00, 0x80,
895 0x80,0x00, 0x80,
896 0x40,0x01, 0x00,
897 0x40,0x01, 0x00,
898 0x20,0x02, 0x00,
899 0x10,0x04, 0x00,
900 0x0c,0x18, 0x00,
901 0x03,0xe0, 0x00, // CIRC 17x17 = 4.0
902
903 0x03,0xf8, 0x00,
904 0x0e,0x0e, 0x00,
905 0x18,0x03, 0x00,
906 0x20,0x00, 0x80,
907 0x60,0x00, 0xc0,
908 0x40,0x00, 0x40,
909 0xc0,0x00, 0x60,
910 0x80,0x00, 0x20,
911 0x80,0x00, 0x20,
912 0x80,0x00, 0x20,
913 0x80,0x00, 0x20,
914 0x80,0x00, 0x20,
915 0xc0,0x00, 0x60,
916 0x40,0x00, 0x40,
917 0x60,0x00, 0xc0,
918 0x20,0x00, 0x80,
919 0x18,0x03, 0x00,
920 0x0e,0x0e, 0x00,
921 0x03,0xf8, 0x00, // CIRC 19x19 = 4.5
922
923 0x01,0xfc, 0x00,
924 0x06,0x03, 0x00,
925 0x08,0x00, 0x80,
926 0x10,0x00, 0x40,
927 0x20,0x00, 0x20,
928 0x40,0x00, 0x10,
929 0x40,0x00, 0x10,
930 0x80,0x00, 0x08,
931 0x80,0x00, 0x08,
932 0x80,0x00, 0x08,
933 0x80,0x00, 0x08,
934 0x80,0x00, 0x08,
935 0x80,0x00, 0x08,
936 0x80,0x00, 0x08,
937 0x40,0x00, 0x10,
938 0x40,0x00, 0x10,
939 0x20,0x00, 0x20,
940 0x10,0x00, 0x40,
941 0x08,0x00, 0x80,
942 0x06,0x03, 0x00,
943 0x01,0xfc, 0x00, // CIRC 21x21 = 5.0
944
945 0x00,0xfe, 0x00,
946 0x03,0x01, 0x80,
947 0x0c,0x00, 0x60,
948 0x18,0x00, 0x30,
949 0x30,0x00, 0x18,
950 0x20,0x00, 0x08,
951 0x40,0x00, 0x04,
952 0x40,0x00, 0x04,
953 0x80,0x00, 0x02,
954 0x80,0x00, 0x02,
955 0x80,0x00, 0x02,
956 0x80,0x00, 0x02,
957 0x80,0x00, 0x02,
958 0x80,0x00, 0x02,
959 0x80,0x00, 0x02,
960 0x40,0x00, 0x04,
961 0x40,0x00, 0x04,
962 0x20,0x00, 0x08,
963 0x30,0x00, 0x18,
964 0x18,0x00, 0x30,
965 0x0c,0x00, 0x60,
966 0x03,0x01, 0x80,
967 0x00,0xfe, 0x00, // CIRC 23x23 = 5.5
968
969 0x00,0x7f, 0x00,0x00,
970 0x01,0x80, 0xc0,0x00,
971 0x06,0x00, 0x30,0x00,
972 0x08,0x00, 0x08,0x00,
973 0x10,0x00, 0x04,0x00,
974 0x20,0x00, 0x02,0x00,
975 0x20,0x00, 0x02,0x00,
976 0x40,0x00, 0x01,0x00,
977 0x40,0x00, 0x01,0x00,
978 0x80,0x00, 0x00,0x80,
979 0x80,0x00, 0x00,0x80,
980 0x80,0x00, 0x00,0x80,
981 0x80,0x00, 0x00,0x80,
982 0x80,0x00, 0x00,0x80,
983 0x80,0x00, 0x00,0x80,
984 0x80,0x00, 0x00,0x80,
985 0x40,0x00, 0x01,0x00,
986 0x40,0x00, 0x01,0x00,
987 0x20,0x00, 0x02,0x00,
988 0x20,0x00, 0x02,0x00,
989 0x10,0x00, 0x04,0x00,
990 0x08,0x00, 0x08,0x00,
991 0x06,0x00, 0x30,0x00,
992 0x01,0x80, 0xc0,0x00,
993 0x00,0x7f, 0x00,0x00, // CIRC 25x25 = 6.0
994
995 0x00,0x3f, 0x80,0x00,
996 0x01,0xc0, 0x70,0x00,
997 0x03,0x00, 0x18,0x00,
998 0x0c,0x00, 0x06,0x00,
999 0x18,0x00, 0x03,0x00,
1000 0x10,0x00, 0x01,0x00,
1001 0x20,0x00, 0x00,0x80,
1002 0x60,0x00, 0x00,0xc0,
1003 0x40,0x00, 0x00,0x40,
1004 0x40,0x00, 0x00,0x40,
1005 0x80,0x00, 0x00,0x20,
1006 0x80,0x00, 0x00,0x20,
1007 0x80,0x00, 0x00,0x20,
1008 0x80,0x00, 0x00,0x20,
1009 0x80,0x00, 0x00,0x20,
1010 0x80,0x00, 0x00,0x20,
1011 0x80,0x00, 0x00,0x20,
1012 0x40,0x00, 0x00,0x40,
1013 0x40,0x00, 0x00,0x40,
1014 0x60,0x00, 0x00,0xc0,
1015 0x20,0x00, 0x00,0x80,
1016 0x10,0x00, 0x01,0x00,
1017 0x18,0x00, 0x03,0x00,
1018 0x0c,0x00, 0x06,0x00,
1019 0x03,0x00, 0x18,0x00,
1020 0x01,0xc0, 0x70,0x00,
1021 0x00,0x3f, 0x80,0x00, // CIRC 27x27 = 6.5
1022
1023 0x00,0x1f, 0xc0,0x00,
1024 0x00,0xe0, 0x38,0x00,
1025 0x01,0x00, 0x04,0x00,
1026 0x06,0x00, 0x03,0x00,
1027 0x08,0x00, 0x00,0x80,
1028 0x10,0x00, 0x00,0x40,
1029 0x10,0x00, 0x00,0x40,
1030 0x20,0x00, 0x00,0x20,
1031 0x40,0x00, 0x00,0x10,
1032 0x40,0x00, 0x00,0x10,
1033 0x40,0x00, 0x00,0x10,
1034 0x80,0x00, 0x00,0x08,
1035 0x80,0x00, 0x00,0x08,
1036 0x80,0x00, 0x00,0x08,
1037 0x80,0x00, 0x00,0x08,
1038 0x80,0x00, 0x00,0x08,
1039 0x80,0x00, 0x00,0x08,
1040 0x80,0x00, 0x00,0x08,
1041 0x40,0x00, 0x00,0x10,
1042 0x40,0x00, 0x00,0x10,
1043 0x40,0x00, 0x00,0x10,
1044 0x20,0x00, 0x00,0x20,
1045 0x10,0x00, 0x00,0x40,
1046 0x10,0x00, 0x00,0x40,
1047 0x08,0x00, 0x00,0x80,
1048 0x06,0x00, 0x03,0x00,
1049 0x01,0x00, 0x04,0x00,
1050 0x00,0xe0, 0x38,0x00,
1051 0x00,0x1f, 0xc0,0x00, // CIRC 29x29 = 7.0
1052
1053 // TYPE = CROSS
1054
1055 0x82,
1056 0x44,
1057 0x28,
1058 0x10,
1059 0x28,
1060 0x44,
1061 0x82, // CROSS 7x7 = 1.0
1062
1063 0x80,0x80,
1064 0x41,0x00,
1065 0x22,0x00,
1066 0x14,0x00,
1067 0x08,0x00,
1068 0x14,0x00,
1069 0x22,0x00,
1070 0x41,0x00,
1071 0x80,0x80, // CROSS 9x9 = 1.5
1072
1073 0x80,0x20,
1074 0x40,0x40,
1075 0x20,0x80,
1076 0x11,0x00,
1077 0x0a,0x00,
1078 0x04,0x00,
1079 0x0a,0x00,
1080 0x11,0x00,
1081 0x20,0x80,
1082 0x40,0x40,
1083 0x80,0x20, // CROSS 11x11 = 2.0
1084
1085 0x80,0x08,
1086 0x40,0x10,
1087 0x20,0x20,
1088 0x10,0x40,
1089 0x08,0x80,
1090 0x05,0x00,
1091 0x02,0x00,
1092 0x05,0x00,
1093 0x08,0x80,
1094 0x10,0x40,
1095 0x20,0x20,
1096 0x40,0x10,
1097 0x80,0x08, // CROSS 13x13 = 2.5
1098
1099 0x80,0x02,
1100 0x40,0x04,
1101 0x20,0x08,
1102 0x10,0x10,
1103 0x08,0x20,
1104 0x04,0x40,
1105 0x02,0x80,
1106 0x01,0x00,
1107 0x02,0x80,
1108 0x04,0x40,
1109 0x08,0x20,
1110 0x10,0x10,
1111 0x20,0x08,
1112 0x40,0x04,
1113 0x80,0x02, // CROSS 15x15 = 3.0
1114
1115 0x80,0x00, 0x80,
1116 0x40,0x01, 0x00,
1117 0x20,0x02, 0x00,
1118 0x10,0x04, 0x00,
1119 0x08,0x08, 0x00,
1120 0x04,0x10, 0x00,
1121 0x02,0x20, 0x00,
1122 0x01,0x40, 0x00,
1123 0x00,0x80, 0x00,
1124 0x01,0x40, 0x00,
1125 0x02,0x20, 0x00,
1126 0x04,0x10, 0x00,
1127 0x08,0x08, 0x00,
1128 0x10,0x04, 0x00,
1129 0x20,0x02, 0x00,
1130 0x40,0x01, 0x00,
1131 0x80,0x00, 0x80, // CROSS 17x17 = 3.5
1132
1133 0x80,0x00, 0x20,
1134 0x40,0x00, 0x40,
1135 0x20,0x00, 0x80,
1136 0x10,0x01, 0x00,
1137 0x08,0x02, 0x00,
1138 0x04,0x04, 0x00,
1139 0x02,0x08, 0x00,
1140 0x01,0x10, 0x00,
1141 0x00,0xa0, 0x00,
1142 0x00,0x40, 0x00,
1143 0x00,0xa0, 0x00,
1144 0x01,0x10, 0x00,
1145 0x02,0x08, 0x00,
1146 0x04,0x04, 0x00,
1147 0x08,0x02, 0x00,
1148 0x10,0x01, 0x00,
1149 0x20,0x00, 0x80,
1150 0x40,0x00, 0x40,
1151 0x80,0x00, 0x20, // CROSS 19x19 = 4.0
1152
1153 0x80,0x00, 0x08,
1154 0x40,0x00, 0x10,
1155 0x20,0x00, 0x20,
1156 0x10,0x00, 0x40,
1157 0x08,0x00, 0x80,
1158 0x04,0x01, 0x00,
1159 0x02,0x02, 0x00,
1160 0x01,0x04, 0x00,
1161 0x00,0x88, 0x00,
1162 0x00,0x50, 0x00,
1163 0x00,0x20, 0x00,
1164 0x00,0x50, 0x00,
1165 0x00,0x88, 0x00,
1166 0x01,0x04, 0x00,
1167 0x02,0x02, 0x00,
1168 0x04,0x01, 0x00,
1169 0x08,0x00, 0x80,
1170 0x10,0x00, 0x40,
1171 0x20,0x00, 0x20,
1172 0x40,0x00, 0x10,
1173 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */
1174
1175 0x80,0x00, 0x02,
1176 0x40,0x00, 0x04,
1177 0x20,0x00, 0x08,
1178 0x10,0x00, 0x10,
1179 0x08,0x00, 0x20,
1180 0x04,0x00, 0x40,
1181 0x02,0x00, 0x80,
1182 0x01,0x01, 0x00,
1183 0x00,0x82, 0x00,
1184 0x00,0x44, 0x00,
1185 0x00,0x28, 0x00,
1186 0x00,0x10, 0x00,
1187 0x00,0x28, 0x00,
1188 0x00,0x44, 0x00,
1189 0x00,0x82, 0x00,
1190 0x01,0x01, 0x00,
1191 0x02,0x00, 0x80,
1192 0x04,0x00, 0x40,
1193 0x08,0x00, 0x20,
1194 0x10,0x00, 0x10,
1195 0x20,0x00, 0x08,
1196 0x40,0x00, 0x04,
1197 0x80,0x00, 0x02, // CROSS 23x23 = 5.0
1198
1199 0x80,0x00, 0x00,0x80,
1200 0x40,0x00, 0x01,0x00,
1201 0x20,0x00, 0x02,0x00,
1202 0x10,0x00, 0x04,0x00,
1203 0x08,0x00, 0x08,0x00,
1204 0x04,0x00, 0x10,0x00,
1205 0x02,0x00, 0x20,0x00,
1206 0x01,0x00, 0x40,0x00,
1207 0x00,0x80, 0x80,0x00,
1208 0x00,0x41, 0x00,0x00,
1209 0x00,0x22, 0x00,0x00,
1210 0x00,0x14, 0x00,0x00,
1211 0x00,0x08, 0x00,0x00,
1212 0x00,0x14, 0x00,0x00,
1213 0x00,0x22, 0x00,0x00,
1214 0x00,0x41, 0x00,0x00,
1215 0x00,0x80, 0x80,0x00,
1216 0x01,0x00, 0x40,0x00,
1217 0x02,0x00, 0x20,0x00,
1218 0x04,0x00, 0x10,0x00,
1219 0x08,0x00, 0x08,0x00,
1220 0x10,0x00, 0x04,0x00,
1221 0x20,0x00, 0x02,0x00,
1222 0x40,0x00, 0x01,0x00,
1223 0x80,0x00, 0x00,0x80, // CROSS 25x25 = 5.5
1224
1225 0x80,0x00, 0x00,0x20,
1226 0x40,0x00, 0x00,0x40,
1227 0x20,0x00, 0x00,0x80,
1228 0x10,0x00, 0x01,0x00,
1229 0x08,0x00, 0x02,0x00,
1230 0x04,0x00, 0x04,0x00,
1231 0x02,0x00, 0x08,0x00,
1232 0x01,0x00, 0x10,0x00,
1233 0x00,0x80, 0x20,0x00,
1234 0x00,0x40, 0x40,0x00,
1235 0x00,0x20, 0x80,0x00,
1236 0x00,0x11, 0x00,0x00,
1237 0x00,0x0a, 0x00,0x00,
1238 0x00,0x04, 0x00,0x00,
1239 0x00,0x0a, 0x00,0x00,
1240 0x00,0x11, 0x00,0x00,
1241 0x00,0x20, 0x80,0x00,
1242 0x00,0x40, 0x40,0x00,
1243 0x00,0x80, 0x20,0x00,
1244 0x01,0x00, 0x10,0x00,
1245 0x02,0x00, 0x08,0x00,
1246 0x04,0x00, 0x04,0x00,
1247 0x08,0x00, 0x02,0x00,
1248 0x10,0x00, 0x01,0x00,
1249 0x20,0x00, 0x00,0x80,
1250 0x40,0x00, 0x00,0x40,
1251 0x80,0x00, 0x00,0x20, // CROSS 27x27 = 6.0
1252
1253 0x00,0x00, 0x00,0x00,
1254 0x00,0x00, 0x00,0x00,
1255 0x20,0x00, 0x00,0x04,
1256 0x10,0x00, 0x00,0x08,
1257 0x08,0x00, 0x00,0x10,
1258 0x04,0x00, 0x00,0x20,
1259 0x02,0x00, 0x00,0x40,
1260 0x01,0x00, 0x00,0x80,
1261 0x00,0x80, 0x01,0x00,
1262 0x00,0x40, 0x02,0x00,
1263 0x00,0x20, 0x04,0x00,
1264 0x00,0x10, 0x08,0x00,
1265 0x00,0x08, 0x10,0x00,
1266 0x00,0x04, 0x20,0x00,
1267 0x00,0x02, 0x40,0x00,
1268 0x00,0x01, 0x80,0x00,
1269 0x00,0x01, 0x80,0x00,
1270 0x00,0x02, 0x40,0x00,
1271 0x00,0x04, 0x20,0x00,
1272 0x00,0x08, 0x10,0x00,
1273 0x00,0x10, 0x08,0x00,
1274 0x00,0x20, 0x04,0x00,
1275 0x00,0x40, 0x02,0x00,
1276 0x00,0x80, 0x01,0x00,
1277 0x01,0x00, 0x00,0x80,
1278 0x02,0x00, 0x00,0x40,
1279 0x04,0x00, 0x00,0x20,
1280 0x08,0x00, 0x00,0x10,
1281 0x10,0x00, 0x00,0x08,
1282 0x20,0x00, 0x00,0x04,
1283 0x00,0x00, 0x00,0x00,
1284 0x00,0x00, 0x00,0x00, // CROSS 32x32 = 6.5
1285
1286 0x00,0x00, 0x00,0x00,
1287 0x40,0x00, 0x00,0x02,
1288 0x20,0x00, 0x00,0x04,
1289 0x10,0x00, 0x00,0x08,
1290 0x08,0x00, 0x00,0x10,
1291 0x04,0x00, 0x00,0x20,
1292 0x02,0x00, 0x00,0x40,
1293 0x01,0x00, 0x00,0x80,
1294 0x00,0x80, 0x01,0x00,
1295 0x00,0x40, 0x02,0x00,
1296 0x00,0x20, 0x04,0x00,
1297 0x00,0x10, 0x08,0x00,
1298 0x00,0x08, 0x10,0x00,
1299 0x00,0x04, 0x20,0x00,
1300 0x00,0x02, 0x40,0x00,
1301 0x00,0x01, 0x80,0x00,
1302 0x00,0x01, 0x80,0x00,
1303 0x00,0x02, 0x40,0x00,
1304 0x00,0x04, 0x20,0x00,
1305 0x00,0x08, 0x10,0x00,
1306 0x00,0x10, 0x08,0x00,
1307 0x00,0x20, 0x04,0x00,
1308 0x00,0x40, 0x02,0x00,
1309 0x00,0x80, 0x01,0x00,
1310 0x01,0x00, 0x00,0x80,
1311 0x02,0x00, 0x00,0x40,
1312 0x04,0x00, 0x00,0x20,
1313 0x08,0x00, 0x00,0x10,
1314 0x10,0x00, 0x00,0x08,
1315 0x20,0x00, 0x00,0x04,
1316 0x40,0x00, 0x00,0x02,
1317 0x00,0x00, 0x00,0x00 // CROSS 32x32 = 7.0
1318};
1319
1320// =======================================================================
1321// function : GetMarkerBitMapArray
1322// purpose : Returns a parameters for the marker of the specified
1323// type and scale.
1324// =======================================================================
1325void GetMarkerBitMapParam (const Aspect_TypeOfMarker theMarkerType,
1326 const Standard_ShortReal& theScale,
1327 Standard_Integer& theWidth,
1328 Standard_Integer& theHeight,
1329 Standard_Integer& theOffset,
1330 Standard_Integer& theNumOfBytes)
1331{
1332 const Standard_Integer aType = (Standard_Integer )((theMarkerType > Aspect_TOM_O) ? Aspect_TOM_O : theMarkerType);
1333 const Standard_Real anIndex = (Standard_Real )(TEL_NO_OF_SIZES - 1) * (theScale - (Standard_Real )TEL_PM_START_SIZE)
1334 / (Standard_Real )(TEL_PM_END_SIZE - TEL_PM_START_SIZE);
1335 Standard_Integer anId = (Standard_Integer )(anIndex + 0.5);
1336 if (anId < 0)
1337 {
1338 anId = 0;
1339 }
1340 else if (anId >= TEL_NO_OF_SIZES)
1341 {
1342 anId = TEL_NO_OF_SIZES - 1;
1343 }
1344
1345 theWidth = (Standard_Integer )arrPMFontInfo[aType][anId].width;
1346 theHeight = (Standard_Integer )arrPMFontInfo[aType][anId].height;
1347 theOffset = arrPMFontInfo[aType][anId].offset;
1348 const Standard_Integer aNumOfBytesInRow = theWidth / 8 + (theWidth % 8 ? 1 : 0);
1349 theNumOfBytes = theHeight * aNumOfBytesInRow;
1350}
1351
1352// =======================================================================
1353// function : GetTextureImage
1354// purpose : Returns a marker image for the marker of the specified
1355// type and scale.
1356// =======================================================================
1357Handle(Graphic3d_MarkerImage) GetTextureImage (const Aspect_TypeOfMarker theMarkerType,
1358 const Standard_ShortReal& theScale)
1359{
1360 Standard_Integer aWidth, aHeight, anOffset, aNumOfBytes;
1361 GetMarkerBitMapParam (theMarkerType, theScale, aWidth, aHeight, anOffset, aNumOfBytes);
1362
1363 Handle(TColStd_HArray1OfByte) aBitMap = new TColStd_HArray1OfByte (0, aNumOfBytes - 1);
1364 for (Standard_Integer anIter = 0; anIter < aNumOfBytes; anIter++)
1365 {
1366 aBitMap->ChangeValue (anIter) = OpenGl_AspectMarker_myMarkerRaster[anOffset + anIter];
1367 }
1368
1369 Handle(Graphic3d_MarkerImage) aTexture = new Graphic3d_MarkerImage (aBitMap, aWidth, aHeight);
1370 return aTexture;
2166f0fa
SK
1371}
1372
a577aaab 1373// =======================================================================
1374// function : MergeImages
1375// purpose : Merge two image pixmap into one. Used for creating image for
1376// following markers: Aspect_TOM_O_POINT, Aspect_TOM_O_PLUS,
1377// Aspect_TOM_O_STAR, Aspect_TOM_O_X, Aspect_TOM_RING1,
1378// Aspect_TOM_RING2, Aspect_TOM_RING3
1379// =======================================================================
1380Handle(Image_PixMap) MergeImages (const Handle(Image_PixMap)& theImage1,
1381 const Handle(Image_PixMap)& theImage2)
1382{
1383 if (theImage1.IsNull() && theImage2.IsNull())
1384 {
1385 return Handle(Image_PixMap)();
1386 }
1387
1388 Handle(Image_PixMap) aResultImage = new Image_PixMap();
1389
1390 Standard_Integer aWidth1 (0), aHeight1 (0);
1391 if (!theImage1.IsNull())
1392 {
1393 aWidth1 = (Standard_Integer )theImage1->Width();
1394 aHeight1 = (Standard_Integer )theImage1->Height();
1395 }
1396
1397 Standard_Integer aWidth2 (0), aHeight2 (0);
1398 if (!theImage2.IsNull())
1399 {
1400 aWidth2 = (Standard_Integer )theImage2->Width();
1401 aHeight2 = (Standard_Integer )theImage2->Height();
1402 }
1403
1404 const Standard_Integer aMaxWidth = Max (aWidth1, aWidth2);
1405 const Standard_Integer aMaxHeight = Max (aHeight1, aHeight2);
1406 const Standard_Integer aSize = Max (aMaxWidth, aMaxHeight);
1407
1408 aResultImage->InitZero (Image_PixMap::ImgGray, aSize, aSize);
1409
1410 if (!theImage1.IsNull())
1411 {
1412 const Standard_Integer aXOffset1 = Abs (aWidth1 - aMaxWidth) / 2;
1413 const Standard_Integer anYOffset1 = Abs (aHeight1 - aMaxHeight) / 2;
1414 for (Standard_Integer anY = 0; anY < aHeight1; anY++)
1415 {
1416 Standard_Byte* anImageLine = theImage1->ChangeRow (anY);
1417 Standard_Byte* aResultImageLine = aResultImage->ChangeRow (anYOffset1 + anY);
1418 for (Standard_Integer aX = 0; aX < aWidth1; aX++)
1419 {
1420 aResultImageLine[aXOffset1 + aX] |= anImageLine[aX];
1421 }
1422 }
1423 }
1424
1425 if (!theImage2.IsNull())
1426 {
1427 const Standard_Integer aXOffset2 = Abs (aWidth2 - aMaxWidth) / 2;
1428 const Standard_Integer anYOffset2 = Abs (aHeight2 - aMaxHeight) / 2;
1429 for (Standard_Integer anY = 0; anY < aHeight2; anY++)
1430 {
1431 Standard_Byte* anImageLine = theImage2->ChangeRow (anY);
1432 Standard_Byte* aResultImageLine = aResultImage->ChangeRow (anYOffset2 + anY);
1433 for (Standard_Integer aX = 0; aX < aWidth2; aX++)
1434 {
1435 aResultImageLine[aXOffset2 + aX] |= anImageLine[aX];
1436 }
1437 }
1438 }
1439
1440 return aResultImage;
1441}
1442
1443// =======================================================================
1444// function : OpenGl_AspectMarker
1445// purpose :
1446// =======================================================================
1447OpenGl_AspectMarker::OpenGl_AspectMarker()
1448 : myColor (myDefaultColor),
1449 myType (Aspect_TOM_PLUS),
1450 myScale (1.0f),
fd4a6963 1451 myMarkerImage(),
a577aaab 1452 myMarkerSize (1.0f),
1453 mySpriteKey (""),
fd4a6963 1454 mySpriteAKey (""),
1455 myIsSpriteInit (Standard_False)
a577aaab 1456{}
1457
1458// =======================================================================
fd4a6963 1459// function : SetAspect
a577aaab 1460// purpose :
1461// =======================================================================
fd4a6963 1462void OpenGl_AspectMarker::SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect)
a577aaab 1463{
1464 myColor.rgb[0] = (float )theAspect.Color.r;
1465 myColor.rgb[1] = (float )theAspect.Color.g;
1466 myColor.rgb[2] = (float )theAspect.Color.b;
1467 myColor.rgb[3] = 1.0f;
fd4a6963 1468 myMarkerImage = theAspect.MarkerImage;
1469 myType = theAspect.MarkerType;
a577aaab 1470 myScale = myMarkerSize = theAspect.Scale;
1471
fd4a6963 1472 // check that the resources need to be renewed
a577aaab 1473 TCollection_AsciiString aNewKey, aNewKeyA;
fd4a6963 1474 resourceKeys (myMarkerImage, myType, myScale, myColor, aNewKey, aNewKeyA);
1475 myIsSpriteInit = !aNewKey.IsEmpty() && mySpriteKey == aNewKey;
1476 myIsSpriteInit &= !aNewKeyA.IsEmpty() && mySpriteAKey == aNewKeyA;
1477}
1478
1479// =======================================================================
1480// function : buildSprites
1481// purpose :
1482// =======================================================================
1483void OpenGl_AspectMarker::buildSprites (const Handle(OpenGl_Workspace)& theWorkspace) const
1484{
1485 const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
1486
1487 TCollection_AsciiString aNewKey, aNewKeyA;
1488 resourceKeys (myMarkerImage, myType, myMarkerSize, myColor, aNewKey, aNewKeyA);
a577aaab 1489
1490 // release old shared resources
1491 const Standard_Boolean aNewResource = aNewKey.IsEmpty() || mySpriteKey != aNewKey;
1492 if (aNewResource)
1493 {
1494 if (!mySprite.IsNull())
1495 {
1496 if (mySpriteKey.IsEmpty())
1497 {
fd4a6963 1498 aContext->DelayedRelease (mySprite);
a577aaab 1499 mySprite.Nullify();
1500 }
1501 else
1502 {
1503 mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call
fd4a6963 1504 aContext->ReleaseResource (mySpriteKey);
a577aaab 1505 }
1506 }
1507 mySpriteKey = aNewKey;
1508 }
1509 if (aNewKeyA.IsEmpty()
1510 || mySpriteAKey != aNewKeyA)
1511 {
1512 if (!mySpriteA.IsNull())
1513 {
1514 if (mySpriteAKey.IsEmpty())
1515 {
fd4a6963 1516 aContext->DelayedRelease (mySpriteA);
a577aaab 1517 mySpriteA.Nullify();
1518 }
1519 else
1520 {
1521 mySpriteA.Nullify(); // we need nullify all handles before ReleaseResource() call
fd4a6963 1522 aContext->ReleaseResource (mySpriteKey);
a577aaab 1523 }
1524 }
1525 mySpriteAKey = aNewKeyA;
1526 }
1527 if (myType == Aspect_TOM_POINT
1528 || !aNewResource
fd4a6963 1529 || (myType == Aspect_TOM_USERDEFINED && myMarkerImage.IsNull()))
a577aaab 1530 {
1531 // nothing to do - just simple point
1532 return;
1533 }
1534
1535 if (!aNewKey.IsEmpty()
fd4a6963 1536 && aContext->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, mySpriteA) // alpha sprite could be shared
1537 && aContext->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, mySprite))
a577aaab 1538 {
1539 // reuse shared resource
1540 if (!mySprite->IsDisplayList())
1541 {
1542 myMarkerSize = Standard_ShortReal (Max (mySprite->SizeX(), mySprite->SizeY()));
1543 }
1544 return;
1545 }
1546
18e85574 1547 const bool hadAlreadyAlpha = !mySpriteA.IsNull();
1548 if (!hadAlreadyAlpha)
1549 {
1550 mySpriteA = new OpenGl_PointSprite();
1551 }
a577aaab 1552 mySprite = new OpenGl_PointSprite();
a577aaab 1553 if (!aNewKey.IsEmpty())
1554 {
fd4a6963 1555 aContext->ShareResource (aNewKey, mySprite);
18e85574 1556 if (!hadAlreadyAlpha)
1557 {
fd4a6963 1558 aContext->ShareResource (aNewKeyA, mySpriteA);
18e85574 1559 }
a577aaab 1560 }
1561
fd4a6963 1562 if (!aContext.IsNull()
1563 && aContext->IsGlGreaterEqual (2, 0)
1564 && !aContext->caps->pntSpritesDisable)
a577aaab 1565 {
1566 // Creating texture resource for using it with point sprites
1567 Handle(Graphic3d_MarkerImage) aNewMarkerImage;
1568 Handle(Image_PixMap) anImage, anImageA;
1569
fd4a6963 1570 if (myType == Aspect_TOM_USERDEFINED && !myMarkerImage.IsNull())
a577aaab 1571 {
fd4a6963 1572 aNewMarkerImage = myMarkerImage;
a577aaab 1573 anImage = aNewMarkerImage->GetImage();
1574 }
1575 else
1576 {
1577 // Creating image from default bitmap
1578 Handle(TColStd_HArray1OfByte) aBitMap;
1579 Handle(Graphic3d_MarkerImage) aMarkerImage1, aMarkerImage2;
1580
1581 const Standard_ShortReal aDelta = 0.1F;
1582 Standard_ShortReal aScale = myScale;
1583 Standard_ShortReal aLimit = 0.0F;
1584
1585 switch (myType)
1586 {
1587 case Aspect_TOM_O_POINT:
1588 {
1589 const Standard_Integer aSize = myScale > 7 ? 7 : (Standard_Integer )(myScale + 0.5F);
1590 const Standard_Integer aNumOfBytes = (aSize / 8 + (aSize % 8 ? 1 : 0)) * aSize;
1591 aBitMap = new TColStd_HArray1OfByte (0, aNumOfBytes - 1);
1592 for (Standard_Integer anIter = 0; anIter < aBitMap->Length(); anIter++)
1593 {
1594 aBitMap->SetValue (anIter, 255);
1595 }
1596 aMarkerImage2 = new Graphic3d_MarkerImage (aBitMap, aSize, aSize);
1597 }
1598 case Aspect_TOM_O_PLUS:
1599 case Aspect_TOM_O_STAR:
1600 case Aspect_TOM_O_X:
1601 {
1602 // For this type of markers we merge two base bitmaps into one
1603 // For example Aspect_TOM_O_PLUS = Aspect_TOM_O + Aspect_TOM_PLUS
1604 aMarkerImage1 = GetTextureImage (Aspect_TOM_O, myScale);
1605 if (myType != Aspect_TOM_O_POINT)
1606 {
1607 aMarkerImage2 = GetTextureImage (Aspect_TypeOfMarker (myType - Aspect_TOM_O_POINT), myScale);
1608 }
1609 anImage = MergeImages (aMarkerImage1->GetImage(), aMarkerImage2->GetImage());
1610 aNewMarkerImage = new Graphic3d_MarkerImage (anImage);
1611 break;
1612 }
1613 case Aspect_TOM_RING1:
1614 if (aLimit == 0.0f) aLimit = aScale * 0.2f;
1615 case Aspect_TOM_RING2:
1616 if (aLimit == 0.0f) aLimit = aScale * 0.5f;
1617 case Aspect_TOM_RING3:
1618 {
1619 if (aLimit == 0.0f) aLimit = aScale * 0.8f;
1620 for (; aScale > aLimit && aScale >= 1.0f; aScale -= aDelta)
1621 {
1622 anImage = MergeImages (anImage, GetTextureImage (Aspect_TOM_O, aScale)->GetImage());
1623 }
1624 aNewMarkerImage = new Graphic3d_MarkerImage (anImage);
1625 break;
1626 }
1627 case Aspect_TOM_BALL:
1628 {
1629 Standard_Integer aWidth, aHeight, anOffset, aNumOfBytes;
1630 GetMarkerBitMapParam (Aspect_TOM_O, aScale, aWidth, aHeight, anOffset, aNumOfBytes);
1631
1632 const Standard_ShortReal aDelta = 0.1f;
1633 NCollection_Vec4<Standard_Real> aColor (Standard_Real (myColor.rgb[0]),
1634 Standard_Real (myColor.rgb[1]),
1635 Standard_Real (myColor.rgb[2]),
1636 Standard_Real (myColor.rgb[3]));
1637
1638 const Standard_Integer aSize = Max (aWidth + 2, aHeight + 2); // includes extra margin
1639 anImage = new Image_PixMap();
1640 anImageA = new Image_PixMap();
1641 anImage ->InitZero (Image_PixMap::ImgBGRA, aSize, aSize);
1642 anImageA->InitZero (Image_PixMap::ImgGray, aSize, aSize);
1643 Image_PixMapData<Image_ColorBGRA>& aDataBGRA = anImage->EditData<Image_ColorBGRA>();
1644 Image_PixMapData<Standard_Byte>& aDataGray = anImageA->EditData<Standard_Byte>();
1645
1646 // we draw a set of circles
1647 Image_ColorBGRA aColor32;
1648 aColor32.a() = 255;
1649 Standard_Real aHLS[3];
1650 while (aScale >= 1.0f)
1651 {
1652 Quantity_Color::RgbHls (aColor.r(), aColor.g(), aColor.b(), aHLS[0], aHLS[1], aHLS[2]);
1653 aHLS[2] *= 0.95; // 5% saturation change
1654 Quantity_Color::HlsRgb (aHLS[0], aHLS[1], aHLS[2], aColor.r(), aColor.g(), aColor.b());
1655 aColor32.r() = Standard_Byte(255.0 * aColor.r());
1656 aColor32.g() = Standard_Byte(255.0 * aColor.g());
1657 aColor32.b() = Standard_Byte(255.0 * aColor.b());
1658
1659 const Handle(Graphic3d_MarkerImage) aMarker = GetTextureImage (Aspect_TOM_O, aScale);
1660 const Handle(Image_PixMap)& aCircle = aMarker->GetImage();
1661
1662 const Standard_Size aDiffX = (aDataBGRA.SizeX() - aCircle->SizeX()) / 2;
1663 const Standard_Size aDiffY = (aDataBGRA.SizeY() - aCircle->SizeY()) / 2;
1664 for (Standard_Size aRow = 0; aRow < aCircle->SizeY(); ++aRow)
1665 {
1666 const Standard_Byte* aRowData = aCircle->Row (aRow);
1667 for (Standard_Size aCol = 0; aCol < aCircle->SizeX(); ++aCol)
1668 {
1669 if (aRowData[aCol] != 0)
1670 {
1671 aDataBGRA.ChangeValue (aDiffX + aRow, aDiffY + aCol) = aColor32;
1672 aDataGray.ChangeValue (aDiffX + aRow, aDiffY + aCol) = 255;
1673 }
1674 }
1675 }
1676 aScale -= aDelta;
1677 }
1678 break;
1679 }
1680 default:
1681 {
1682 aNewMarkerImage = GetTextureImage (myType, myScale);
1683 anImage = aNewMarkerImage->GetImage();
1684 break;
1685 }
1686 }
1687 }
1688
1689 myMarkerSize = Max ((Standard_ShortReal )anImage->Width(),(Standard_ShortReal )anImage->Height());
1690
fd4a6963 1691 mySprite->Init (aContext, *anImage.operator->(), Graphic3d_TOT_2D);
18e85574 1692 if (!hadAlreadyAlpha)
a577aaab 1693 {
18e85574 1694 if (anImageA.IsNull()
1695 && mySprite->GetFormat() != GL_ALPHA8
1696 && !aNewMarkerImage.IsNull())
1697 {
1698 anImageA = aNewMarkerImage->GetImageAlpha();
1699 }
1700 if (!anImageA.IsNull())
1701 {
fd4a6963 1702 mySpriteA->Init (aContext, *anImageA.operator->(), Graphic3d_TOT_2D);
18e85574 1703 }
a577aaab 1704 }
1705 }
1706 else
1707 {
1708 // Creating list with bitmap for using it in compatibility mode
1709 GLuint aBitmapList = glGenLists (1);
fd4a6963 1710 mySprite->SetDisplayList (aContext, aBitmapList);
a577aaab 1711
1712 Standard_Integer aWidth, aHeight, anOffset, aNumOfBytes;
fd4a6963 1713 if (myType == Aspect_TOM_USERDEFINED && !myMarkerImage.IsNull())
a577aaab 1714 {
fd4a6963 1715 // Reading user defined marker
1716 Handle(TColStd_HArray1OfByte) aBitMap = myMarkerImage->GetBitMapArray();
a577aaab 1717 Standard_Byte* aBitMapArray = new Standard_Byte[aBitMap->Length()];
fd4a6963 1718 myMarkerImage->GetTextureSize (aWidth, aHeight);
a577aaab 1719
1720 // We should pass bitmap to glBitmap with reversed line order as it draws it from
1721 // bottom to top
1722 const Standard_Integer aNumOfBytesInRow = aWidth / 8 + (aWidth % 8 ? 1 : 0);
1723 const Standard_Integer anUpperIndex = aBitMap->Upper();
1724 for (Standard_Integer aRow = 0; aRow < aHeight; aRow++)
1725 {
1726 for (Standard_Integer aByteIter = 0; aByteIter < aNumOfBytesInRow; aByteIter++)
1727 {
1728 aBitMapArray[aRow * aNumOfBytesInRow + aByteIter] =
1729 aBitMap->Value (anUpperIndex + 1 - (aRow + 1) * aNumOfBytesInRow + aByteIter);
1730 }
1731 }
1732
1733 if (aBitMapArray != NULL)
1734 {
1735 glNewList (aBitmapList, GL_COMPILE);
1736 glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, (GLfloat )(0.5f * aWidth), (GLfloat )(0.5f * aHeight),
1737 0.f, 0.f, (const GLubyte* )aBitMapArray);
1738 glEndList();
1739 }
1740 }
1741 else
1742 {
1743 // Creating list for default marker
1744 const Standard_ShortReal aDelta = 0.1f;
1745 Standard_ShortReal aScale = myScale;
1746 Standard_ShortReal aLimit = 0.0f;
1747
1748 glNewList (aBitmapList, GL_COMPILE);
1749 switch (myType)
1750 {
1751 case Aspect_TOM_O_PLUS:
1752 case Aspect_TOM_O_STAR:
1753 case Aspect_TOM_O_X:
1754 {
1755 // For this type of markers we merge two base bitmaps into one
1756 // For example Aspect_TOM_O_PLUS = Aspect_TOM_O + Aspect_TOM_PLUS
1757 GetMarkerBitMapParam (Aspect_TOM_O, myScale, aWidth, aHeight, anOffset, aNumOfBytes);
1758 glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, (GLfloat )(0.5f * aWidth), (GLfloat )(0.5f * aHeight),
1759 0.f, 0.f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]);
1760 GetMarkerBitMapParam (Aspect_TypeOfMarker (myType - Aspect_TOM_O_POINT), myScale, aWidth, aHeight, anOffset, aNumOfBytes);
1761 glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, (GLfloat )(0.5f * aWidth), (GLfloat )(0.5f * aHeight),
1762 0.f, 0.f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]);
1763 break;
1764 }
1765 case Aspect_TOM_BALL:
1766 {
1767 const Standard_ShortReal aDelta = 0.1f;
1768 NCollection_Vec4<Standard_Real> aColor (Standard_Real (myColor.rgb[0]),
1769 Standard_Real (myColor.rgb[1]),
1770 Standard_Real (myColor.rgb[2]),
1771 Standard_Real (myColor.rgb[3]));
1772
1773 // we draw a set of circles
1774 while (aScale >= 1.0f)
1775 {
1776 Standard_Real aHLS[3];
1777 Quantity_Color::RgbHls (aColor.r(), aColor.g(), aColor.b(), aHLS[0], aHLS[1], aHLS[2]);
1778 // 5% saturation change
1779 aHLS[2] *= 0.95;
1780 Quantity_Color::HlsRgb (aHLS[0], aHLS[1], aHLS[2], aColor.r(), aColor.g(), aColor.b());
1781
1782 glColor4dv (aColor);
1783 GetMarkerBitMapParam (Aspect_TOM_O, aScale, aWidth, aHeight, anOffset, aNumOfBytes);
1784 glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, 0.5f * GLfloat(aWidth), 0.5f * GLfloat(aHeight),
1785 0.0f, 0.0f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]);
1786
1787 aScale -= aDelta;
1788 }
1789 break;
1790 }
1791 case Aspect_TOM_RING1:
1792 if (aLimit == 0.0f) aLimit = aScale * 0.2f;
1793 case Aspect_TOM_RING2:
1794 if (aLimit == 0.0f) aLimit = aScale * 0.5f;
1795 case Aspect_TOM_RING3:
1796 {
1797 if (aLimit == 0.0f) aLimit = aScale * 0.8f;
1798 for (; aScale > aLimit && aScale >= 1.0f; aScale -= aDelta)
1799 {
1800 GetMarkerBitMapParam (Aspect_TOM_O, aScale, aWidth, aHeight, anOffset, aNumOfBytes);
1801 glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, 0.5f * GLfloat(aWidth), 0.5f * GLfloat(aHeight),
1802 0.0f, 0.0f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]);
1803 }
1804 break;
1805 }
1806 default:
1807 {
1808 GetMarkerBitMapParam (myType, myScale, aWidth, aHeight, anOffset, aNumOfBytes);
1809 glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, 0.5f * GLfloat(aWidth), 0.5f * GLfloat(aHeight),
1810 0.0f, 0.0f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]);
1811 break;
1812 }
1813 }
1814 glEndList();
1815 }
1816 }
1817}
2166f0fa 1818
fd4a6963 1819// =======================================================================
1820// function : resourceKeys
1821// purpose :
1822// =======================================================================
1823void OpenGl_AspectMarker::resourceKeys (const Handle(Graphic3d_MarkerImage)& theMarkerImage,
1824 const Aspect_TypeOfMarker theType,
1825 const Standard_ShortReal theScale,
1826 const TEL_COLOUR& theColor,
1827 TCollection_AsciiString& theKey,
1828 TCollection_AsciiString& theKeyA) const
1829{
1830 // generate key for shared resource
1831 if (theType == Aspect_TOM_USERDEFINED)
1832 {
1833 if (!theMarkerImage.IsNull())
1834 {
1835 theKey = theMarkerImage->GetImageId();
1836 theKeyA = theMarkerImage->GetImageAlphaId();
1837 }
1838 }
1839 else if (theType != Aspect_TOM_POINT)
1840 {
1841 // predefined markers
1842 const Standard_Integer aScale = Standard_Integer(theScale + 0.5f);
1843 theKey = TCollection_AsciiString ("OpenGl_AspectMarker") + theType + "_" + aScale;
1844 theKeyA = theKey + "A";
1845 if (theType == Aspect_TOM_BALL)
1846 {
1847 unsigned int aColor[3] =
1848 {
1849 (unsigned int )(255.0f * theColor.rgb[0]),
1850 (unsigned int )(255.0f * theColor.rgb[1]),
1851 (unsigned int )(255.0f * theColor.rgb[2])
1852 };
1853 char aBytes[8];
1854 sprintf (aBytes, "%02X%02X%02X", aColor[0], aColor[1], aColor[2]);
1855 theKey += aBytes;
1856 }
1857 }
1858}
1859
a577aaab 1860// =======================================================================
1861// function : Render
1862// purpose :
1863// =======================================================================
5e27df78 1864void OpenGl_AspectMarker::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
2166f0fa 1865{
a577aaab 1866 theWorkspace->SetAspectMarker (this);
2166f0fa
SK
1867}
1868
a577aaab 1869// =======================================================================
1870// function : Release
1871// purpose :
1872// =======================================================================
1873void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx)
5e27df78 1874{
a577aaab 1875 if (!mySprite.IsNull())
1876 {
1877 if (!theCtx.IsNull())
1878 {
1879 if (mySpriteKey.IsEmpty())
1880 {
1881 theCtx->DelayedRelease (mySprite);
1882 theCtx->DelayedRelease (mySpriteA);
1883 }
1884 else
1885 {
1886 mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call
1887 mySpriteA.Nullify();
18e85574 1888 theCtx->ReleaseResource (mySpriteKey, Standard_True);
1889 theCtx->ReleaseResource (mySpriteAKey, Standard_True);
a577aaab 1890 }
1891 }
1892 mySprite.Nullify();
1893 mySpriteA.Nullify();
1894 }
1895 mySpriteKey.Clear();
1896 mySpriteAKey.Clear();
5e27df78 1897}