Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_renderer_markers.h
Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 // Anti-Grain Geometry (AGG) - Version 2.5
00003 // A high quality rendering engine for C++
00004 // Copyright (C) 2002-2006 Maxim Shemanarev
00005 // Contact: mcseem@antigrain.com
00006 //          mcseemagg@yahoo.com
00007 //          http://antigrain.com
00008 // 
00009 // AGG is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 // 
00014 // AGG is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 // 
00019 // You should have received a copy of the GNU General Public License
00020 // along with AGG; if not, write to the Free Software
00021 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00022 // MA 02110-1301, USA.
00023 //----------------------------------------------------------------------------
00024 
00025 #ifndef AGG_RENDERER_MARKERS_INCLUDED
00026 #define AGG_RENDERER_MARKERS_INCLUDED
00027 
00028 #include "agg_basics.h"
00029 #include "agg_renderer_primitives.h"
00030 
00031 namespace agg
00032 {
00033 
00034     //---------------------------------------------------------------marker_e
00035     enum marker_e
00036     {
00037         marker_square,
00038         marker_diamond,
00039         marker_circle,
00040         marker_crossed_circle,
00041         marker_semiellipse_left,
00042         marker_semiellipse_right,
00043         marker_semiellipse_up,
00044         marker_semiellipse_down,
00045         marker_triangle_left,
00046         marker_triangle_right,
00047         marker_triangle_up,
00048         marker_triangle_down,
00049         marker_four_rays,
00050         marker_cross,
00051         marker_x,
00052         marker_dash,
00053         marker_dot,
00054         marker_pixel,
00055         
00056         end_of_markers
00057     };
00058 
00059 
00060 
00061     //--------------------------------------------------------renderer_markers
00062     template<class BaseRenderer> class renderer_markers :
00063     public renderer_primitives<BaseRenderer>
00064     {
00065     public:
00066         typedef renderer_primitives<BaseRenderer> base_type;
00067         typedef BaseRenderer base_ren_type;
00068         typedef typename base_ren_type::color_type color_type;
00069 
00070         //--------------------------------------------------------------------
00071         renderer_markers(base_ren_type& rbuf) :
00072             base_type(rbuf)
00073         {}
00074 
00075         //--------------------------------------------------------------------
00076         bool visible(int x, int y, int r) const
00077         {
00078             rect_i rc(x-r, y-r, x+y, y+r);
00079             return rc.clip(base_type::ren().bounding_clip_box());  
00080         }
00081 
00082         //--------------------------------------------------------------------
00083         void square(int x, int y, int r)
00084         {
00085             if(visible(x, y, r)) 
00086             {  
00087                 if(r) base_type::outlined_rectangle(x-r, y-r, x+r, y+r);
00088                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00089             }
00090         }
00091 
00092         //--------------------------------------------------------------------
00093         void diamond(int x, int y, int r)
00094         {
00095             if(visible(x, y, r))
00096             {
00097                 if(r)
00098                 {
00099                     int dy = -r;
00100                     int dx = 0;
00101                     do
00102                     {
00103                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
00104                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
00105                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
00106                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
00107                         
00108                         if(dx)
00109                         {
00110                             base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
00111                             base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
00112                         }
00113                         ++dy;
00114                         ++dx;
00115                     }
00116                     while(dy <= 0);
00117                 }
00118                 else
00119                 {
00120                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00121                 }
00122             }
00123         }
00124 
00125         //--------------------------------------------------------------------
00126         void circle(int x, int y, int r)
00127         {
00128             if(visible(x, y, r))
00129             {
00130                 if(r) base_type::outlined_ellipse(x, y, r, r);
00131                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00132             }
00133         }
00134 
00135 
00136 
00137         //--------------------------------------------------------------------
00138         void crossed_circle(int x, int y, int r)
00139         {
00140             if(visible(x, y, r))
00141             {
00142                 if(r)
00143                 {
00144                     base_type::outlined_ellipse(x, y, r, r);
00145                     int r6 = r + (r >> 1);
00146                     if(r <= 2) r6++;
00147                     r >>= 1;
00148                     base_type::ren().blend_hline(x-r6, y, x-r,  base_type::line_color(), cover_full);
00149                     base_type::ren().blend_hline(x+r,  y, x+r6, base_type::line_color(), cover_full);
00150                     base_type::ren().blend_vline(x, y-r6, y-r,  base_type::line_color(), cover_full);
00151                     base_type::ren().blend_vline(x, y+r,  y+r6, base_type::line_color(), cover_full);
00152                 }
00153                 else
00154                 {
00155                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00156                 }
00157             }
00158         }
00159 
00160 
00161         //------------------------------------------------------------------------
00162         void semiellipse_left(int x, int y, int r)
00163         {
00164             if(visible(x, y, r))
00165             {
00166                 if(r)
00167                 {
00168                     int r8 = r * 4 / 5;
00169                     int dy = -r;
00170                     int dx = 0;
00171                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
00172                     do
00173                     {
00174                         dx += ei.dx();
00175                         dy += ei.dy();
00176                         
00177                         base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
00178                         base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
00179                         
00180                         if(ei.dy() && dx)
00181                         {
00182                             base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
00183                         }
00184                         ++ei;
00185                     }
00186                     while(dy < r8);
00187                     base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full);
00188                 }
00189                 else
00190                 {
00191                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00192                 }
00193             }
00194         }
00195 
00196 
00197         //--------------------------------------------------------------------
00198         void semiellipse_right(int x, int y, int r)
00199         {
00200             if(visible(x, y, r))
00201             {
00202                 if(r)
00203                 {
00204                     int r8 = r * 4 / 5;
00205                     int dy = -r;
00206                     int dx = 0;
00207                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
00208                     do
00209                     {
00210                         dx += ei.dx();
00211                         dy += ei.dy();
00212                         
00213                         base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
00214                         base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
00215                         
00216                         if(ei.dy() && dx)
00217                         {
00218                             base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
00219                         }
00220                         ++ei;
00221                     }
00222                     while(dy < r8);
00223                     base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full);
00224                 }
00225                 else
00226                 {
00227                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00228                 }
00229             }
00230         }
00231 
00232 
00233         //--------------------------------------------------------------------
00234         void semiellipse_up(int x, int y, int r)
00235         {
00236             if(visible(x, y, r))
00237             {
00238                 if(r)
00239                 {
00240                     int r8 = r * 4 / 5;
00241                     int dy = -r;
00242                     int dx = 0;
00243                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
00244                     do
00245                     {
00246                         dx += ei.dx();
00247                         dy += ei.dy();
00248                         
00249                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
00250                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
00251                         
00252                         if(ei.dy() && dx)
00253                         {
00254                             base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
00255                         }
00256                         ++ei;
00257                     }
00258                     while(dy < r8);
00259                     base_type::ren().blend_hline(x-dx, y-dy-1, x+dx, base_type::line_color(), cover_full);
00260                 }
00261                 else
00262                 {
00263                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00264                 }
00265             }
00266         }
00267 
00268 
00269         //--------------------------------------------------------------------
00270         void semiellipse_down(int x, int y, int r)
00271         {
00272             if(visible(x, y, r))
00273             {
00274                 if(r)
00275                 {
00276                     int r8 = r * 4 / 5;
00277                     int dy = -r;
00278                     int dx = 0;
00279                     ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8);
00280                     do
00281                     {
00282                         dx += ei.dx();
00283                         dy += ei.dy();
00284                         
00285                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
00286                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
00287                         
00288                         if(ei.dy() && dx)
00289                         {
00290                             base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
00291                         }
00292                         ++ei;
00293                     }
00294                     while(dy < r8);
00295                     base_type::ren().blend_hline(x-dx, y+dy+1, x+dx, base_type::line_color(), cover_full);
00296                 }
00297                 else
00298                 {
00299                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00300                 }
00301             }
00302         }
00303 
00304 
00305         //--------------------------------------------------------------------
00306         void triangle_left(int x, int y, int r)
00307         {
00308             if(visible(x, y, r))
00309             {
00310                 if(r)
00311                 {
00312                     int dy = -r;
00313                     int dx = 0;
00314                     int flip = 0;
00315                     int r6 = r * 3 / 5;
00316                     do
00317                     {
00318                         base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
00319                         base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
00320                         
00321                         if(dx)
00322                         {
00323                             base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
00324                         }
00325                         ++dy;
00326                         dx += flip;
00327                         flip ^= 1;
00328                     }
00329                     while(dy < r6);
00330                     base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full);
00331                 }
00332                 else
00333                 {
00334                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00335                 }
00336             }
00337         }
00338 
00339 
00340         //--------------------------------------------------------------------
00341         void triangle_right(int x, int y, int r)
00342         {
00343             if(visible(x, y, r))
00344             {
00345                 if(r)
00346                 {
00347                     int dy = -r;
00348                     int dx = 0;
00349                     int flip = 0;
00350                     int r6 = r * 3 / 5;
00351                     do
00352                     {
00353                         base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
00354                         base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
00355                         
00356                         if(dx)
00357                         {
00358                             base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
00359                         }
00360                         ++dy;
00361                         dx += flip;
00362                         flip ^= 1;
00363                     }
00364                     while(dy < r6);
00365                     base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full);
00366                 }
00367                 else
00368                 {
00369                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00370                 }
00371             }
00372         }
00373 
00374 
00375         //--------------------------------------------------------------------
00376         void triangle_up(int x, int y, int r)
00377         {
00378             if(visible(x, y, r))
00379             {
00380                 if(r)
00381                 {
00382                     int dy = -r;
00383                     int dx = 0;
00384                     int flip = 0;
00385                     int r6 = r * 3 / 5;
00386                     do
00387                     {
00388                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
00389                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
00390                         
00391                         if(dx)
00392                         {
00393                             base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full);
00394                         }
00395                         ++dy;
00396                         dx += flip;
00397                         flip ^= 1;
00398                     }
00399                     while(dy < r6);
00400                     base_type::ren().blend_hline(x-dx, y-dy, x+dx, base_type::line_color(), cover_full);
00401                 }
00402                 else
00403                 {
00404                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00405                 }
00406             }
00407         }
00408 
00409 
00410         //--------------------------------------------------------------------
00411         void triangle_down(int x, int y, int r)
00412         {
00413             if(visible(x, y, r))
00414             {
00415                 if(r)
00416                 {
00417                     int dy = -r;
00418                     int dx = 0;
00419                     int flip = 0;
00420                     int r6 = r * 3 / 5;
00421                     do
00422                     {
00423                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
00424                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
00425                         
00426                         if(dx)
00427                         {
00428                             base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full);
00429                         }
00430                         ++dy;
00431                         dx += flip;
00432                         flip ^= 1;
00433                     }
00434                     while(dy < r6);
00435                     base_type::ren().blend_hline(x-dx, y+dy, x+dx, base_type::line_color(), cover_full);
00436                 }
00437                 else
00438                 {
00439                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00440                 }
00441             }
00442         }
00443 
00444 
00445         //--------------------------------------------------------------------
00446         void four_rays(int x, int y, int r)
00447         {
00448             if(visible(x, y, r))
00449             {
00450                 if(r)
00451                 {
00452                     int dy = -r;
00453                     int dx = 0;
00454                     int flip = 0;
00455                     int r3 = -(r / 3);
00456                     do
00457                     {
00458                         base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full);
00459                         base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full);
00460                         base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full);
00461                         base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full);
00462                         base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full);
00463                         base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full);
00464                         base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full);
00465                         base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full);
00466                         
00467                         if(dx)
00468                         {
00469                             base_type::ren().blend_hline(x-dx+1, y+dy,   x+dx-1, base_type::fill_color(), cover_full);
00470                             base_type::ren().blend_hline(x-dx+1, y-dy,   x+dx-1, base_type::fill_color(), cover_full);
00471                             base_type::ren().blend_vline(x+dy,   y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
00472                             base_type::ren().blend_vline(x-dy,   y-dx+1, y+dx-1, base_type::fill_color(), cover_full);
00473                         }
00474                         ++dy;
00475                         dx += flip;
00476                         flip ^= 1;
00477                     }
00478                     while(dy <= r3);
00479                     base_type::solid_rectangle(x+r3+1, y+r3+1, x-r3-1, y-r3-1);
00480                 }
00481                 else
00482                 {
00483                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00484                 }
00485             }
00486         }
00487 
00488 
00489         //--------------------------------------------------------------------
00490         void cross(int x, int y, int r)
00491         {
00492             if(visible(x, y, r))
00493             {
00494                 if(r)
00495                 {
00496                     base_type::ren().blend_vline(x, y-r, y+r, base_type::line_color(), cover_full);
00497                     base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full);
00498                 }
00499                 else
00500                 {
00501                     base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00502                 }
00503             }
00504         }
00505         
00506         
00507         //--------------------------------------------------------------------
00508         void xing(int x, int y, int r)
00509         {
00510             if(visible(x, y, r))
00511             {
00512                 if(r)
00513                 {
00514                     int dy = -r * 7 / 10;
00515                     do
00516                     {
00517                         base_type::ren().blend_pixel(x + dy, y + dy, base_type::line_color(), cover_full);
00518                         base_type::ren().blend_pixel(x - dy, y + dy, base_type::line_color(), cover_full);
00519                         base_type::ren().blend_pixel(x + dy, y - dy, base_type::line_color(), cover_full);
00520                         base_type::ren().blend_pixel(x - dy, y - dy, base_type::line_color(), cover_full);
00521                         ++dy;
00522                     }
00523                     while(dy < 0);
00524                 }
00525                 base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00526             }
00527         }
00528         
00529         
00530         //--------------------------------------------------------------------
00531         void dash(int x, int y, int r)
00532         {
00533             if(visible(x, y, r)) 
00534             {
00535                 if(r) base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full);
00536                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00537             }
00538         }
00539         
00540         
00541         //--------------------------------------------------------------------
00542         void dot(int x, int y, int r)
00543         {
00544             if(visible(x, y, r)) 
00545             {
00546                 if(r) base_type::solid_ellipse(x, y, r, r);
00547                 else  base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00548             }
00549         }
00550         
00551         //--------------------------------------------------------------------
00552         void pixel(int x, int y, int)
00553         {
00554             base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full);
00555         }
00556         
00557         //--------------------------------------------------------------------
00558         void marker(int x, int y, int r, marker_e type)
00559         {
00560             switch(type)
00561             {
00562                 case marker_square:            square(x, y, r);            break;
00563                 case marker_diamond:           diamond(x, y, r);           break;
00564                 case marker_circle:            circle(x, y, r);            break;
00565                 case marker_crossed_circle:    crossed_circle(x, y, r);    break;
00566                 case marker_semiellipse_left:  semiellipse_left(x, y, r);  break;
00567                 case marker_semiellipse_right: semiellipse_right(x, y, r); break;
00568                 case marker_semiellipse_up:    semiellipse_up(x, y, r);    break;
00569                 case marker_semiellipse_down:  semiellipse_down(x, y, r);  break;
00570                 case marker_triangle_left:     triangle_left(x, y, r);     break;
00571                 case marker_triangle_right:    triangle_right(x, y, r);    break;
00572                 case marker_triangle_up:       triangle_up(x, y, r);       break;
00573                 case marker_triangle_down:     triangle_down(x, y, r);     break;
00574                 case marker_four_rays:         four_rays(x, y, r);         break;
00575                 case marker_cross:             cross(x, y, r);             break;
00576                 case marker_x:                 xing(x, y, r);              break;
00577                 case marker_dash:              dash(x, y, r);              break;
00578                 case marker_dot:               dot(x, y, r);               break;
00579                 case marker_pixel:             pixel(x, y, r);             break;
00580             }
00581         }
00582 
00583 
00584         //--------------------------------------------------------------------
00585         template<class T>
00586         void markers(int n, const T* x, const T* y, T r, marker_e type)
00587         {
00588             if(n <= 0) return;
00589             if(r == 0)
00590             {
00591                 do
00592                 {
00593                     base_type::ren().blend_pixel(int(*x), int(*y), base_type::fill_color(), cover_full);
00594                     ++x;
00595                     ++y;
00596                 }
00597                 while(--n);
00598                 return;
00599             }
00600             
00601             switch(type)
00602             {
00603                 case marker_square:            do { square           (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00604                 case marker_diamond:           do { diamond          (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00605                 case marker_circle:            do { circle           (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00606                 case marker_crossed_circle:    do { crossed_circle   (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00607                 case marker_semiellipse_left:  do { semiellipse_left (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00608                 case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00609                 case marker_semiellipse_up:    do { semiellipse_up   (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00610                 case marker_semiellipse_down:  do { semiellipse_down (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00611                 case marker_triangle_left:     do { triangle_left    (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00612                 case marker_triangle_right:    do { triangle_right   (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00613                 case marker_triangle_up:       do { triangle_up      (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00614                 case marker_triangle_down:     do { triangle_down    (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00615                 case marker_four_rays:         do { four_rays        (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00616                 case marker_cross:             do { cross            (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00617                 case marker_x:                 do { xing             (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00618                 case marker_dash:              do { dash             (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00619                 case marker_dot:               do { dot              (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00620                 case marker_pixel:             do { pixel            (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break;
00621             }                                                                                  
00622         }
00623         
00624         //--------------------------------------------------------------------
00625         template<class T>
00626         void markers(int n, const T* x, const T* y, const T* r, marker_e type)
00627         {
00628             if(n <= 0) return;
00629             switch(type)
00630             {
00631                 case marker_square:            do { square           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00632                 case marker_diamond:           do { diamond          (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00633                 case marker_circle:            do { circle           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00634                 case marker_crossed_circle:    do { crossed_circle   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00635                 case marker_semiellipse_left:  do { semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00636                 case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00637                 case marker_semiellipse_up:    do { semiellipse_up   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00638                 case marker_semiellipse_down:  do { semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00639                 case marker_triangle_left:     do { triangle_left    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00640                 case marker_triangle_right:    do { triangle_right   (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00641                 case marker_triangle_up:       do { triangle_up      (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00642                 case marker_triangle_down:     do { triangle_down    (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00643                 case marker_four_rays:         do { four_rays        (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00644                 case marker_cross:             do { cross            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00645                 case marker_x:                 do { xing             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00646                 case marker_dash:              do { dash             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00647                 case marker_dot:               do { dot              (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00648                 case marker_pixel:             do { pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break;
00649             }                                                                                  
00650         }
00651         
00652         //--------------------------------------------------------------------
00653         template<class T>
00654         void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, marker_e type)
00655         {
00656             if(n <= 0) return;
00657             switch(type)
00658             {
00659                 case marker_square:            do { base_type::fill_color(*fc); square           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00660                 case marker_diamond:           do { base_type::fill_color(*fc); diamond          (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00661                 case marker_circle:            do { base_type::fill_color(*fc); circle           (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00662                 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;
00663                 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;
00664                 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;
00665                 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;
00666                 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;
00667                 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;
00668                 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;
00669                 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;
00670                 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;
00671                 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;
00672                 case marker_cross:             do { base_type::fill_color(*fc); cross            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00673                 case marker_x:                 do { base_type::fill_color(*fc); xing             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00674                 case marker_dash:              do { base_type::fill_color(*fc); dash             (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00675                 case marker_dot:               do { base_type::fill_color(*fc); dot              (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00676                 case marker_pixel:             do { base_type::fill_color(*fc); pixel            (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break;
00677             }
00678         }
00679         
00680         //--------------------------------------------------------------------
00681         template<class T>
00682         void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, const color_type* lc, marker_e type)
00683         {
00684             if(n <= 0) return;
00685             switch(type)
00686             {
00687                 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;
00688                 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;
00689                 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;
00690                 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;
00691                 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;
00692                 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;
00693                 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;
00694                 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;
00695                 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;
00696                 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;
00697                 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;
00698                 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;
00699                 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;
00700                 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;
00701                 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;
00702                 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;
00703                 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;
00704                 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;
00705             }
00706         }
00707     };
00708 
00709 }
00710 
00711 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines