Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_span_interpolator_adaptor.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_SPAN_INTERPOLATOR_ADAPTOR_INCLUDED
00026 #define AGG_SPAN_INTERPOLATOR_ADAPTOR_INCLUDED
00027 
00028 #include "agg_basics.h"
00029 
00030 namespace agg
00031 {
00032 
00033     //===============================================span_interpolator_adaptor
00034     template<class Interpolator, class Distortion>
00035     class span_interpolator_adaptor : public Interpolator
00036     {
00037     public:
00038         typedef Interpolator base_type;
00039         typedef typename base_type::trans_type trans_type;
00040         typedef Distortion distortion_type;
00041 
00042         //--------------------------------------------------------------------
00043         span_interpolator_adaptor() {}
00044         span_interpolator_adaptor(const trans_type& trans, 
00045                                   const distortion_type& dist) :
00046             base_type(trans),
00047             m_distortion(&dist)
00048         {   
00049         }
00050 
00051         //--------------------------------------------------------------------
00052         span_interpolator_adaptor(const trans_type& trans,
00053                                   const distortion_type& dist,
00054                                   double x, double y, unsigned len) :
00055             base_type(trans, x, y, len),
00056             m_distortion(&dist)
00057         {
00058         }
00059 
00060         //--------------------------------------------------------------------
00061         const distortion_type& distortion() const
00062         {
00063             return *m_distortion;
00064         }
00065 
00066         //--------------------------------------------------------------------
00067         void distortion(const distortion_type& dist)
00068         {
00069             m_distortion = dist;
00070         }
00071 
00072         //--------------------------------------------------------------------
00073         void coordinates(int* x, int* y) const
00074         {
00075             base_type::coordinates(x, y);
00076             m_distortion->calculate(x, y);
00077         }
00078 
00079     private:
00080         //--------------------------------------------------------------------
00081         const distortion_type* m_distortion;
00082     };
00083 }
00084 
00085 
00086 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines