xref: /haiku/headers/libs/agg/agg_renderer_markers.h (revision fef6144999c2fa611f59ee6ffe6dd7999501385c)
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.2
3 // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com)
4 //
5 // Permission to copy, use, modify, sell and distribute this software
6 // is granted provided this copyright notice appears in all copies.
7 // This software is provided "as is" without express or implied
8 // warranty, and with no claim as to its suitability for any purpose.
9 //
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 //          mcseemagg@yahoo.com
13 //          http://www.antigrain.com
14 //----------------------------------------------------------------------------
15 //
16 // class renderer_markers
17 //
18 //----------------------------------------------------------------------------
19 
20 #ifndef AGG_RENDERER_MARKERS_INCLUDED
21 #define AGG_RENDERER_MARKERS_INCLUDED
22 
23 #include "agg_basics.h"
24 #include "agg_renderer_primitives.h"
25 
26 namespace agg
27 {
28 
29     //---------------------------------------------------------------marker_e
30     enum marker_e
31     {
32         marker_square,
33         marker_diamond,
34         marker_circle,
35         marker_crossed_circle,
36         marker_semiellipse_left,
37         marker_semiellipse_right,
38         marker_semiellipse_up,
39         marker_semiellipse_down,
40         marker_triangle_left,
41         marker_triangle_right,
42         marker_triangle_up,
43         marker_triangle_down,
44         marker_four_rays,
45         marker_cross,
46         marker_x,
47         marker_dash,
48         marker_dot,
49         marker_pixel,
50 
51         end_of_markers
52     };
53 
54 
55 
56     //--------------------------------------------------------renderer_markers
57     template<class BaseRenderer> class renderer_markers :
58     public renderer_primitives<BaseRenderer>
59     {
60     public:
61         typedef renderer_primitives<BaseRenderer> base_type;
62         typedef BaseRenderer base_ren_type;
63         typedef typename base_ren_type::color_type color_type;
64 
65         //--------------------------------------------------------------------
66         renderer_markers(base_ren_type& rbuf) :
67             base_type(rbuf)
68         {
69         }
70 
71         //--------------------------------------------------------------------
72         bool visible(int x, int y, int r) const
73         {
74             rect rc(x-r, y-r, x+y, y+r);
75             return rc.clip(base_type::ren().bounding_clip_box());
76         }
77 
78         //--------------------------------------------------------------------
79         void square(int x, int y, int r)
80         {
81             if(visible(x, y, r))
82             {
83                 if(r) base_type::outlined_rectangle(x-r, y-r, x+r, y+r);
84                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
85             }
86         }
87 
88         //--------------------------------------------------------------------
89         void diamond(int x, int y, int r)
90         {
91             if(visible(x, y, r))
92             {
93                 if(r)
94                 {
95                     int dy = -r;
96                     int dx = 0;
97                     do
98                     {
99                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
100                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
101                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
102                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
103 
104                         if(dx)
105                         {
106                             base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
107                             base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
108                         }
109                         ++dy;
110                         ++dx;
111                     }
112                     while(dy <= 0);
113                 }
114                 else
115                 {
116                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
117                 }
118             }
119         }
120 
121         //--------------------------------------------------------------------
122         void circle(int x, int y, int r)
123         {
124             if(visible(x, y, r))
125             {
126                 if(r) base_type::outlined_ellipse(x, y, r, r);
127                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
128             }
129         }
130 
131 
132 
133         //--------------------------------------------------------------------
134         void crossed_circle(int x, int y, int r)
135         {
136             if(visible(x, y, r))
137             {
138                 if(r)
139                 {
140                     base_type::outlined_ellipse(x, y, r, r);
141                     int r6 = r + (r >> 1);
142                     if(r <= 2) r6++;
143                     r >>= 1;
144                     base_type::ren().blend_hline(x-r6, y, x-r,  base_type::line_color(), cover_full);
145                     base_type::ren().blend_hline(x+r,  y, x+r6, base_type::line_color(), cover_full);
146                     base_type::ren().blend_vline(x, y-r6, y-r,  base_type::line_color(), cover_full);
147                     base_type::ren().blend_vline(x, y+r,  y+r6, base_type::line_color(), cover_full);
148                 }
149                 else
150                 {
151                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
152                 }
153             }
154         }
155 
156 
157         //------------------------------------------------------------------------
158         void semiellipse_left(int x, int y, int r)
159         {
160             if(visible(x, y, r))
161             {
162                 if(r)
163                 {
164                     int r8 = r * 4 / 5;
165                     int dy = -r;
166                     int dx = 0;
167                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
168                     do
169                     {
170                         dx += ei.dx();
171                         dy += ei.dy();
172 
173                         base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
174                         base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
175 
176                         if(ei.dy() && dx)
177                         {
178                             base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
179                         }
180                         ++ei;
181                     }
182                     while(dy < r8);
183                     base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full);
184                 }
185                 else
186                 {
187                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
188                 }
189             }
190         }
191 
192 
193         //--------------------------------------------------------------------
194         void semiellipse_right(int x, int y, int r)
195         {
196             if(visible(x, y, r))
197             {
198                 if(r)
199                 {
200                     int r8 = r * 4 / 5;
201                     int dy = -r;
202                     int dx = 0;
203                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
204                     do
205                     {
206                         dx += ei.dx();
207                         dy += ei.dy();
208 
209                         base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
210                         base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
211 
212                         if(ei.dy() && dx)
213                         {
214                             base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
215                         }
216                         ++ei;
217                     }
218                     while(dy < r8);
219                     base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full);
220                 }
221                 else
222                 {
223                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
224                 }
225             }
226         }
227 
228 
229         //--------------------------------------------------------------------
230         void semiellipse_up(int x, int y, int r)
231         {
232             if(visible(x, y, r))
233             {
234                 if(r)
235                 {
236                     int r8 = r * 4 / 5;
237                     int dy = -r;
238                     int dx = 0;
239                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
240                     do
241                     {
242                         dx += ei.dx();
243                         dy += ei.dy();
244 
245                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
246                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
247 
248                         if(ei.dy() && dx)
249                         {
250                             base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
251                         }
252                         ++ei;
253                     }
254                     while(dy < r8);
255                     base_type::ren().blend_hline(x-dx, y-dy-1, x+dx, base_type::line_color(), cover_full);
256                 }
257                 else
258                 {
259                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
260                 }
261             }
262         }
263 
264 
265         //--------------------------------------------------------------------
266         void semiellipse_down(int x, int y, int r)
267         {
268             if(visible(x, y, r))
269             {
270                 if(r)
271                 {
272                     int r8 = r * 4 / 5;
273                     int dy = -r;
274                     int dx = 0;
275                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
276                     do
277                     {
278                         dx += ei.dx();
279                         dy += ei.dy();
280 
281                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
282                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
283 
284                         if(ei.dy() && dx)
285                         {
286                             base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
287                         }
288                         ++ei;
289                     }
290                     while(dy < r8);
291                     base_type::ren().blend_hline(x-dx, y+dy+1, x+dx, base_type::line_color(), cover_full);
292                 }
293                 else
294                 {
295                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
296                 }
297             }
298         }
299 
300 
301         //--------------------------------------------------------------------
302         void triangle_left(int x, int y, int r)
303         {
304             if(visible(x, y, r))
305             {
306                 if(r)
307                 {
308                     int dy = -r;
309                     int dx = 0;
310                     int flip = 0;
311                     int r6 = r * 3 / 5;
312                     do
313                     {
314                         base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
315                         base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
316 
317                         if(dx)
318                         {
319                             base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
320                         }
321                         ++dy;
322                         dx += flip;
323                         flip ^= 1;
324                     }
325                     while(dy < r6);
326                     base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full);
327                 }
328                 else
329                 {
330                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
331                 }
332             }
333         }
334 
335 
336         //--------------------------------------------------------------------
337         void triangle_right(int x, int y, int r)
338         {
339             if(visible(x, y, r))
340             {
341                 if(r)
342                 {
343                     int dy = -r;
344                     int dx = 0;
345                     int flip = 0;
346                     int r6 = r * 3 / 5;
347                     do
348                     {
349                         base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
350                         base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
351 
352                         if(dx)
353                         {
354                             base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
355                         }
356                         ++dy;
357                         dx += flip;
358                         flip ^= 1;
359                     }
360                     while(dy < r6);
361                     base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full);
362                 }
363                 else
364                 {
365                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
366                 }
367             }
368         }
369 
370 
371         //--------------------------------------------------------------------
372         void triangle_up(int x, int y, int r)
373         {
374             if(visible(x, y, r))
375             {
376                 if(r)
377                 {
378                     int dy = -r;
379                     int dx = 0;
380                     int flip = 0;
381                     int r6 = r * 3 / 5;
382                     do
383                     {
384                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
385                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
386 
387                         if(dx)
388                         {
389                             base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
390                         }
391                         ++dy;
392                         dx += flip;
393                         flip ^= 1;
394                     }
395                     while(dy < r6);
396                     base_type::ren().blend_hline(x-dx, y-dy, x+dx, base_type::line_color(), cover_full);
397                 }
398                 else
399                 {
400                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
401                 }
402             }
403         }
404 
405 
406         //--------------------------------------------------------------------
407         void triangle_down(int x, int y, int r)
408         {
409             if(visible(x, y, r))
410             {
411                 if(r)
412                 {
413                     int dy = -r;
414                     int dx = 0;
415                     int flip = 0;
416                     int r6 = r * 3 / 5;
417                     do
418                     {
419                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
420                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
421 
422                         if(dx)
423                         {
424                             base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
425                         }
426                         ++dy;
427                         dx += flip;
428                         flip ^= 1;
429                     }
430                     while(dy < r6);
431                     base_type::ren().blend_hline(x-dx, y+dy, x+dx, base_type::line_color(), cover_full);
432                 }
433                 else
434                 {
435                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
436                 }
437             }
438         }
439 
440 
441         //--------------------------------------------------------------------
442         void four_rays(int x, int y, int r)
443         {
444             if(visible(x, y, r))
445             {
446                 if(r)
447                 {
448                     int dy = -r;
449                     int dx = 0;
450                     int flip = 0;
451                     int r3 = -(r / 3);
452                     do
453                     {
454                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
455                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
456                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
457                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
458                         base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
459                         base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
460                         base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
461                         base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
462 
463                         if(dx)
464                         {
465                             base_type::ren().blend_hline(x-dx+1, y+dy,   x+dx-1, base_type::fill_color(), cover_full);
466                             base_type::ren().blend_hline(x-dx+1, y-dy,   x+dx-1, base_type::fill_color(), cover_full);
467                             base_type::ren().blend_vline(x+dy,   y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
468                             base_type::ren().blend_vline(x-dy,   y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
469                         }
470                         ++dy;
471                         dx += flip;
472                         flip ^= 1;
473                     }
474                     while(dy <= r3);
475                     base_type::solid_rectangle(x+r3+1, y+r3+1, x-r3-1, y-r3-1);
476                 }
477                 else
478                 {
479                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
480                 }
481             }
482         }
483 
484 
485         //--------------------------------------------------------------------
486         void cross(int x, int y, int r)
487         {
488             if(visible(x, y, r))
489             {
490                 if(r)
491                 {
492                     base_type::ren().blend_vline(x, y-r, y+r, base_type::line_color(), cover_full);
493                     base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full);
494                 }
495                 else
496                 {
497                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
498                 }
499             }
500         }
501 
502 
503         //--------------------------------------------------------------------
504         void xing(int x, int y, int r)
505         {
506             if(visible(x, y, r))
507             {
508                 if(r)
509                 {
510                     int dy = -r * 7 / 10;
511                     do
512                     {
513                         base_type::ren().blend_pixel(x + dy, y + dy, base_type::line_color(), cover_full);
514                         base_type::ren().blend_pixel(x - dy, y + dy, base_type::line_color(), cover_full);
515                         base_type::ren().blend_pixel(x + dy, y - dy, base_type::line_color(), cover_full);
516                         base_type::ren().blend_pixel(x - dy, y - dy, base_type::line_color(), cover_full);
517                         ++dy;
518                     }
519                     while(dy < 0);
520                 }
521                 base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
522             }
523         }
524 
525 
526         //--------------------------------------------------------------------
527         void dash(int x, int y, int r)
528         {
529             if(visible(x, y, r))
530             {
531                 if(r) base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full);
532                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
533             }
534         }
535 
536 
537         //--------------------------------------------------------------------
538         void dot(int x, int y, int r)
539         {
540             if(visible(x, y, r))
541             {
542                 if(r) base_type::solid_ellipse(x, y, r, r);
543                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
544             }
545         }
546 
547         //--------------------------------------------------------------------
548         void pixel(int x, int y, int)
549         {
550             base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
551         }
552 
553         //--------------------------------------------------------------------
554         void marker(int x, int y, int r, marker_e type)
555         {
556             switch(type)
557             {
558                 case marker_square:            square(x, y, r);            break;
559                 case marker_diamond:           diamond(x, y, r);           break;
560                 case marker_circle:            circle(x, y, r);            break;
561                 case marker_crossed_circle:    crossed_circle(x, y, r);    break;
562                 case marker_semiellipse_left:  semiellipse_left(x, y, r);  break;
563                 case marker_semiellipse_right: semiellipse_right(x, y, r); break;
564                 case marker_semiellipse_up:    semiellipse_up(x, y, r);    break;
565                 case marker_semiellipse_down:  semiellipse_down(x, y, r);  break;
566                 case marker_triangle_left:     triangle_left(x, y, r);     break;
567                 case marker_triangle_right:    triangle_right(x, y, r);    break;
568                 case marker_triangle_up:       triangle_up(x, y, r);       break;
569                 case marker_triangle_down:     triangle_down(x, y, r);     break;
570                 case marker_four_rays:         four_rays(x, y, r);         break;
571                 case marker_cross:             cross(x, y, r);             break;
572                 case marker_x:                 xing(x, y, r);              break;
573                 case marker_dash:              dash(x, y, r);              break;
574                 case marker_dot:               dot(x, y, r);               break;
575                 case marker_pixel:             pixel(x, y, r);             break;
576             }
577         }
578 
579 
580         //--------------------------------------------------------------------
581         template<class T>
582         void markers(int n, const T* x, const T* y, T r, marker_e type)
583         {
584             if(n <= 0) return;
585             if(r == 0)
586             {
587                 do
588                 {
589                     base_type::ren().blend_pixel(int(*x), int(*y), base_type::fill_color(), cover_full);
590                     ++x;
591                     ++y;
592                 }
593                 while(--n);
594                 return;
595             }
596 
597             switch(type)
598             {
599                 case marker_square:            do { square           (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
600                 case marker_diamond:           do { diamond          (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
601                 case marker_circle:            do { circle           (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
602                 case marker_crossed_circle:    do { crossed_circle   (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
603                 case marker_semiellipse_left:  do { semiellipse_left (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
604                 case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
605                 case marker_semiellipse_up:    do { semiellipse_up   (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
606                 case marker_semiellipse_down:  do { semiellipse_down (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
607                 case marker_triangle_left:     do { triangle_left    (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
608                 case marker_triangle_right:    do { triangle_right   (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
609                 case marker_triangle_up:       do { triangle_up      (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
610                 case marker_triangle_down:     do { triangle_down    (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
611                 case marker_four_rays:         do { four_rays        (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
612                 case marker_cross:             do { cross            (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
613                 case marker_x:                 do { xing             (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
614                 case marker_dash:              do { dash             (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
615                 case marker_dot:               do { dot              (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
616                 case marker_pixel:             do { pixel            (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
617             }
618         }
619 
620         //--------------------------------------------------------------------
621         template<class T>
622         void markers(int n, const T* x, const T* y, const T* r, marker_e type)
623         {
624             if(n <= 0) return;
625             switch(type)
626             {
627                 case marker_square:            do { square           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
628                 case marker_diamond:           do { diamond          (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
629                 case marker_circle:            do { circle           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
630                 case marker_crossed_circle:    do { crossed_circle   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
631                 case marker_semiellipse_left:  do { semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
632                 case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
633                 case marker_semiellipse_up:    do { semiellipse_up   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
634                 case marker_semiellipse_down:  do { semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
635                 case marker_triangle_left:     do { triangle_left    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
636                 case marker_triangle_right:    do { triangle_right   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
637                 case marker_triangle_up:       do { triangle_up      (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
638                 case marker_triangle_down:     do { triangle_down    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
639                 case marker_four_rays:         do { four_rays        (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
640                 case marker_cross:             do { cross            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
641                 case marker_x:                 do { xing             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
642                 case marker_dash:              do { dash             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
643                 case marker_dot:               do { dot              (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
644                 case marker_pixel:             do { pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
645             }
646         }
647 
648         //--------------------------------------------------------------------
649         template<class T>
650         void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, marker_e type)
651         {
652             if(n <= 0) return;
653             switch(type)
654             {
655                 case marker_square:            do { base_type::fill_color(*fc); square           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
656                 case marker_diamond:           do { base_type::fill_color(*fc); diamond          (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
657                 case marker_circle:            do { base_type::fill_color(*fc); circle           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
658                 case marker_crossed_circle:    do { base_type::fill_color(*fc); crossed_circle   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
659                 case marker_semiellipse_left:  do { base_type::fill_color(*fc); semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
660                 case marker_semiellipse_right: do { base_type::fill_color(*fc); semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
661                 case marker_semiellipse_up:    do { base_type::fill_color(*fc); semiellipse_up   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
662                 case marker_semiellipse_down:  do { base_type::fill_color(*fc); semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
663                 case marker_triangle_left:     do { base_type::fill_color(*fc); triangle_left    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
664                 case marker_triangle_right:    do { base_type::fill_color(*fc); triangle_right   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
665                 case marker_triangle_up:       do { base_type::fill_color(*fc); triangle_up      (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
666                 case marker_triangle_down:     do { base_type::fill_color(*fc); triangle_down    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
667                 case marker_four_rays:         do { base_type::fill_color(*fc); four_rays        (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
668                 case marker_cross:             do { base_type::fill_color(*fc); cross            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
669                 case marker_x:                 do { base_type::fill_color(*fc); xing             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
670                 case marker_dash:              do { base_type::fill_color(*fc); dash             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
671                 case marker_dot:               do { base_type::fill_color(*fc); dot              (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
672                 case marker_pixel:             do { base_type::fill_color(*fc); pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
673             }
674         }
675 
676         //--------------------------------------------------------------------
677         template<class T>
678         void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, const color_type* lc, marker_e type)
679         {
680             if(n <= 0) return;
681             switch(type)
682             {
683                 case marker_square:            do { base_type::fill_color(*fc); base_type::line_color(*lc); square           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
684                 case marker_diamond:           do { base_type::fill_color(*fc); base_type::line_color(*lc); diamond          (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
685                 case marker_circle:            do { base_type::fill_color(*fc); base_type::line_color(*lc); circle           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
686                 case marker_crossed_circle:    do { base_type::fill_color(*fc); base_type::line_color(*lc); crossed_circle   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
687                 case marker_semiellipse_left:  do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
688                 case marker_semiellipse_right: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
689                 case marker_semiellipse_up:    do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_up   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
690                 case marker_semiellipse_down:  do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
691                 case marker_triangle_left:     do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_left    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
692                 case marker_triangle_right:    do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_right   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
693                 case marker_triangle_up:       do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_up      (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
694                 case marker_triangle_down:     do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_down    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
695                 case marker_four_rays:         do { base_type::fill_color(*fc); base_type::line_color(*lc); four_rays        (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
696                 case marker_cross:             do { base_type::fill_color(*fc); base_type::line_color(*lc); cross            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
697                 case marker_x:                 do { base_type::fill_color(*fc); base_type::line_color(*lc); xing             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
698                 case marker_dash:              do { base_type::fill_color(*fc); base_type::line_color(*lc); dash             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
699                 case marker_dot:               do { base_type::fill_color(*fc); base_type::line_color(*lc); dot              (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
700                 case marker_pixel:             do { base_type::fill_color(*fc); base_type::line_color(*lc); pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break;
701             }
702         }
703     };
704 
705 }
706 
707 #endif
708