Home | History | Annotate | Download | only in agg23
      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 (at) antigrain.com
     13 //          mcseemagg (at) 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 agg
     20 {
     21 class vcgen_stroke
     22 {
     23     enum status_e {
     24         initial,
     25         ready,
     26         cap1,
     27         cap2,
     28         outline1,
     29         close_first,
     30         outline2,
     31         out_vertices,
     32         end_poly1,
     33         end_poly2,
     34         stop
     35     };
     36 public:
     37     typedef vertex_sequence<vertex_dist_cmd, 6> vertex_storage;
     38     typedef pod_deque<point_type, 6>        coord_storage;
     39     vcgen_stroke();
     40     void line_cap(line_cap_e lc)
     41     {
     42         m_line_cap = lc;
     43     }
     44     void line_join(line_join_e lj)
     45     {
     46         m_line_join = lj;
     47     }
     48     void inner_join(inner_join_e ij)
     49     {
     50         m_inner_join = ij;
     51     }
     52     line_cap_e   line_cap()   const
     53     {
     54         return m_line_cap;
     55     }
     56     line_join_e  line_join()  const
     57     {
     58         return m_line_join;
     59     }
     60     inner_join_e inner_join() const
     61     {
     62         return m_inner_join;
     63     }
     64     void width(float w)
     65     {
     66         m_width = w / 2;
     67     }
     68     void miter_limit(float ml)
     69     {
     70         m_miter_limit = ml;
     71     }
     72     void miter_limit_theta(float t);
     73     void inner_miter_limit(float ml)
     74     {
     75         m_inner_miter_limit = ml;
     76     }
     77     void approximation_scale(float as)
     78     {
     79         m_approx_scale = as;
     80     }
     81     float width() const
     82     {
     83         return m_width * 2;
     84     }
     85     float miter_limit() const
     86     {
     87         return m_miter_limit;
     88     }
     89     float inner_miter_limit() const
     90     {
     91         return m_inner_miter_limit;
     92     }
     93     float approximation_scale() const
     94     {
     95         return m_approx_scale;
     96     }
     97     void remove_all();
     98     void add_vertex(float x, float y, unsigned cmd);
     99     void     rewind(unsigned path_id);
    100     unsigned vertex(float* x, float* y);
    101 private:
    102     vcgen_stroke(const vcgen_stroke&);
    103     const vcgen_stroke& operator = (const vcgen_stroke&);
    104     vertex_storage m_src_vertices;
    105     coord_storage  m_out_vertices;
    106     float         m_width;
    107     float         m_miter_limit;
    108     float         m_inner_miter_limit;
    109     float         m_approx_scale;
    110     line_cap_e     m_line_cap;
    111     line_join_e    m_line_join;
    112     inner_join_e   m_inner_join;
    113     unsigned       m_closed;
    114     status_e       m_status;
    115     status_e       m_prev_status;
    116     unsigned       m_src_vertex;
    117     unsigned       m_out_vertex;
    118 };
    119 }
    120 #endif
    121