FastUIDraw
painter_brush_adjust.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_brush_adjust.hpp
3  * \brief file painter_brush_adjust.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 
20 #ifndef FASTUIDRAW_PAINTER_BRUSH_ADJUST_HPP
21 #define FASTUIDRAW_PAINTER_BRUSH_ADJUST_HPP
22 
23 #include <fastuidraw/util/util.hpp>
24 #include <fastuidraw/util/vecN.hpp>
27 
28 namespace fastuidraw
29 {
30 /*!\addtogroup PainterBackend
31  * @{
32  */
33 
34  /*!
35  * \brief
36  * A PainterBrushAdjust holds the value for applying a tranformation
37  * to the brush position before it is handed off to brush shading.
38  * The transformation is shearing composited with a translation,
39  * i.e. the transformation is given by
40  * \code
41  * out_value = m_shear * in_value + m_translate
42  * \endcode
43  */
45  {
46  public:
47  /*!
48  * \brief
49  * Enumeration that provides offsets for the values
50  * in a \ref PainterBrushAdjust in units of uint32_t.
51  */
53  {
54  shear_x_offset, /*!< offset of m_shear.x() (packed as float) */
55  shear_y_offset, /*!< offset of m_shear.y() (packed as float) */
56  translation_x_offset, /*!< offset of m_translation.x() (packed as float) */
57  translation_y_offset, /*!< offset of m_translation.y() (packed as float) */
58  raw_data_size, /*!< size of the raw data before padding*/
59  };
60 
61  /*!
62  * Ctor, initializes the adjustment as identity
63  */
64  explicit
66  m_shear(1.0f, 1.0f),
67  m_translate(0.0f, 0.0f)
68  {}
69 
70  /*!
71  * Returns the length of the data needed to encode the data.
72  * Data is padded to be multiple of 4.
73  */
74  unsigned int
75  data_size(void) const
76  {
78  }
79 
80  /*!
81  * Pack the values of this PainterItemMatrix
82  * \param dst place to which to pack data
83  */
84  void
85  pack_data(c_array<uvec4> dst) const;
86 
87  /*!
88  * The shearing to apply to the brush before the
89  * translation.
90  */
92 
93  /*!
94  * The translation to apply to the brush after
95  * applying the shearing.
96  */
98  };
99 
100 /*! @} */
101 }
102 
103 #endif
#define FASTUIDRAW_NUMBER_BLOCK4_NEEDED(X)
Definition: util.hpp:42
data_offset_t
Enumeration that provides offsets for the values in a PainterBrushAdjust in units of uint32_t...
file matrix.hpp
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
A PainterBrushAdjust holds the value for applying a tranformation to the brush position before it is ...
file c_array.hpp
file util.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
file vecN.hpp
void pack_data(c_array< uvec4 > dst) const
unsigned int data_size(void) const