Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_renderer_base.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_BASE_INCLUDED
00026 #define AGG_RENDERER_BASE_INCLUDED
00027 
00028 #include "agg_basics.h"
00029 #include "agg_rendering_buffer.h"
00030 
00031 namespace agg
00032 {
00033 
00034     //-----------------------------------------------------------renderer_base
00035     template<class PixelFormat> class renderer_base
00036     {
00037     public:
00038         typedef PixelFormat pixfmt_type;
00039         typedef typename pixfmt_type::color_type color_type;
00040         typedef typename pixfmt_type::row_data row_data;
00041 
00042         //--------------------------------------------------------------------
00043         renderer_base() : m_ren(0), m_clip_box(1, 1, 0, 0) {}
00044         explicit renderer_base(pixfmt_type& ren) :
00045             m_ren(&ren),
00046             m_clip_box(0, 0, ren.width() - 1, ren.height() - 1)
00047         {}
00048         void attach(pixfmt_type& ren)
00049         {
00050             m_ren = &ren;
00051             m_clip_box = rect_i(0, 0, ren.width() - 1, ren.height() - 1);
00052         }
00053 
00054         //--------------------------------------------------------------------
00055         const pixfmt_type& ren() const { return *m_ren;  }
00056         pixfmt_type& ren() { return *m_ren;  }
00057           
00058         //--------------------------------------------------------------------
00059         unsigned width()  const { return m_ren->width();  }
00060         unsigned height() const { return m_ren->height(); }
00061 
00062         //--------------------------------------------------------------------
00063         bool clip_box(int x1, int y1, int x2, int y2)
00064         {
00065             rect_i cb(x1, y1, x2, y2);
00066             cb.normalize();
00067             if(cb.clip(rect_i(0, 0, width() - 1, height() - 1)))
00068             {
00069                 m_clip_box = cb;
00070                 return true;
00071             }
00072             m_clip_box.x1 = 1;
00073             m_clip_box.y1 = 1;
00074             m_clip_box.x2 = 0;
00075             m_clip_box.y2 = 0;
00076             return false;
00077         }
00078 
00079         //--------------------------------------------------------------------
00080         void reset_clipping(bool visibility)
00081         {
00082             if(visibility)
00083             {
00084                 m_clip_box.x1 = 0;
00085                 m_clip_box.y1 = 0;
00086                 m_clip_box.x2 = width() - 1;
00087                 m_clip_box.y2 = height() - 1;
00088             }
00089             else
00090             {
00091                 m_clip_box.x1 = 1;
00092                 m_clip_box.y1 = 1;
00093                 m_clip_box.x2 = 0;
00094                 m_clip_box.y2 = 0;
00095             }
00096         }
00097 
00098         //--------------------------------------------------------------------
00099         void clip_box_naked(int x1, int y1, int x2, int y2)
00100         {
00101             m_clip_box.x1 = x1;
00102             m_clip_box.y1 = y1;
00103             m_clip_box.x2 = x2;
00104             m_clip_box.y2 = y2;
00105         }
00106 
00107         //--------------------------------------------------------------------
00108         bool inbox(int x, int y) const
00109         {
00110             return x >= m_clip_box.x1 && y >= m_clip_box.y1 &&
00111                    x <= m_clip_box.x2 && y <= m_clip_box.y2;
00112         }
00113 
00114         //--------------------------------------------------------------------
00115         const rect_i& clip_box() const { return m_clip_box;    }
00116         int           xmin()     const { return m_clip_box.x1; }
00117         int           ymin()     const { return m_clip_box.y1; }
00118         int           xmax()     const { return m_clip_box.x2; }
00119         int           ymax()     const { return m_clip_box.y2; }
00120 
00121         //--------------------------------------------------------------------
00122         const rect_i& bounding_clip_box() const { return m_clip_box;    }
00123         int           bounding_xmin()     const { return m_clip_box.x1; }
00124         int           bounding_ymin()     const { return m_clip_box.y1; }
00125         int           bounding_xmax()     const { return m_clip_box.x2; }
00126         int           bounding_ymax()     const { return m_clip_box.y2; }
00127 
00128         //--------------------------------------------------------------------
00129         void clear(const color_type& c)
00130         {
00131             unsigned y;
00132             if(width())
00133             {
00134                 for(y = 0; y < height(); y++)
00135                 {
00136                     m_ren->copy_hline(0, y, width(), c);
00137                 }
00138             }
00139         }
00140           
00141 
00142         //--------------------------------------------------------------------
00143         void copy_pixel(int x, int y, const color_type& c)
00144         {
00145             if(inbox(x, y))
00146             {
00147                 m_ren->copy_pixel(x, y, c);
00148             }
00149         }
00150 
00151         //--------------------------------------------------------------------
00152         void blend_pixel(int x, int y, const color_type& c, cover_type cover)
00153         {
00154             if(inbox(x, y))
00155             {
00156                 m_ren->blend_pixel(x, y, c, cover);
00157             }
00158         }
00159 
00160         //--------------------------------------------------------------------
00161         color_type pixel(int x, int y) const
00162         {
00163             return inbox(x, y) ? 
00164                    m_ren->pixel(x, y) :
00165                    color_type::no_color();
00166         }
00167 
00168         //--------------------------------------------------------------------
00169         void copy_hline(int x1, int y, int x2, const color_type& c)
00170         {
00171             if(x1 > x2) { int t = x2; x2 = x1; x1 = t; }
00172             if(y  > ymax()) return;
00173             if(y  < ymin()) return;
00174             if(x1 > xmax()) return;
00175             if(x2 < xmin()) return;
00176 
00177             if(x1 < xmin()) x1 = xmin();
00178             if(x2 > xmax()) x2 = xmax();
00179 
00180             m_ren->copy_hline(x1, y, x2 - x1 + 1, c);
00181         }
00182 
00183         //--------------------------------------------------------------------
00184         void copy_vline(int x, int y1, int y2, const color_type& c)
00185         {
00186             if(y1 > y2) { int t = y2; y2 = y1; y1 = t; }
00187             if(x  > xmax()) return;
00188             if(x  < xmin()) return;
00189             if(y1 > ymax()) return;
00190             if(y2 < ymin()) return;
00191 
00192             if(y1 < ymin()) y1 = ymin();
00193             if(y2 > ymax()) y2 = ymax();
00194 
00195             m_ren->copy_vline(x, y1, y2 - y1 + 1, c);
00196         }
00197 
00198         //--------------------------------------------------------------------
00199         void blend_hline(int x1, int y, int x2, 
00200                          const color_type& c, cover_type cover)
00201         {
00202             if(x1 > x2) { int t = x2; x2 = x1; x1 = t; }
00203             if(y  > ymax()) return;
00204             if(y  < ymin()) return;
00205             if(x1 > xmax()) return;
00206             if(x2 < xmin()) return;
00207 
00208             if(x1 < xmin()) x1 = xmin();
00209             if(x2 > xmax()) x2 = xmax();
00210 
00211             m_ren->blend_hline(x1, y, x2 - x1 + 1, c, cover);
00212         }
00213 
00214         //--------------------------------------------------------------------
00215         void blend_vline(int x, int y1, int y2, 
00216                          const color_type& c, cover_type cover)
00217         {
00218             if(y1 > y2) { int t = y2; y2 = y1; y1 = t; }
00219             if(x  > xmax()) return;
00220             if(x  < xmin()) return;
00221             if(y1 > ymax()) return;
00222             if(y2 < ymin()) return;
00223 
00224             if(y1 < ymin()) y1 = ymin();
00225             if(y2 > ymax()) y2 = ymax();
00226 
00227             m_ren->blend_vline(x, y1, y2 - y1 + 1, c, cover);
00228         }
00229 
00230 
00231         //--------------------------------------------------------------------
00232         void copy_bar(int x1, int y1, int x2, int y2, const color_type& c)
00233         {
00234             rect_i rc(x1, y1, x2, y2);
00235             rc.normalize();
00236             if(rc.clip(clip_box()))
00237             {
00238                 int y;
00239                 for(y = rc.y1; y <= rc.y2; y++)
00240                 {
00241                     m_ren->copy_hline(rc.x1, y, unsigned(rc.x2 - rc.x1 + 1), c);
00242                 }
00243             }
00244         }
00245 
00246         //--------------------------------------------------------------------
00247         void blend_bar(int x1, int y1, int x2, int y2, 
00248                        const color_type& c, cover_type cover)
00249         {
00250             rect_i rc(x1, y1, x2, y2);
00251             rc.normalize();
00252             if(rc.clip(clip_box()))
00253             {
00254                 int y;
00255                 for(y = rc.y1; y <= rc.y2; y++)
00256                 {
00257                     m_ren->blend_hline(rc.x1,
00258                                        y,
00259                                        unsigned(rc.x2 - rc.x1 + 1), 
00260                                        c, 
00261                                        cover);
00262                 }
00263             }
00264         }
00265 
00266         //--------------------------------------------------------------------
00267         void blend_solid_hspan(int x, int y, int len, 
00268                                const color_type& c, 
00269                                const cover_type* covers)
00270         {
00271             if(y > ymax()) return;
00272             if(y < ymin()) return;
00273 
00274             if(x < xmin())
00275             {
00276                 len -= xmin() - x;
00277                 if(len <= 0) return;
00278                 covers += xmin() - x;
00279                 x = xmin();
00280             }
00281             if(x + len > xmax())
00282             {
00283                 len = xmax() - x + 1;
00284                 if(len <= 0) return;
00285             }
00286             m_ren->blend_solid_hspan(x, y, len, c, covers);
00287         }
00288 
00289         //--------------------------------------------------------------------
00290         void blend_solid_vspan(int x, int y, int len, 
00291                                const color_type& c, 
00292                                const cover_type* covers)
00293         {
00294             if(x > xmax()) return;
00295             if(x < xmin()) return;
00296 
00297             if(y < ymin())
00298             {
00299                 len -= ymin() - y;
00300                 if(len <= 0) return;
00301                 covers += ymin() - y;
00302                 y = ymin();
00303             }
00304             if(y + len > ymax())
00305             {
00306                 len = ymax() - y + 1;
00307                 if(len <= 0) return;
00308             }
00309             m_ren->blend_solid_vspan(x, y, len, c, covers);
00310         }
00311 
00312 
00313         //--------------------------------------------------------------------
00314         void copy_color_hspan(int x, int y, int len, const color_type* colors)
00315         {
00316             if(y > ymax()) return;
00317             if(y < ymin()) return;
00318 
00319             if(x < xmin())
00320             {
00321                 int d = xmin() - x;
00322                 len -= d;
00323                 if(len <= 0) return;
00324                 colors += d;
00325                 x = xmin();
00326             }
00327             if(x + len > xmax())
00328             {
00329                 len = xmax() - x + 1;
00330                 if(len <= 0) return;
00331             }
00332             m_ren->copy_color_hspan(x, y, len, colors);
00333         }
00334 
00335 
00336         //--------------------------------------------------------------------
00337         void copy_color_vspan(int x, int y, int len, const color_type* colors)
00338         {
00339             if(x > xmax()) return;
00340             if(x < xmin()) return;
00341 
00342             if(y < ymin())
00343             {
00344                 int d = ymin() - y;
00345                 len -= d;
00346                 if(len <= 0) return;
00347                 colors += d;
00348                 y = ymin();
00349             }
00350             if(y + len > ymax())
00351             {
00352                 len = ymax() - y + 1;
00353                 if(len <= 0) return;
00354             }
00355             m_ren->copy_color_vspan(x, y, len, colors);
00356         }
00357 
00358 
00359         //--------------------------------------------------------------------
00360         void blend_color_hspan(int x, int y, int len, 
00361                                const color_type* colors, 
00362                                const cover_type* covers,
00363                                cover_type cover = agg::cover_full)
00364         {
00365             if(y > ymax()) return;
00366             if(y < ymin()) return;
00367 
00368             if(x < xmin())
00369             {
00370                 int d = xmin() - x;
00371                 len -= d;
00372                 if(len <= 0) return;
00373                 if(covers) covers += d;
00374                 colors += d;
00375                 x = xmin();
00376             }
00377             if(x + len > xmax())
00378             {
00379                 len = xmax() - x + 1;
00380                 if(len <= 0) return;
00381             }
00382             m_ren->blend_color_hspan(x, y, len, colors, covers, cover);
00383         }
00384 
00385         //--------------------------------------------------------------------
00386         void blend_color_vspan(int x, int y, int len, 
00387                                const color_type* colors, 
00388                                const cover_type* covers,
00389                                cover_type cover = agg::cover_full)
00390         {
00391             if(x > xmax()) return;
00392             if(x < xmin()) return;
00393 
00394             if(y < ymin())
00395             {
00396                 int d = ymin() - y;
00397                 len -= d;
00398                 if(len <= 0) return;
00399                 if(covers) covers += d;
00400                 colors += d;
00401                 y = ymin();
00402             }
00403             if(y + len > ymax())
00404             {
00405                 len = ymax() - y + 1;
00406                 if(len <= 0) return;
00407             }
00408             m_ren->blend_color_vspan(x, y, len, colors, covers, cover);
00409         }
00410 
00411         //--------------------------------------------------------------------
00412         rect_i clip_rect_area(rect_i& dst, rect_i& src, int wsrc, int hsrc) const
00413         {
00414             rect_i rc(0,0,0,0);
00415             rect_i cb = clip_box();
00416             ++cb.x2;
00417             ++cb.y2;
00418 
00419             if(src.x1 < 0)
00420             {
00421                 dst.x1 -= src.x1;
00422                 src.x1 = 0;
00423             }
00424             if(src.y1 < 0)
00425             {
00426                 dst.y1 -= src.y1;
00427                 src.y1 = 0;
00428             }
00429 
00430             if(src.x2 > wsrc) src.x2 = wsrc;
00431             if(src.y2 > hsrc) src.y2 = hsrc;
00432 
00433             if(dst.x1 < cb.x1)
00434             {
00435                 src.x1 += cb.x1 - dst.x1;
00436                 dst.x1 = cb.x1;
00437             }
00438             if(dst.y1 < cb.y1)
00439             {
00440                 src.y1 += cb.y1 - dst.y1;
00441                 dst.y1 = cb.y1;
00442             }
00443 
00444             if(dst.x2 > cb.x2) dst.x2 = cb.x2;
00445             if(dst.y2 > cb.y2) dst.y2 = cb.y2;
00446 
00447             rc.x2 = dst.x2 - dst.x1;
00448             rc.y2 = dst.y2 - dst.y1;
00449 
00450             if(rc.x2 > src.x2 - src.x1) rc.x2 = src.x2 - src.x1;
00451             if(rc.y2 > src.y2 - src.y1) rc.y2 = src.y2 - src.y1;
00452             return rc;
00453         }
00454 
00455         //--------------------------------------------------------------------
00456         template<class RenBuf>
00457         void copy_from(const RenBuf& src, 
00458                        const rect_i* rect_src_ptr = 0, 
00459                        int dx = 0, 
00460                        int dy = 0)
00461         {
00462             rect_i rsrc(0, 0, src.width(), src.height());
00463             if(rect_src_ptr)
00464             {
00465                 rsrc.x1 = rect_src_ptr->x1; 
00466                 rsrc.y1 = rect_src_ptr->y1;
00467                 rsrc.x2 = rect_src_ptr->x2 + 1;
00468                 rsrc.y2 = rect_src_ptr->y2 + 1;
00469             }
00470 
00471             // Version with xdst, ydst (absolute positioning)
00472             //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
00473 
00474             // Version with dx, dy (relative positioning)
00475             rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
00476 
00477             rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
00478 
00479             if(rc.x2 > 0)
00480             {
00481                 int incy = 1;
00482                 if(rdst.y1 > rsrc.y1)
00483                 {
00484                     rsrc.y1 += rc.y2 - 1;
00485                     rdst.y1 += rc.y2 - 1;
00486                     incy = -1;
00487                 }
00488                 while(rc.y2 > 0)
00489                 {
00490                     m_ren->copy_from(src, 
00491                                      rdst.x1, rdst.y1,
00492                                      rsrc.x1, rsrc.y1,
00493                                      rc.x2);
00494                     rdst.y1 += incy;
00495                     rsrc.y1 += incy;
00496                     --rc.y2;
00497                 }
00498             }
00499         }
00500 
00501         //--------------------------------------------------------------------
00502         template<class SrcPixelFormatRenderer>
00503         void blend_from(const SrcPixelFormatRenderer& src, 
00504                         const rect_i* rect_src_ptr = 0, 
00505                         int dx = 0, 
00506                         int dy = 0,
00507                         cover_type cover = agg::cover_full)
00508         {
00509             rect_i rsrc(0, 0, src.width(), src.height());
00510             if(rect_src_ptr)
00511             {
00512                 rsrc.x1 = rect_src_ptr->x1; 
00513                 rsrc.y1 = rect_src_ptr->y1;
00514                 rsrc.x2 = rect_src_ptr->x2 + 1;
00515                 rsrc.y2 = rect_src_ptr->y2 + 1;
00516             }
00517 
00518             // Version with xdst, ydst (absolute positioning)
00519             //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
00520 
00521             // Version with dx, dy (relative positioning)
00522             rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
00523             rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
00524 
00525             if(rc.x2 > 0)
00526             {
00527                 int incy = 1;
00528                 if(rdst.y1 > rsrc.y1)
00529                 {
00530                     rsrc.y1 += rc.y2 - 1;
00531                     rdst.y1 += rc.y2 - 1;
00532                     incy = -1;
00533                 }
00534                 while(rc.y2 > 0)
00535                 {
00536                     typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1);
00537                     if(rw.ptr)
00538                     {
00539                         int x1src = rsrc.x1;
00540                         int x1dst = rdst.x1;
00541                         int len   = rc.x2;
00542                         if(rw.x1 > x1src)
00543                         {
00544                             x1dst += rw.x1 - x1src;
00545                             len   -= rw.x1 - x1src;
00546                             x1src  = rw.x1;
00547                         }
00548                         if(len > 0)
00549                         {
00550                             if(x1src + len-1 > rw.x2)
00551                             {
00552                                 len -= x1src + len - rw.x2 - 1;
00553                             }
00554                             if(len > 0)
00555                             {
00556                                 m_ren->blend_from(src,
00557                                                   x1dst, rdst.y1,
00558                                                   x1src, rsrc.y1,
00559                                                   len,
00560                                                   cover);
00561                             }
00562                         }
00563                     }
00564                     rdst.y1 += incy;
00565                     rsrc.y1 += incy;
00566                     --rc.y2;
00567                 }
00568             }
00569         }
00570 
00571         //--------------------------------------------------------------------
00572         template<class SrcPixelFormatRenderer>
00573         void blend_from_color(const SrcPixelFormatRenderer& src, 
00574                               const color_type& color,
00575                               const rect_i* rect_src_ptr = 0, 
00576                               int dx = 0, 
00577                               int dy = 0,
00578                               cover_type cover = agg::cover_full)
00579         {
00580             rect_i rsrc(0, 0, src.width(), src.height());
00581             if(rect_src_ptr)
00582             {
00583                 rsrc.x1 = rect_src_ptr->x1; 
00584                 rsrc.y1 = rect_src_ptr->y1;
00585                 rsrc.x2 = rect_src_ptr->x2 + 1;
00586                 rsrc.y2 = rect_src_ptr->y2 + 1;
00587             }
00588 
00589             // Version with xdst, ydst (absolute positioning)
00590             //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
00591 
00592             // Version with dx, dy (relative positioning)
00593             rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
00594             rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
00595 
00596             if(rc.x2 > 0)
00597             {
00598                 int incy = 1;
00599                 if(rdst.y1 > rsrc.y1)
00600                 {
00601                     rsrc.y1 += rc.y2 - 1;
00602                     rdst.y1 += rc.y2 - 1;
00603                     incy = -1;
00604                 }
00605                 while(rc.y2 > 0)
00606                 {
00607                     typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1);
00608                     if(rw.ptr)
00609                     {
00610                         int x1src = rsrc.x1;
00611                         int x1dst = rdst.x1;
00612                         int len   = rc.x2;
00613                         if(rw.x1 > x1src)
00614                         {
00615                             x1dst += rw.x1 - x1src;
00616                             len   -= rw.x1 - x1src;
00617                             x1src  = rw.x1;
00618                         }
00619                         if(len > 0)
00620                         {
00621                             if(x1src + len-1 > rw.x2)
00622                             {
00623                                 len -= x1src + len - rw.x2 - 1;
00624                             }
00625                             if(len > 0)
00626                             {
00627                                 m_ren->blend_from_color(src,
00628                                                         color,
00629                                                         x1dst, rdst.y1,
00630                                                         x1src, rsrc.y1,
00631                                                         len,
00632                                                         cover);
00633                             }
00634                         }
00635                     }
00636                     rdst.y1 += incy;
00637                     rsrc.y1 += incy;
00638                     --rc.y2;
00639                 }
00640             }
00641         }
00642 
00643         //--------------------------------------------------------------------
00644         template<class SrcPixelFormatRenderer>
00645         void blend_from_lut(const SrcPixelFormatRenderer& src, 
00646                             const color_type* color_lut,
00647                             const rect_i* rect_src_ptr = 0, 
00648                             int dx = 0, 
00649                             int dy = 0,
00650                             cover_type cover = agg::cover_full)
00651         {
00652             rect_i rsrc(0, 0, src.width(), src.height());
00653             if(rect_src_ptr)
00654             {
00655                 rsrc.x1 = rect_src_ptr->x1; 
00656                 rsrc.y1 = rect_src_ptr->y1;
00657                 rsrc.x2 = rect_src_ptr->x2 + 1;
00658                 rsrc.y2 = rect_src_ptr->y2 + 1;
00659             }
00660 
00661             // Version with xdst, ydst (absolute positioning)
00662             //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
00663 
00664             // Version with dx, dy (relative positioning)
00665             rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
00666             rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
00667 
00668             if(rc.x2 > 0)
00669             {
00670                 int incy = 1;
00671                 if(rdst.y1 > rsrc.y1)
00672                 {
00673                     rsrc.y1 += rc.y2 - 1;
00674                     rdst.y1 += rc.y2 - 1;
00675                     incy = -1;
00676                 }
00677                 while(rc.y2 > 0)
00678                 {
00679                     typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1);
00680                     if(rw.ptr)
00681                     {
00682                         int x1src = rsrc.x1;
00683                         int x1dst = rdst.x1;
00684                         int len   = rc.x2;
00685                         if(rw.x1 > x1src)
00686                         {
00687                             x1dst += rw.x1 - x1src;
00688                             len   -= rw.x1 - x1src;
00689                             x1src  = rw.x1;
00690                         }
00691                         if(len > 0)
00692                         {
00693                             if(x1src + len-1 > rw.x2)
00694                             {
00695                                 len -= x1src + len - rw.x2 - 1;
00696                             }
00697                             if(len > 0)
00698                             {
00699                                 m_ren->blend_from_lut(src,
00700                                                       color_lut,
00701                                                       x1dst, rdst.y1,
00702                                                       x1src, rsrc.y1,
00703                                                       len,
00704                                                       cover);
00705                             }
00706                         }
00707                     }
00708                     rdst.y1 += incy;
00709                     rsrc.y1 += incy;
00710                     --rc.y2;
00711                 }
00712             }
00713         }
00714 
00715     private:
00716         pixfmt_type* m_ren;
00717         rect_i       m_clip_box;
00718     };
00719 
00720 
00721 }
00722 
00723 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines