1 2 //---------------------------------------------------------------------------- 3 // Anti-Grain Geometry - Version 2.3 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 5 // 6 // Permission to copy, use, modify, sell and distribute this software 7 // is granted provided this copyright notice appears in all copies. 8 // This software is provided "as is" without express or implied 9 // warranty, and with no claim as to its suitability for any purpose. 10 // 11 //---------------------------------------------------------------------------- 12 // Contact: mcseem@antigrain.com 13 // mcseemagg@yahoo.com 14 // http://www.antigrain.com 15 //---------------------------------------------------------------------------- 16 #ifndef AGG_VCGEN_STROKE_INCLUDED 17 #define AGG_VCGEN_STROKE_INCLUDED 18 #include "agg_math_stroke.h" 19 namespace pdfium 20 { 21 namespace agg 22 { 23 class vcgen_stroke 24 { 25 enum status_e { 26 initial, 27 ready, 28 cap1, 29 cap2, 30 outline1, 31 close_first, 32 outline2, 33 out_vertices, 34 end_poly1, 35 end_poly2, 36 stop 37 }; 38 public: 39 typedef vertex_sequence<vertex_dist_cmd, 6> vertex_storage; 40 typedef pod_deque<point_type, 6> coord_storage; 41 vcgen_stroke(); line_cap(line_cap_e lc)42 void line_cap(line_cap_e lc) 43 { 44 m_line_cap = lc; 45 } line_join(line_join_e lj)46 void line_join(line_join_e lj) 47 { 48 m_line_join = lj; 49 } inner_join(inner_join_e ij)50 void inner_join(inner_join_e ij) 51 { 52 m_inner_join = ij; 53 } line_cap()54 line_cap_e line_cap() const 55 { 56 return m_line_cap; 57 } line_join()58 line_join_e line_join() const 59 { 60 return m_line_join; 61 } inner_join()62 inner_join_e inner_join() const 63 { 64 return m_inner_join; 65 } width(float w)66 void width(float w) 67 { 68 m_width = w / 2; 69 } miter_limit(float ml)70 void miter_limit(float ml) 71 { 72 m_miter_limit = ml; 73 } 74 void miter_limit_theta(float t); inner_miter_limit(float ml)75 void inner_miter_limit(float ml) 76 { 77 m_inner_miter_limit = ml; 78 } approximation_scale(float as)79 void approximation_scale(float as) 80 { 81 m_approx_scale = as; 82 } width()83 float width() const 84 { 85 return m_width * 2; 86 } miter_limit()87 float miter_limit() const 88 { 89 return m_miter_limit; 90 } inner_miter_limit()91 float inner_miter_limit() const 92 { 93 return m_inner_miter_limit; 94 } approximation_scale()95 float approximation_scale() const 96 { 97 return m_approx_scale; 98 } 99 void remove_all(); 100 void add_vertex(float x, float y, unsigned cmd); 101 void rewind(unsigned path_id); 102 unsigned vertex(float* x, float* y); 103 private: 104 vcgen_stroke(const vcgen_stroke&); 105 const vcgen_stroke& operator = (const vcgen_stroke&); 106 vertex_storage m_src_vertices; 107 coord_storage m_out_vertices; 108 float m_width; 109 float m_miter_limit; 110 float m_inner_miter_limit; 111 float m_approx_scale; 112 line_cap_e m_line_cap; 113 line_join_e m_line_join; 114 inner_join_e m_inner_join; 115 unsigned m_closed; 116 status_e m_status; 117 status_e m_prev_status; 118 unsigned m_src_vertex; 119 unsigned m_out_vertex; 120 }; 121 } 122 } // namespace pdfium 123 #endif 124