STLL
0.0
Simple Text Layouting Library
|
a class to output layouts using OpenGL More...
Classes | |
class | imageDrawer_c |
helper class used to draw images More... | |
Public Types | |
using | DrawCache_c = typename internal::openGL_internals< V >::DrawCacheInternal_c |
type to keep the caching information for redrawing layouts extra fast. You dont't need to know anything about its internals, just git a pointer to an object of this class to the show function for extra speedup. More... | |
Public Member Functions | |
showOpenGL (uint32_t cStart=256, uint32_t cMax=1024) | |
constructor More... | |
~showOpenGL (void) | |
void | showLayout (const TextLayout_c &l, int sx, int sy, SubPixelArrangement sp, imageDrawer_c *images=nullptr, DrawCache_c *dc=nullptr) |
paint the layout More... | |
void | setupMatrixes (int width, int height) |
helper function to setup the projection matrices for the showLayout function. It will change the viewport and the modelview and projection matrix to an orthogonal projection More... | |
const uint8_t * | getData (void) const |
get a pointer to the texture atlas with all the glyphs More... | |
uint32_t | cacheWidth (void) const |
uint32_t | cacheHeight (void) const |
void | setGamma (uint8_t gamma=22) |
update the gamma value used for output More... | |
void | clear (void) |
clear the glyph cache. This might be useful when you change the fonts that you use for output, or any other reason that will make the cache content useless More... | |
a class to output layouts using OpenGL
To output layouts using this class, create an object of it and then use the showLayout Function to output the layout.
The class contains a glyph cache in form of an texture atlas. Once this atlas if full, things available will be output and then the atlas will be cleared and repopulated for the next section of the output. This will slow down output considerably, so choose the size wisely. The atlas will be destroyed once the class is destroyed. Things to consider:
As OpenGL required function loaders and does not provide a header with all available functionality you will need to include the proper OpenGL before including the header file for this class.
You need to activate the sRGB framebuffer for the framebuffer that this class paints on
For more details look at example 2 Using the XHTML Layouter and the OpenGL output and at the drawing page: OpenGL drawing
V | Major version of OpenGL to use, supported are 1, 2 and 3, use 3 as well for OpenGL 4 |
G | the gamma calculation function, if you use sRGB output... normally you don't need to change this, keep the default |
using STLL::showOpenGL< V, G >::DrawCache_c = typename internal::openGL_internals<V>::DrawCacheInternal_c |
type to keep the caching information for redrawing layouts extra fast. You dont't need to know anything about its internals, just git a pointer to an object of this class to the show function for extra speedup.
|
inline |
constructor
cStart | initial size of the texture cache for the glyphs, the cache will be a square image with the dimensions of cStart |
cMax | once the cache is full its dimensions will be doubled, quadrupling the area until it has reached at least this value (it may get bigger, depending on what values you get by doubling cStart again and again |
|
inline |
|
inline |
|
inline |
|
inline |
clear the glyph cache. This might be useful when you change the fonts that you use for output, or any other reason that will make the cache content useless
|
inline |
get a pointer to the texture atlas with all the glyphs
This is mainly helpful to check how full the texture atlas is
|
inline |
update the gamma value used for output
Default value for the class is 22, which is good for sRGB output, which should be your default for high quality output. See Gamma for details.
gamma | the new gamma value in 1/10th units. Use 22 for sRGB and 10 for normal linear |
|
inline |
helper function to setup the projection matrices for the showLayout function. It will change the viewport and the modelview and projection matrix to an orthogonal projection
|
inline |
paint the layout
l | the layout to draw |
sx | x position on the target surface in 1/64th pixels |
sy | y position on the target surface in 1/64th pixels |
sp | which kind of sub-pixel positioning do you want? |
images | a pointer to an image drawer class that is used to draw the images, when you give a nullptr here, no images will be drawn |
dc | pointer to a cache object that will speed up drawing by reusing OpenGL buffers when nullptr is given here, no caching will be don. If you know you will ouput something many times, give the pointer. You will not loose much speed on the creation of this cache, except for OpenGL 1, so you can simply always specify this and forget about it later on. |