xref: /aosp_15_r20/external/pdfium/third_party/agg23/agg_vcgen_dash.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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: [email protected]
13 //          [email protected]
14 //          http://www.antigrain.com
15 //----------------------------------------------------------------------------
16 //
17 // Line dash generator
18 //
19 //----------------------------------------------------------------------------
20 #ifndef AGG_VCGEN_DASH_INCLUDED
21 #define AGG_VCGEN_DASH_INCLUDED
22 #include "agg_basics.h"
23 #include "agg_vertex_sequence.h"
24 namespace pdfium
25 {
26 namespace agg
27 {
28 class vcgen_dash
29 {
30     enum max_dashes_e {
31         max_dashes = 32
32     };
33     enum status_e {
34         initial,
35         ready,
36         polyline,
37         stop
38     };
39 public:
40     typedef vertex_sequence<vertex_dist, 6> vertex_storage;
41     vcgen_dash();
42     void remove_all_dashes();
43     void add_dash(float dash_len, float gap_len);
44     void dash_start(float ds);
shorten(float s)45     void shorten(float s)
46     {
47         m_shorten = s;
48     }
shorten()49     double shorten() const
50     {
51         return m_shorten;
52     }
53     void remove_all();
54     void add_vertex(float x, float y, unsigned cmd);
55     void     rewind(unsigned path_id);
56     unsigned vertex(float* x, float* y);
57 private:
58     vcgen_dash(const vcgen_dash&);
59     const vcgen_dash& operator = (const vcgen_dash&);
60     void calc_dash_start(float ds);
61     float     m_dashes[max_dashes];
62     float		m_total_dash_len;
63     unsigned        m_num_dashes;
64     float     m_dash_start;
65     float     m_shorten;
66     float     m_curr_dash_start;
67     unsigned        m_curr_dash;
68     float     m_curr_rest;
69     const vertex_dist* m_v1;
70     const vertex_dist* m_v2;
71     vertex_storage m_src_vertices;
72     unsigned       m_closed;
73     status_e       m_status;
74     unsigned       m_src_vertex;
75 };
76 }
77 }  // namespace pdfium
78 #endif
79