1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.3
3 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
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.
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 // mcseemagg@yahoo.com
13 // http://www.antigrain.com
14 //----------------------------------------------------------------------------
16 // Simple arrowhead/arrowtail generator
18 //----------------------------------------------------------------------------
20 #include "agg_arrowhead.h"
25 //------------------------------------------------------------------------
26 arrowhead::arrowhead() :
44 //------------------------------------------------------------------------
45 void arrowhead::rewind(unsigned id
)
53 m_cmd
[0] = path_cmd_stop
;
56 m_coord
[0] = m_tail_d1
; m_coord
[1] = 0.0;
57 m_coord
[2] = m_tail_d1
- m_tail_d4
; m_coord
[3] = m_tail_d3
;
58 m_coord
[4] = -m_tail_d2
- m_tail_d4
; m_coord
[5] = m_tail_d3
;
59 m_coord
[6] = -m_tail_d2
; m_coord
[7] = 0.0;
60 m_coord
[8] = -m_tail_d2
- m_tail_d4
; m_coord
[9] = -m_tail_d3
;
61 m_coord
[10] = m_tail_d1
- m_tail_d4
; m_coord
[11] = -m_tail_d3
;
63 m_cmd
[0] = path_cmd_move_to
;
64 m_cmd
[1] = path_cmd_line_to
;
65 m_cmd
[2] = path_cmd_line_to
;
66 m_cmd
[3] = path_cmd_line_to
;
67 m_cmd
[4] = path_cmd_line_to
;
68 m_cmd
[5] = path_cmd_line_to
;
69 m_cmd
[7] = (unsigned)path_cmd_end_poly
| (unsigned)path_flags_close
| (unsigned)path_flags_ccw
;
70 m_cmd
[6] = path_cmd_stop
;
78 m_cmd
[0] = path_cmd_stop
;
81 m_coord
[0] = -m_head_d1
; m_coord
[1] = 0.0;
82 m_coord
[2] = m_head_d2
+ m_head_d4
; m_coord
[3] = -m_head_d3
;
83 m_coord
[4] = m_head_d2
; m_coord
[5] = 0.0;
84 m_coord
[6] = m_head_d2
+ m_head_d4
; m_coord
[7] = m_head_d3
;
86 m_cmd
[0] = path_cmd_move_to
;
87 m_cmd
[1] = path_cmd_line_to
;
88 m_cmd
[2] = path_cmd_line_to
;
89 m_cmd
[3] = path_cmd_line_to
;
90 m_cmd
[4] = (unsigned)path_cmd_end_poly
| (unsigned)path_flags_close
| (unsigned)path_flags_ccw
;
91 m_cmd
[5] = path_cmd_stop
;
97 //------------------------------------------------------------------------
98 unsigned arrowhead::vertex(double* x
, double* y
)
102 unsigned curr_idx
= m_curr_coord
* 2;
103 *x
= m_coord
[curr_idx
];
104 *y
= m_coord
[curr_idx
+ 1];
105 return m_cmd
[m_curr_coord
++];
107 return path_cmd_stop
;