Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_conv_clip_polyline.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 // polyline clipping converter
00026 // There an optimized Liang-Basky algorithm is used. 
00027 // The algorithm doesn't optimize the degenerate edges, i.e. it will never
00028 // break a closed polyline into two or more ones, instead, there will be 
00029 // degenerate edges coinciding with the respective clipping boundaries.
00030 // This is a sub-optimal solution, because that optimization would require 
00031 // extra, rather expensive math while the rasterizer tolerates it quite well, 
00032 // without any considerable overhead.
00033 //
00034 //----------------------------------------------------------------------------
00035 #ifndef AGG_CONV_CLIP_polyline_INCLUDED
00036 #define AGG_CONV_CLIP_polyline_INCLUDED
00037 
00038 #include "agg_basics.h"
00039 #include "agg_conv_adaptor_vpgen.h"
00040 #include "agg_vpgen_clip_polyline.h"
00041 
00042 namespace agg
00043 {
00044 
00045     //=======================================================conv_clip_polyline
00046     template<class VertexSource> 
00047     struct conv_clip_polyline : public conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline>
00048     {
00049         typedef conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline> base_type;
00050 
00051         conv_clip_polyline(VertexSource& vs) : 
00052             conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline>(vs) {}
00053 
00054         void clip_box(double x1, double y1, double x2, double y2)
00055         {
00056             base_type::vpgen().clip_box(x1, y1, x2, y2);
00057         }
00058 
00059         double x1() const { return base_type::vpgen().x1(); }
00060         double y1() const { return base_type::vpgen().y1(); }
00061         double x2() const { return base_type::vpgen().x2(); }
00062         double y2() const { return base_type::vpgen().y2(); }
00063 
00064     private:
00065         conv_clip_polyline(const conv_clip_polyline<VertexSource>&);
00066         const conv_clip_polyline<VertexSource>& 
00067             operator = (const conv_clip_polyline<VertexSource>&);
00068     };
00069 
00070 }
00071 
00072 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines