xref: /haiku/headers/libs/agg/agg_vpgen_segmentator.h (revision 95bac3fda53a4cb21880712d7b43f8c21db32a2e)
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 #ifndef AGG_VPGEN_SEGMENTATOR_INCLUDED
17 #define AGG_VPGEN_SEGMENTATOR_INCLUDED
18 
19 #include <math.h>
20 #include "agg_basics.h"
21 
22 namespace agg
23 {
24 
25     //=======================================================vpgen_segmentator
26     //
27     // See Implementation agg_vpgen_segmentator.cpp
28     //
29     class vpgen_segmentator
30     {
31     public:
32         vpgen_segmentator() : m_approximation_scale(1.0) {}
33 
34         void approximation_scale(double s) { m_approximation_scale = s;     }
35         double approximation_scale() const { return m_approximation_scale;  }
36 
37         static bool auto_close()   { return false; }
38         static bool auto_unclose() { return false; }
39 
40         void reset() { m_cmd = path_cmd_stop; }
41         void move_to(double x, double y);
42         void line_to(double x, double y);
43         unsigned vertex(double* x, double* y);
44 
45     private:
46         double   m_approximation_scale;
47         double   m_x1;
48         double   m_y1;
49         double   m_dx;
50         double   m_dy;
51         double   m_dl;
52         double   m_ddl;
53         unsigned m_cmd;
54     };
55 
56 
57 
58 }
59 
60 #endif
61 
62