1 //---------------------------------------------------------------------------- 2 // Anti-Grain Geometry - Version 2.2 3 // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com) 4 // 5 // Permission to copy, use, modify, sell and distribute this software 6 // is granted provided this copyright notice appears in all copies. 7 // This software is provided "as is" without express or implied 8 // warranty, and with no claim as to its suitability for any purpose. 9 // 10 //---------------------------------------------------------------------------- 11 // Contact: mcseem@antigrain.com 12 // mcseemagg@yahoo.com 13 // http://www.antigrain.com 14 //---------------------------------------------------------------------------- 15 // 16 // Rounded rectangle vertex generator 17 // 18 //---------------------------------------------------------------------------- 19 20 #ifndef AGG_ROUNDED_RECT_INCLUDED 21 #define AGG_ROUNDED_RECT_INCLUDED 22 23 #include "agg_basics.h" 24 #include "agg_arc.h" 25 #include "agg_vertex_iterator.h" 26 27 28 namespace agg 29 { 30 //------------------------------------------------------------rounded_rect 31 // 32 // See Implemantation agg_rounded_rect.cpp 33 // 34 class rounded_rect 35 { 36 public: 37 rounded_rect() {} 38 rounded_rect(double x1, double y1, double x2, double y2, double r); 39 40 void rect(double x1, double y1, double x2, double y2); 41 void radius(double r); 42 void radius(double rx, double ry); 43 void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top); 44 void radius(double rx1, double ry1, double rx2, double ry2, 45 double rx3, double ry3, double rx4, double ry4); 46 void normalize_radius(); 47 48 void approximation_scale(double s) { m_arc.approximation_scale(s); } 49 double approximation_scale() const { return m_arc.approximation_scale(); } 50 51 void rewind(unsigned); 52 unsigned vertex(double* x, double* y); 53 54 typedef rounded_rect source_type; 55 typedef vertex_iterator<source_type> iterator; 56 iterator begin(unsigned id) { return iterator(*this, id); } 57 iterator end() { return iterator(path_cmd_stop); } 58 59 private: 60 double m_x1; 61 double m_y1; 62 double m_x2; 63 double m_y2; 64 double m_rx1; 65 double m_ry1; 66 double m_rx2; 67 double m_ry2; 68 double m_rx3; 69 double m_ry3; 70 double m_rx4; 71 double m_ry4; 72 unsigned m_status; 73 arc m_arc; 74 }; 75 76 } 77 78 #endif 79 80