FastUIDraw
glyph_render_data.hpp
Go to the documentation of this file.
1 /*!
2  * \file glyph_render_data.hpp
3  * \brief file glyph_render_data.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_GLYPH_RENDER_DATA_HPP
21 #define FASTUIDRAW_GLYPH_RENDER_DATA_HPP
22 
23 #include <stdint.h>
24 
25 #include <fastuidraw/util/util.hpp>
26 #include <fastuidraw/util/vecN.hpp>
32 
33 namespace fastuidraw
34 {
35 /*!\addtogroup Glyph
36  * @{
37  */
38 
39  /*!
40  * A GlyphRenderInfo provides rendering const information
41  * of a \ref Glyph.
42  */
44  {
45  public:
46  GlyphRenderCostInfo(void):
47  m_label(""),
48  m_value(0.0f)
49  {}
50 
51  /*!
52  * Label of the value; the string is NOT owned by the
53  * GlyphRenderInfo (it is expected that the c_string
54  * is build-time constant string).
55  */
57 
58  /*!
59  * Value of the information element.
60  */
61  float m_value;
62  };
63 
64  /*!
65  * \brief
66  * GlyphRenderData provides an interface to specify
67  * data used for rendering glyphs and to pack that data
68  * onto a GlyphAtlas.
69  */
71  {
72  public:
73  virtual
75  {}
76 
77  /*!
78  * To be implemented by a derived class to return
79  * the strings used in \ref GlyphRenderCostInfo::m_value;
80  * The pointer behind each of the string in the return
81  * \ref c_array returned are required to stay valid even
82  * after the GlyphRenderData is deleted. The expectation
83  * is that the returned \ref c_array is just c_array
84  * wrapping over a static constant array of string.
85  */
86  virtual
88  render_info_labels(void) const = 0;
89 
90  /*!
91  * To be implemented by a derived class to upload data to a
92  * GlyphAtlas.
93  * \param atlas_proxy GlyphAtlasProxy to which to upload data
94  * \param attributes (output) glyph attributes (see Glyph::attributes())
95  * \param render_costs (output) an array of size render_info().size()
96  * to which to write the render costs for each
97  * entry in render_info().
98  */
99  virtual
101  upload_to_atlas(GlyphAtlasProxy &atlas_proxy,
102  GlyphAttribute::Array &attributes,
103  c_array<float> render_costs) const = 0;
104 
105  };
106 /*! @} */
107 }
108 
109 #endif
Represents an opaque array of GlyphAttribute values.
GlyphRenderData provides an interface to specify data used for rendering glyphs and to pack that data...
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
return_code
Enumeration for simple return codes for functions for success or failure.
Definition: util.hpp:142
An GlyphAtlasProxy is a proxy for a GlyphAtlas; one can allocate through it. Internally it tracks all...
file c_array.hpp
file glyph_atlas.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 glyph_attribute.hpp
file glyph_renderer.hpp
file vecN.hpp
file glyph_atlas_proxy.hpp
const char * c_string
Conveniant typedef for C-style strings.
Definition: util.hpp:135
Class for which copy ctor and assignment operator are private functions.
Definition: util.hpp:505