1/*!
2 * \file path_dash_effect.hpp
3 * \brief file path_dash_effect.hpp
4 *
5 * Copyright 2019 by Intel.
6 *
7 * Contact: kevin.rogovin@gmail.com
8 *
9 * This Source Code Form is subject to the
10 * terms of the Mozilla Public License, v. 2.0.
11 * If a copy of the MPL was not distributed with
12 * this file, You can obtain one at
13 * http://mozilla.org/MPL/2.0/.
14 *
15 * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16 *
17 */
18
19#ifndef FASTUIDRAW_PATH_DASH_EFFECT_HPP
20#define FASTUIDRAW_PATH_DASH_EFFECT_HPP
21
22#include <fastuidraw/path_effect.hpp>
23
24namespace fastuidraw
25{
26/*!\addtogroup Paths
27 * @{
28 */
29
30 /*!
31 * A \ref PathDashEffect implemented \ref PathEffect to
32 * apply a dash pattern to a path. The output data of a
33 * \ref PathDashEffect -keeps- the distance values of
34 * how far along an ege or countour, i.e. the values of
35 * \ref TessellatedPath::cap::m_contour_length,
36 * \ref TessellatedPath::cap::m_edge_length,
37 * \ref TessellatedPath::cap::m_distance_from_edge_start,
38 * \ref TessellatedPath::cap::m_distance_from_contour_start,
39 * \ref TessellatedPath::join::m_distance_from_previous_join,
40 * \ref TessellatedPath::join::m_distance_from_contour_start,
41 * \ref TessellatedPath::join::m_contour_length,
42 * \ref TessellatedPath::segment::m_distance_from_edge_start,
43 * \ref TessellatedPath::segment::m_distance_from_contour_start,
44 * \ref TessellatedPath::segment::m_contour_length and
45 * \ref TessellatedPath::segment::m_edge_length are copied
46 * directly from the source data. Only the value \ref
47 * TessellatedPath::segment::m_length is adjusted (because
48 * a given segment might be split into multiple segments).
49 */
50 class PathDashEffect:public PathEffect
51 {
52 public:
53 PathDashEffect(void);
54 ~PathDashEffect();
55
56 /*!
57 * Clear the dash pattern.
58 */
59 PathDashEffect&
60 clear(void);
61
62 /*!
63 * Add an element to the dash pattern. An element in the
64 * dash pattern is a length to draw following by a length
65 * to skip.
66 * \param draw length of draw in element
67 * \param skip length of skip in element
68 */
69 PathDashEffect&
70 add_dash(float draw, float skip);
71
72 /*!
73 * Distance values from the elements of the path have
74 * this value added to them before having the dash-pattern
75 * applied.
76 */
77 PathDashEffect&
78 dash_offset(float v);
79
80 virtual
81 void
82 process_chain(const segment_chain &chain, Storage &dst) const override;
83
84 virtual
85 void
86 process_join(const TessellatedPath::join &join, Storage &dst) const override;
87
88 virtual
89 void
90 process_cap(const TessellatedPath::cap &cap, Storage &dst) const override;
91
92 private:
93 void *m_d;
94 };
95
96/*! @} */
97}
98
99#endif
100