FastUIDraw
glyph_renderer.hpp
Go to the documentation of this file.
1 /*!
2  * \file glyph_renderer.hpp
3  * \brief file glyph_renderer.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_RENDERER_HPP
21 #define FASTUIDRAW_GLYPH_RENDERER_HPP
22 
23 namespace fastuidraw
24 {
25 /*!\addtogroup Glyph
26  * @{
27  */
28 
29  /*!
30  * \brief
31  * Provides an enumeration of the rendering data for
32  * a glyph.
33  */
35  {
36  /*!
37  * Glyph is a coverage glyph. Glyph is not
38  * scalable.
39  */
41 
42  /*!
43  * Glyph is a distance field glyph. Glyph
44  * is scalable.
45  */
47 
48  /*!
49  * Glyph is a Restricted rays glyph, generated
50  * from a GlyphRenderDataRestrictedRays. Glyph
51  * is scalable.
52  */
54 
55  /*!
56  * Glyph is a Banded rays glyph, generated
57  * from a GlyphRenderDataBandedRays. Glyph
58  * is scalable.
59  */
61 
62  /*!
63  * Tag to indicate invalid glyph type; the value is much
64  * larger than the last glyph type to allow for later ABI
65  * compatibility as more glyph types are added. Value is
66  * also to indicate to Painter::draw_glyphs() to draw glyphs
67  * adaptively (i.e. choose a renderer based from the size
68  * of the rendered glyphs).
69  */
70  invalid_glyph = 0x1000,
71 
72  /*!
73  * Tag to indicate invalid glyph type; the value is much
74  * larger than the last glyph type to allow for later ABI
75  * compatibility as more glyph types are added. Value is
76  * also to indicate to Painter::draw_glyphs() to draw glyphs
77  * adaptively (i.e. choose a renderer based from the size
78  * of the rendered glyphs).
79  */
81  };
82 
83  /*!
84  * \brief
85  * Specifies how to render a glyph
86  */
88  {
89  public:
90  /*!
91  * Ctor. Initializes m_type as coverage_glyph
92  * \param pixel_size value to which to initialize m_pixel_size
93  */
94  explicit
95  GlyphRenderer(int pixel_size);
96 
97  /*!
98  * Ctor.
99  * \param t value to which to initialize \ref m_type, value must be so
100  * that scalable() returns true
101  */
102  explicit
103  GlyphRenderer(enum glyph_type t);
104 
105  /*!
106  * Ctor. Initializes \ref m_type to \ref invalid_glyph (which is the
107  * same value as \ref adaptive_rendering).
108  */
109  GlyphRenderer(void);
110 
111  /*!
112  * How to render glyph.
113  */
115 
116  /*!
117  * Pixel size observed only if scalable()
118  * when passed m_type returns false.
119  */
121 
122  /*!
123  * Returns true if and only if the data for a glyph type
124  * is scalable, for example \ref distance_field_glyph and
125  * \ref restricted_rays_glyph are scalable
126  */
127  static
128  bool
129  scalable(enum glyph_type tp);
130 
131  /*!
132  * Comparison operator.
133  * \param rhs value to which to compare against
134  */
135  bool
136  operator<(const GlyphRenderer &rhs) const;
137 
138  /*!
139  * Comparison operator.
140  * \param rhs value to which to compare against
141  */
142  bool
143  operator==(const GlyphRenderer &rhs) const;
144 
145  /*!
146  * Returns true if and only if this GlyphRenderer is valid
147  * to specify how to render a glyph.
148  */
149  bool
150  valid(void) const;
151  };
152 /*! @} */
153 }
154 
155 #endif
static bool scalable(enum glyph_type tp)
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
bool valid(void) const
glyph_type
Provides an enumeration of the rendering data for a glyph.
bool operator<(const GlyphRenderer &rhs) const
bool operator==(const GlyphRenderer &rhs) const
Specifies how to render a glyph.