FastUIDraw
painter_effect.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_effect.hpp
3  * \brief file painter_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 
20 #ifndef FASTUIDRAW_PAINTER_EFFECT_HPP
21 #define FASTUIDRAW_PAINTER_EFFECT_HPP
22 
25 #include <fastuidraw/util/rect.hpp>
26 #include <fastuidraw/image.hpp>
28 
29 namespace fastuidraw
30 {
31 /*!\addtogroup Painter
32  * @{
33  */
34 
35  /*!
36  * A PainterEffectParams represents the parameters for a
37  * \ref PainterEffect. A \ref PainterEffect derived object
38  * will use a \ref PainterEffectParams derived object for
39  * its parameters. A user of \ref PainterEffect will
40  * use the correct \ref PainterEffectParams derived object
41  * when calling \ref PainterEffect::brush(). A \ref
42  * PainterEffectParams is passed by non-constant reference
43  * to \ref PainterEffect::brush(). A typical implementation
44  * of \ref PainterEffect and \ref PainterEffectParams is
45  * that the call to \ref PainterEffect::brush() will modify
46  * the contents of the passed \ref PainterEffectParams
47  * object so that it backs the correct value for the return
48  * value of type \ref PainterData::brush_value. The callers
49  * of \ref PainterEffect::brush() must guarantee that a fixed
50  * \ref PainterEffectParams is not used simutaneosly by
51  * multiple threads.
52  */
54  {
55  public:
56  virtual
58  {}
59  };
60 
61  /*!
62  * \brief
63  * A \ref PainterEffect represents the interface to
64  * define and effect to apply to image data. At its
65  * core, it is made up of a sequence of passes.
66  */
68  public reference_counted<PainterEffect>::concurrent
69  {
70  public:
71  virtual
72  ~PainterEffect()
73  {}
74 
75  /*!
76  * To be implemented by a derived class to return the
77  * number of passes the \ref PainterEffect has.
78  */
79  virtual
80  unsigned int
81  number_passes(void) const = 0;
82 
83  /*!
84  * To be implemented by a derived class to return the
85  * brush made from the passed \ref Image value. The
86  * returned PainterData::brush_value value needs to be
87  * valid until the \ref PainterEffectParams dtor is called
88  * or the next call to brush() {called on from \ref
89  * PainterEffect} passing the same \ref PainterEffectParams.
90  * The passed image is guaranteed to have Image::type() as
91  * value \ref Image::bindless_texture2d or \ref
92  * Image::context_texture2d. The method brush() is to
93  * be thread safe with respect to the \ref PainterEffect
94  * object, but NOT with respect to the \ref PainterEffectParams
95  * object.
96  * \param pass the effect pass
97  * \param image the image to which the effect is applied
98  * \param brush_rect the brush coordinates of the rect
99  * drawn
100  * \param params the parameters of the effect
101  */
102  virtual
104  brush(unsigned pass,
106  const Rect &brush_rect,
107  PainterEffectParams &params) const = 0;
108  };
109 /*! @} */
110 }
111 
112 #endif
A PainterEffect represents the interface to define and effect to apply to image data. At its core, it is made up of a sequence of passes.
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
A wrapper over a pointer to implement reference counting.
file c_array.hpp
A brush_value stores the brush applied; it stores a pointer to a PainterBrushShader together with a P...
Defines default reference counting base classes.
file painter_data.hpp
Class for which copy ctor and assignment operator are private functions.
Definition: util.hpp:505
file image.hpp
file reference_counted.hpp