Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_span_converter.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_CONVERTER_INCLUDED
00026 #define AGG_SPAN_CONVERTER_INCLUDED
00027 
00028 #include "agg_basics.h"
00029 
00030 namespace agg
00031 {
00032     //----------------------------------------------------------span_converter
00033     template<class SpanGenerator, class SpanConverter> class span_converter
00034     {
00035     public:
00036         typedef typename SpanGenerator::color_type color_type;
00037 
00038         span_converter(SpanGenerator& span_gen, SpanConverter& span_cnv) : 
00039             m_span_gen(&span_gen), m_span_cnv(&span_cnv) {}
00040 
00041         void attach_generator(SpanGenerator& span_gen) { m_span_gen = &span_gen; }
00042         void attach_converter(SpanConverter& span_cnv) { m_span_cnv = &span_cnv; }
00043 
00044         //--------------------------------------------------------------------
00045         void prepare() 
00046         { 
00047             m_span_gen->prepare(); 
00048             m_span_cnv->prepare();
00049         }
00050 
00051         //--------------------------------------------------------------------
00052         void generate(color_type* span, int x, int y, unsigned len)
00053         {
00054             m_span_gen->generate(span, x, y, len);
00055             m_span_cnv->generate(span, x, y, len);
00056         }
00057 
00058     private:
00059         SpanGenerator* m_span_gen;
00060         SpanConverter* m_span_cnv;
00061     };
00062 
00063 }
00064 
00065 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines