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