FastUIDraw
painter_blend_shader.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_blend_shader.hpp
3  * \brief file painter_blend_shader.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 
20 #ifndef FASTUIDRAW_PAINTER_BLEND_SHADER_HPP
21 #define FASTUIDRAW_PAINTER_BLEND_SHADER_HPP
23 
24 namespace fastuidraw
25 {
26 
27 /*!\addtogroup PainterShaders
28  * @{
29  */
30 
31  /*!
32  * \brief
33  * A PainterBlendShader represents a shader
34  * for performing blending operations.
35  */
37  {
38  public:
39  /*!
40  * \brief
41  * Enumeration to specify how blend shader operates
42  */
44  {
45  /*!
46  * Indicates blending is via fixed function blending
47  * with single source blending.
48  */
50 
51  /*!
52  * Indicates blending is via fixed function blending
53  * with dual source blending.
54  */
56 
57  /*!
58  * Indicates blending is via framebuffer fetch.
59  */
61 
62  /*!
63  * The number of different types of valid \ref shader_type
64  * values; also used to indicate an invalid value.
65  */
67  };
68 
69  /*!
70  * Ctor for creating a PainterBlendShader which has multiple
71  * sub-shaders. The purpose of sub-shaders is for the case
72  * where multiple shaders have almost same code and those
73  * code differences can be realized by examining a sub-shader
74  * ID.
75  * \param tp the "how" the blend shader operates
76  * \param num_sub_shaders number of sub-shaders
77  */
78  explicit
80  unsigned int num_sub_shaders = 1):
81  PainterShader(num_sub_shaders),
82  m_type(tp)
83  {}
84 
85  /*!
86  * Ctor to create a PainterBlendShader realized as a sub-shader
87  * of an existing PainterBlendShader
88  * \param parent parent PainterBlendShader that has sub-shaders
89  * \param sub_shader which sub-shader of the parent PainterBlendShader
90  */
92  unsigned int sub_shader):
93  PainterShader(parent, sub_shader),
94  m_type(parent->type())
95  {}
96 
97  /*!
98  * Returns how the PainterBlendShader operates.
99  */
100  enum shader_type
101  type(void) const
102  {
103  return m_type;
104  }
105 
106  private:
107  enum shader_type m_type;
108  };
109 
110 /*! @} */
111 }
112 
113 #endif
A PainterBlendShader represents a shader for performing blending operations.
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
A PainterShader encapsulates how to draw or blend.
A wrapper over a pointer to implement reference counting.
file painter_shader.hpp
PainterBlendShader(reference_counted_ptr< PainterBlendShader > parent, unsigned int sub_shader)
uint32_t sub_shader(void) const
PainterBlendShader(enum shader_type tp, unsigned int num_sub_shaders=1)
const reference_counted_ptr< PainterShader > & parent(void) const
shader_type
Enumeration to specify how blend shader operates.
enum shader_type type(void) const