FastUIDraw
painter_stroke_params.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_stroke_params.hpp
3  * \brief file painter_stroke_params.hpp
4  *
5  * Copyright 2016 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_PAINTER_STROKE_PARAMS_HPP
20 #define FASTUIDRAW_PAINTER_STROKE_PARAMS_HPP
21 
24 
25 namespace fastuidraw
26 {
27 /*!\addtogroup PainterShaderData
28  * @{
29  */
30 
31  /*!
32  * \brief
33  * Class to specify stroking parameters, data is packed
34  * as according to PainterStrokeParams::stroke_data_offset_t.
35  */
37  {
38  public:
39  /*!
40  * \brief
41  * Enumeration to specify the units of the stroking radius
42  */
44  {
45  /*!
46  * Indicates that the stroking units is in local
47  * coordinates of the Path being stroking
48  */
50 
51  /*!
52  * Indicates that the stroking units are in pixels
53  */
55  };
56 
57  /*!
58  * \brief
59  * Enumeration that provides offsets for the stroking
60  * parameters.
61  */
63  {
64  stroke_radius_offset, /*!< Offset to stroke radius (packed as float) */
65  stroke_miter_limit_offset, /*!< offset to stroke miter limit (packed as float) */
66  stroking_units_offset, /*!< Offset to stroking units (packed as uint) */
67 
68  stroke_data_size /*!< size of data for stroking*/
69  };
70 
71  /*!
72  * Ctor.
73  */
74  PainterStrokeParams(void);
75 
76  /*!
77  * Copy ctor.
78  */
80 
82 
83  /*!
84  * Assignment operator.
85  * \param obj value from which to copy
86  */
88  operator=(const PainterStrokeParams &obj);
89 
90  /*!
91  * Swap operation
92  * \param obj object with which to swap
93  */
94  void
96 
97  /*!
98  * The miter limit for miter joins.
99  * Default value is 15.0.
100  */
101  float
102  miter_limit(void) const;
103 
104  /*!
105  * Set the value of miter_limit(void) const;
106  * value is clamped to be non-negative.
107  */
109  miter_limit(float f);
110 
111  /*!
112  * The stroking width, always non-negative.
113  * Default value is 2.0.
114  */
115  float
116  width(void) const;
117 
118  /*!
119  * Set the value of width(void) const,
120  * values are clamped to be non-negative.
121  */
123  width(float f);
124 
125  /*!
126  * The stroking radius, equivalent to
127  * \code
128  * width() * 0.5
129  * \endcode
130  * Default value is 1.0.
131  */
132  float
133  radius(void) const;
134 
135  /*!
136  * Set the value of radius(void) const,
137  * equivalent to
138  * \code
139  * width(2.0 * f)
140  * \endcode
141  */
143  radius(float f);
144 
145  /*!
146  * Returns the units of the stroking, default value is
147  * \ref path_stroking_units
148  */
149  enum stroking_units_t
150  stroking_units(void) const;
151 
152  /*!
153  * Set the value of stroking_units(void) const
154  */
157 
158  /*!
159  * Returns a StrokingDataSelectorBase suitable for PainterStrokeParams.
160  * \param pixel_arc_stroking_possible if true, will inform that arc-stroking
161  * width in \ref pixel_stroking_units is
162  * possible.
163  */
164  static
166  stroking_data_selector(bool pixel_arc_stroking_possible);
167 
168  unsigned int
169  data_size(void) const override;
170 
171  void
172  pack_data(c_array<uvec4> dst) const override;
173 
174  private:
175  void *m_d;
176  };
177 
178 /*! @} */
179 
180 } //namespace fastuidraw
181 
182 #endif
static reference_counted_ptr< const StrokingDataSelectorBase > stroking_data_selector(bool pixel_arc_stroking_possible)
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
void swap(PainterStrokeParams &obj)
A wrapper over a pointer to implement reference counting.
stroking_units_t
Enumeration to specify the units of the stroking radius.
file painter_shader_data.hpp
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
Definition: c_array.hpp:43
void pack_data(c_array< uvec4 > dst) const override
unsigned int data_size(void) const override
PainterStrokeParams & operator=(const PainterStrokeParams &obj)
enum stroking_units_t stroking_units(void) const
Class to specify stroking parameters, data is packed as according to PainterStrokeParams::stroke_data...
stroke_data_offset_t
Enumeration that provides offsets for the stroking parameters.
PainterItemShaderData holds custom data for item shaders.
file painter_stroke_shader.hpp