xref: /haiku/headers/libs/agg/agg_vcgen_contour.h (revision 2e7da8455a92f61db667fdaf602308344c4426d6)
139241fe2SDarkWyrm //----------------------------------------------------------------------------
2*e39da397SStephan Aßmus // Anti-Grain Geometry - Version 2.4
3*e39da397SStephan Aßmus // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
439241fe2SDarkWyrm //
539241fe2SDarkWyrm // Permission to copy, use, modify, sell and distribute this software
639241fe2SDarkWyrm // is granted provided this copyright notice appears in all copies.
739241fe2SDarkWyrm // This software is provided "as is" without express or implied
839241fe2SDarkWyrm // warranty, and with no claim as to its suitability for any purpose.
939241fe2SDarkWyrm //
1039241fe2SDarkWyrm //----------------------------------------------------------------------------
1139241fe2SDarkWyrm // Contact: mcseem@antigrain.com
1239241fe2SDarkWyrm //          mcseemagg@yahoo.com
1339241fe2SDarkWyrm //          http://www.antigrain.com
1439241fe2SDarkWyrm //----------------------------------------------------------------------------
1539241fe2SDarkWyrm 
1639241fe2SDarkWyrm #ifndef AGG_VCGEN_CONTOUR_INCLUDED
1739241fe2SDarkWyrm #define AGG_VCGEN_CONTOUR_INCLUDED
1839241fe2SDarkWyrm 
19abd00302SDarkWyrm #include "agg_math_stroke.h"
2039241fe2SDarkWyrm 
2139241fe2SDarkWyrm namespace agg
2239241fe2SDarkWyrm {
2339241fe2SDarkWyrm 
2439241fe2SDarkWyrm     //----------------------------------------------------------vcgen_contour
2539241fe2SDarkWyrm     //
2639241fe2SDarkWyrm     // See Implementation agg_vcgen_contour.cpp
2739241fe2SDarkWyrm     //
2839241fe2SDarkWyrm     class vcgen_contour
2939241fe2SDarkWyrm     {
3039241fe2SDarkWyrm         enum status_e
3139241fe2SDarkWyrm         {
3239241fe2SDarkWyrm             initial,
3339241fe2SDarkWyrm             ready,
3439241fe2SDarkWyrm             outline,
35abd00302SDarkWyrm             out_vertices,
36abd00302SDarkWyrm             end_poly,
37abd00302SDarkWyrm             stop
3839241fe2SDarkWyrm         };
3939241fe2SDarkWyrm 
4039241fe2SDarkWyrm     public:
4139241fe2SDarkWyrm         typedef vertex_sequence<vertex_dist, 6> vertex_storage;
42*e39da397SStephan Aßmus         typedef pod_bvector<point_d, 6>         coord_storage;
4339241fe2SDarkWyrm 
4439241fe2SDarkWyrm         vcgen_contour();
4539241fe2SDarkWyrm 
line_cap(line_cap_e lc)46*e39da397SStephan Aßmus         void line_cap(line_cap_e lc)     { m_stroker.line_cap(lc); }
line_join(line_join_e lj)47*e39da397SStephan Aßmus         void line_join(line_join_e lj)   { m_stroker.line_join(lj); }
inner_join(inner_join_e ij)48*e39da397SStephan Aßmus         void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); }
4939241fe2SDarkWyrm 
line_cap()50*e39da397SStephan Aßmus         line_cap_e   line_cap()   const { return m_stroker.line_cap(); }
line_join()51*e39da397SStephan Aßmus         line_join_e  line_join()  const { return m_stroker.line_join(); }
inner_join()52*e39da397SStephan Aßmus         inner_join_e inner_join() const { return m_stroker.inner_join(); }
53*e39da397SStephan Aßmus 
width(double w)54*e39da397SStephan Aßmus         void width(double w) { m_stroker.width(m_width = w); }
miter_limit(double ml)55*e39da397SStephan Aßmus         void miter_limit(double ml) { m_stroker.miter_limit(ml); }
miter_limit_theta(double t)56*e39da397SStephan Aßmus         void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); }
inner_miter_limit(double ml)57*e39da397SStephan Aßmus         void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); }
approximation_scale(double as)58*e39da397SStephan Aßmus         void approximation_scale(double as) { m_stroker.approximation_scale(as); }
59*e39da397SStephan Aßmus 
width()60*e39da397SStephan Aßmus         double width() const { return m_width; }
miter_limit()61*e39da397SStephan Aßmus         double miter_limit() const { return m_stroker.miter_limit(); }
inner_miter_limit()62*e39da397SStephan Aßmus         double inner_miter_limit() const { return m_stroker.inner_miter_limit(); }
approximation_scale()63*e39da397SStephan Aßmus         double approximation_scale() const { return m_stroker.approximation_scale(); }
64*e39da397SStephan Aßmus 
auto_detect_orientation(bool v)65*e39da397SStephan Aßmus         void auto_detect_orientation(bool v) { m_auto_detect = v; }
auto_detect_orientation()6639241fe2SDarkWyrm         bool auto_detect_orientation() const { return m_auto_detect; }
6739241fe2SDarkWyrm 
6839241fe2SDarkWyrm         // Generator interface
6939241fe2SDarkWyrm         void remove_all();
7039241fe2SDarkWyrm         void add_vertex(double x, double y, unsigned cmd);
7139241fe2SDarkWyrm 
7239241fe2SDarkWyrm         // Vertex Source Interface
73*e39da397SStephan Aßmus         void     rewind(unsigned path_id);
7439241fe2SDarkWyrm         unsigned vertex(double* x, double* y);
7539241fe2SDarkWyrm 
7639241fe2SDarkWyrm     private:
7739241fe2SDarkWyrm         vcgen_contour(const vcgen_contour&);
7839241fe2SDarkWyrm         const vcgen_contour& operator = (const vcgen_contour&);
7939241fe2SDarkWyrm 
80*e39da397SStephan Aßmus         math_stroke<coord_storage> m_stroker;
81*e39da397SStephan Aßmus         double                     m_width;
8239241fe2SDarkWyrm         vertex_storage             m_src_vertices;
83abd00302SDarkWyrm         coord_storage              m_out_vertices;
8439241fe2SDarkWyrm         status_e                   m_status;
8539241fe2SDarkWyrm         unsigned                   m_src_vertex;
86abd00302SDarkWyrm         unsigned                   m_out_vertex;
8739241fe2SDarkWyrm         unsigned                   m_closed;
8839241fe2SDarkWyrm         unsigned                   m_orientation;
8939241fe2SDarkWyrm         bool                       m_auto_detect;
9039241fe2SDarkWyrm     };
9139241fe2SDarkWyrm 
9239241fe2SDarkWyrm }
9339241fe2SDarkWyrm 
9439241fe2SDarkWyrm #endif
95