FastUIDraw
stroking_attribute_writer.hpp
Go to the documentation of this file.
1 /*!
2  * \file stroking_attribute_writer.hpp
3  * \brief file stroking_attribute_writer.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_STROKING_ATTRIBUTE_WRITER_HPP
20 #define FASTUIDRAW_STROKING_ATTRIBUTE_WRITER_HPP
21 
27 
28 namespace fastuidraw
29 {
30 /*!\addtogroup PainterAttribute
31  * @{
32  */
33  /*!
34  * \brief
35  * A StrokingAttributeWriter is an implementation of \ref
36  * PainterAttributeWriter for the purpose of stroking a
37  * path.
38  */
40  {
41  public:
42  /*!
43  * \brief
44  * \ref StrokingMethod specifies how to pack the join
45  * and pack values from the source \ref PathEffect::Storage
46  */
48  {
49  public:
50  /*!
51  * Specifies how to realize the joins.
52  */
54 
55  /*!
56  * Specifies how to realize the caps.
57  */
59 
60  /*!
61  * If rounded joins or rounded caps are realized,
62  * this is the threshhold value used to realize
63  * the rounded joins and caps.
64  */
65  float m_thresh;
66  };
67 
68  /*!
69  * Ctor, initializes the StrokingAttributeWriter to stroke nothing.
70  */
72 
74 
75  /*!
76  * Change the \ref StrokingAttributeWriter to stroke the results of
77  * a \ref PathEffect
78  * \param src the results of a \ref PathEffect. The object given
79  * must stay in scope and its contents remain unchanged
80  * until the next call to set_source().
81  * \param shader what \ref PainterStrokeShader to use
82  * \param method speficies how caps and joins are realized
83  * \param tp determines if linear or arc-stroking are used
84  * \param aa determines if anti-alias shading is applied
85  * \param draw_edges if false, do not stroke the edges, i.e. only stroke the
86  * caps and joins.
87  */
88  void
90  const PainterStrokeShader &shader,
91  const StrokingMethod &method,
94  bool draw_edges = true);
95 
96  virtual
97  bool
98  requires_coverage_buffer(void) const override;
99 
100  virtual
101  unsigned int
102  state_length(void) const override;
103 
104  virtual
105  bool
106  initialize_state(WriteState *state) const override;
107 
108  virtual
109  void
110  on_new_store(WriteState *state) const override;
111 
112  virtual
113  bool
115  c_array<PainterIndex> dst_indices,
116  unsigned int attrib_location,
117  WriteState *state,
118  unsigned int *num_attribs_written,
119  unsigned int *num_indices_written) const override;
120  private:
121  void *m_d;
122  };
123 /*! @} */
124 }
125 
126 #endif
virtual unsigned int state_length(void) const override
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
virtual bool initialize_state(WriteState *state) const override
A PainterStrokeShader holds shaders for stroking. It is to hold shaders for stroking paths linearly o...
virtual bool requires_coverage_buffer(void) const override
Provides an interface to write attribute and index data when a simple copy of data from c_array objec...
file stroked_point.hpp
StrokingMethod specifies how to pack the join and pack values from the source PathEffect::Storage ...
join_style
Enumeration specifying if and how to draw joins when stroking.
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 painter_enums.hpp
file path_effect.hpp
A StrokingAttributeWriter is an implementation of PainterAttributeWriter for the purpose of stroking ...
file painter_attribute_writer.hpp
void set_source(const PathEffect::Storage &src, const PainterStrokeShader &shader, const StrokingMethod &method, enum PainterEnums::stroking_method_t tp, enum PainterStrokeShader::shader_type_t aa, bool draw_edges=true)
A Storage is to where TessellatedPath::segment, TessellatedPath::join and TessellatedPath::cap values...
Definition: path_effect.hpp:68
virtual void on_new_store(WriteState *state) const override
virtual bool write_data(c_array< PainterAttribute > dst_attribs, c_array< PainterIndex > dst_indices, unsigned int attrib_location, WriteState *state, unsigned int *num_attribs_written, unsigned int *num_indices_written) const override
file painter_stroke_shader.hpp