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