FastUIDraw
examples.doxy
1 /*!
2  \page ex_framework Example FrameWork
3  \brief Framework used by examples to bring up a window and GL context via SDL2.
4 
5  The example framework's sole purpose is to impement via SDL2,
6  the boiler plate code to:
7  - Create a window
8  - Create a GL context and make it current
9  - Provide an interface to handle events
10  - Provide an interface to draw a frame
11  - at dtor, destroy GL context and window
12 
13  FastUIDraw is not tied to a particular windowing system at all. FastUIDraw
14  can work with other frameworks (for example Qt) that handle window creation
15  and event handling.
16 
17  The interface is defined by:
18  \snippet demo_framework.hpp ExampleFramework
19 
20  The implementation is given by:
21  \snippet demo_framework.cpp ExampleFramework
22 */
23 
24 /*!
25  \page ex_initialization Example Initialization
26  \brief Example code that shows how to create a Painter and to use the GL backend.
27 
28  The \ref ex_initialization builds from \ref ex_framework to demonstrate
29  how to initialize FastUIDraw's GL (or GLES) backend and to create a
30  fastuidraw::Painter object.
31 
32  The interface is defined by:
33  \snippet initialization.hpp ExampleInitialization
34 
35  The implementation is given by:
36  \snippet initialization.cpp ExampleInitialization
37 
38  An example make file using pkg-config to build this example is given by:
39  \verbinclude Makefile
40  */
41 
42 /*!
43  \page ex_gradient Example Gradient
44  \brief Simple example showing how to use \ref fastuidraw::PainterBrush to render gradients.
45 
46  The \ref ex_gradient builds from \ref ex_initialization to demonstrate
47  how to use \ref fastuidraw::PainterBrush to render gradients.
48 
49  The implementation is given by:
50  \snippet example_gradient.cpp ExampleGradient
51 */
52 
53 /*!
54  \page ex_image Example Image
55  \brief Simple example showing how to use \ref fastuidraw::PainterBrush to render an image.
56 
57  The \ref ex_image builds from \ref ex_initialization to demonstrate
58  how to use \ref fastuidraw::PainterBrush to render an image.
59 
60  A fastuidraw::Image requires a pixel data specified by a class derived from
61  \ref fastuidraw::ImageSourceBase to be realized. In this example we also
62  implement an example of \ref fastuidraw::ImageSourceBase that relies on SDL2_image
63  to load the image data.
64 
65  The implementation of drawing an is given by:
66  \snippet example_image.cpp ExampleImage
67 
68  The interface for loading an image is given by:
69  \snippet image_loader.hpp ExampleImage
70 
71  The implementation for loading an image is given by:
72  \snippet image_loader.cpp ExampleImage
73 */
74 
75 /*!
76  \page ex_text Example Text
77  \brief Simple example showing how to use \ref fastuidraw::GlyphSequence to render text.
78 
79  The \ref ex_text builds from \ref ex_initialization to demonstrate
80  how to construct and use \ref fastuidraw::GlyphSequence to render
81  text with \ref fastuidraw::Painter.
82 
83  The implementation is given by:
84  \snippet example_text.cpp ExampleText
85 */
86 
87 /*!
88  \page ex_path Example Path
89  \brief Simple example showing how to use \ref fastuidraw::Path to stroke and fill paths.
90 
91  The \ref ex_path builds from \ref ex_initialization to demonstrate
92  how to construct and use \ref fastuidraw::Path to stroke and fills
93  paths with \ref fastuidraw::Painter.
94 
95  The implementation is given by:
96  \snippet example_path.cpp ExamplePath
97 */
98 
99 /*!
100  \page ex_path2 Example Path 2
101  \brief
102  Simple example showing how to operator<< overloads to construct a complicated path
103  and to fill it with a custom fill rule.
104 
105  The \ref ex_path2 builds from \ref ex_initialization to demonstrate
106  how to construct a \ref fastuidraw::Path using operator<< overloads
107  and to fill it with a custom fill rule.
108 
109  The implementation is given by:
110  \snippet example_path2.cpp ExamplePath2
111 */
112 
113 /*!
114  \page ex_custom_brush Example Custom Brush
115  \brief
116  Example on how to create a custom-brush that builds from teh standard brush.
117 
118  The \ref ex_custom_brush builds from \ref ex_initialization to demonstrate
119  how to create a custom-brush that builds from the standard brush. The
120  example custom is implemented by modifying in the fragment shader the brush
121  position fed to the standard brush.
122 
123  A custom brush is defined essentially by two elements: a shader and data to
124  feed the shader. The shader is represented by \ref fastuidraw::PainterBrushShader
125  and the data to feed it is represented by \ref fastuidraw::PainterBrushShaderData.
126  The data represents the small amount of data that the shader unpacks from the
127  data store.
128 
129  Using the symbols documented in \ref GLSLBuiltInShaders, the implementation
130  of the data used by the custom brush and the shader
131  for it is given by \snippet example_custom_brush.cpp ExampleCustomBrushDefining
132 
133  The implementation of using the custom brush is given by
134  \snippet example_custom_brush.cpp ExampleCustomBrushUsing
135 */
136 
137 /*!
138  * \page ex_packed_value Example Packed Value
139  * \brief
140  * Example of using \ref fastuidraw::PainterPackedValue and using the
141  * coordinate transformation interface of \ref fastuidraw::Painter
142  *
143  * The \ref ex_packed_value builds from \ref ex_initialization to demonstrate
144  * how to use and create \ref fastuidraw::PainterPackedValue objects
145  * to allow FastUIDraw to resuse \ref fastuidraw::PainterBrushShaderData
146  * that is common across many calls to \ref fastuidraw::Painter draw methods.
147  * In addition, it also provides an example of using some the coordinate
148  * transformation methods of \ref fastuidraw::Painter along with saving and
149  * restoring its state via \ref fastuidraw::Painter::save() and \ref
150  * fastuidraw::Painter::restore().
151  *
152  * The code is given by
153  * \snippet example_packed_value.cpp ExamplePackedValue
154  *
155  */
156 
157 /*!
158  * \page ex_custom_stroking_shader Example Custom Stroking Shader
159  * \brief
160  * Example of using the shader-chaining interface to create a
161  * custom strok shader that applies an animated wave effect
162  * entirely within the shader.
163  *
164  * Using the symbols documented in \ref GLSLBuiltInShaders, the
165  * implementation of the custom shader and data is given by
166  * \snippet example_custom_path_shading.cpp ExampleCustomPathShaderDefining
167  *
168  * The implementation of using the custom stroking is given by
169  * \snippet example_custom_path_shading.cpp ExampleCustomPathShading
170  */