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_VCGEN_DASH_INCLUDED 00026 #define AGG_VCGEN_DASH_INCLUDED 00027 00028 #include "agg_basics.h" 00029 #include "agg_vertex_sequence.h" 00030 00031 namespace agg 00032 { 00033 00034 //---------------------------------------------------------------vcgen_dash 00035 // 00036 // See Implementation agg_vcgen_dash.cpp 00037 // 00038 class vcgen_dash 00039 { 00040 enum max_dashes_e 00041 { 00042 max_dashes = 32 00043 }; 00044 00045 enum status_e 00046 { 00047 initial, 00048 ready, 00049 polyline, 00050 stop 00051 }; 00052 00053 public: 00054 typedef vertex_sequence<vertex_dist, 6> vertex_storage; 00055 00056 vcgen_dash(); 00057 00058 void remove_all_dashes(); 00059 void add_dash(double dash_len, double gap_len); 00060 void dash_start(double ds); 00061 00062 void shorten(double s) { m_shorten = s; } 00063 double shorten() const { return m_shorten; } 00064 00065 // Vertex Generator Interface 00066 void remove_all(); 00067 void add_vertex(double x, double y, unsigned cmd); 00068 00069 // Vertex Source Interface 00070 void rewind(unsigned path_id); 00071 unsigned vertex(double* x, double* y); 00072 00073 private: 00074 vcgen_dash(const vcgen_dash&); 00075 const vcgen_dash& operator = (const vcgen_dash&); 00076 00077 void calc_dash_start(double ds); 00078 00079 double m_dashes[max_dashes]; 00080 double m_total_dash_len; 00081 unsigned m_num_dashes; 00082 double m_dash_start; 00083 double m_shorten; 00084 double m_curr_dash_start; 00085 unsigned m_curr_dash; 00086 double m_curr_rest; 00087 const vertex_dist* m_v1; 00088 const vertex_dist* m_v2; 00089 00090 vertex_storage m_src_vertices; 00091 unsigned m_closed; 00092 status_e m_status; 00093 unsigned m_src_vertex; 00094 }; 00095 00096 00097 } 00098 00099 #endif