Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_pixfmt_transposer.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_PIXFMT_TRANSPOSER_INCLUDED
00026 #define AGG_PIXFMT_TRANSPOSER_INCLUDED
00027 
00028 #include "agg_basics.h"
00029 
00030 namespace agg
00031 {
00032     //=======================================================pixfmt_transposer
00033     template<class PixFmt> class pixfmt_transposer
00034     {
00035     public:
00036         typedef PixFmt pixfmt_type;
00037         typedef typename pixfmt_type::color_type color_type;
00038         typedef typename pixfmt_type::row_data row_data;
00039         typedef typename color_type::value_type value_type;
00040         typedef typename color_type::calc_type calc_type;
00041 
00042         //--------------------------------------------------------------------
00043         pixfmt_transposer() : m_pixf(0) {}
00044         explicit pixfmt_transposer(pixfmt_type& pixf) : m_pixf(&pixf) {}
00045         void attach(pixfmt_type& pixf) { m_pixf = &pixf; }
00046 
00047         //--------------------------------------------------------------------
00048         AGG_INLINE unsigned width()  const { return m_pixf->height();  }
00049         AGG_INLINE unsigned height() const { return m_pixf->width(); }
00050 
00051         //--------------------------------------------------------------------
00052         AGG_INLINE color_type pixel(int x, int y) const
00053         {
00054             return m_pixf->pixel(y, x);
00055         }
00056 
00057         //--------------------------------------------------------------------
00058         AGG_INLINE void copy_pixel(int x, int y, const color_type& c)
00059         {
00060             m_pixf->copy_pixel(y, x, c);
00061         }
00062 
00063         //--------------------------------------------------------------------
00064         AGG_INLINE void blend_pixel(int x, int y, 
00065                                     const color_type& c, 
00066                                     int8u cover)
00067         {
00068             m_pixf->blend_pixel(y, x, c, cover);
00069         }
00070 
00071         //--------------------------------------------------------------------
00072         AGG_INLINE void copy_hline(int x, int y, 
00073                                    unsigned len, 
00074                                    const color_type& c)
00075         {
00076             m_pixf->copy_vline(y, x, len, c);
00077         }
00078 
00079         //--------------------------------------------------------------------
00080         AGG_INLINE void copy_vline(int x, int y,
00081                                    unsigned len, 
00082                                    const color_type& c)
00083         {
00084             m_pixf->copy_hline(y, x, len, c);
00085         }
00086 
00087         //--------------------------------------------------------------------
00088         AGG_INLINE void blend_hline(int x, int y,
00089                                     unsigned len, 
00090                                     const color_type& c,
00091                                     int8u cover)
00092         {
00093             m_pixf->blend_vline(y, x, len, c, cover);
00094         }
00095 
00096         //--------------------------------------------------------------------
00097         AGG_INLINE void blend_vline(int x, int y,
00098                                     unsigned len, 
00099                                     const color_type& c,
00100                                     int8u cover)
00101         {
00102             m_pixf->blend_hline(y, x, len, c, cover);
00103         }
00104 
00105         //--------------------------------------------------------------------
00106         AGG_INLINE void blend_solid_hspan(int x, int y,
00107                                           unsigned len, 
00108                                           const color_type& c,
00109                                           const int8u* covers)
00110         {
00111             m_pixf->blend_solid_vspan(y, x, len, c, covers);
00112         }
00113 
00114         //--------------------------------------------------------------------
00115         AGG_INLINE void blend_solid_vspan(int x, int y,
00116                                           unsigned len, 
00117                                           const color_type& c,
00118                                           const int8u* covers)
00119         {
00120             m_pixf->blend_solid_hspan(y, x, len, c, covers);
00121         }
00122 
00123         //--------------------------------------------------------------------
00124         AGG_INLINE void copy_color_hspan(int x, int y,
00125                                          unsigned len, 
00126                                          const color_type* colors)
00127         {
00128             m_pixf->copy_color_vspan(y, x, len, colors);
00129         }
00130 
00131         //--------------------------------------------------------------------
00132         AGG_INLINE void copy_color_vspan(int x, int y,
00133                                          unsigned len, 
00134                                          const color_type* colors)
00135         {
00136             m_pixf->copy_color_hspan(y, x, len, colors);
00137         }
00138 
00139         //--------------------------------------------------------------------
00140         AGG_INLINE void blend_color_hspan(int x, int y,
00141                                           unsigned len, 
00142                                           const color_type* colors,
00143                                           const int8u* covers,
00144                                           int8u cover)
00145         {
00146             m_pixf->blend_color_vspan(y, x, len, colors, covers, cover);
00147         }
00148 
00149         //--------------------------------------------------------------------
00150         AGG_INLINE void blend_color_vspan(int x, int y,
00151                                unsigned len, 
00152                                const color_type* colors,
00153                                const int8u* covers,
00154                                int8u cover)
00155         {
00156             m_pixf->blend_color_hspan(y, x, len, colors, covers, cover);
00157         }
00158 
00159     private:
00160         pixfmt_type* m_pixf;
00161     };
00162 }
00163 
00164 #endif
00165 
00166 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines