Anti-Grain Geometry - AGG (libagg)
2.5
|
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_VPGEN_CLIP_POLYLINE_INCLUDED 00026 #define AGG_VPGEN_CLIP_POLYLINE_INCLUDED 00027 00028 #include "agg_basics.h" 00029 00030 namespace agg 00031 { 00032 00033 //======================================================vpgen_clip_polyline 00034 // 00035 // See Implementation agg_vpgen_clip_polyline.cpp 00036 // 00037 class vpgen_clip_polyline 00038 { 00039 public: 00040 vpgen_clip_polyline() : 00041 m_clip_box(0, 0, 1, 1), 00042 m_x1(0), 00043 m_y1(0), 00044 m_num_vertices(0), 00045 m_vertex(0), 00046 m_move_to(false) 00047 { 00048 } 00049 00050 void clip_box(double x1, double y1, double x2, double y2) 00051 { 00052 m_clip_box.x1 = x1; 00053 m_clip_box.y1 = y1; 00054 m_clip_box.x2 = x2; 00055 m_clip_box.y2 = y2; 00056 m_clip_box.normalize(); 00057 } 00058 00059 double x1() const { return m_clip_box.x1; } 00060 double y1() const { return m_clip_box.y1; } 00061 double x2() const { return m_clip_box.x2; } 00062 double y2() const { return m_clip_box.y2; } 00063 00064 static bool auto_close() { return false; } 00065 static bool auto_unclose() { return true; } 00066 00067 void reset(); 00068 void move_to(double x, double y); 00069 void line_to(double x, double y); 00070 unsigned vertex(double* x, double* y); 00071 00072 private: 00073 rect_d m_clip_box; 00074 double m_x1; 00075 double m_y1; 00076 double m_x[2]; 00077 double m_y[2]; 00078 unsigned m_cmd[2]; 00079 unsigned m_num_vertices; 00080 unsigned m_vertex; 00081 bool m_move_to; 00082 }; 00083 00084 } 00085 00086 00087 #endif