STLL  0.0
Simple Text Layouting Library
STLL::showSDL< G > Class Template Reference

a class to output layouts using SDL More...

Classes

class  ImageDrawer_c
 class used to encapsulate image drawing More...
 

Public Member Functions

 showSDL (void)
 
void showLayout (const TextLayout_c &l, int sx, int sy, SDL_Surface *s, SubPixelArrangement sp=SUBP_NONE, ImageDrawer_c *images=0)
 display a single layout More...
 
void setGamma (uint8_t gamma=22)
 update the gamma value used for output More...
 
void setClipRect (uint16_t x=0, uint16_t y=0, uint16_t w=std::numeric_limits< uint16_t >::max(), uint16_t h=std::numeric_limits< uint16_t >::max())
 set the clip rectangle More...
 
void trimCache (size_t num)
 trims the font cache down to a maximal number of entries More...
 

Detailed Description

template<class G = internal::Gamma_c<>>
class STLL::showSDL< G >

a class to output layouts using SDL

To output layouts using this class, create an object of it and then use the showLayout Function to output the layout.

Template Parameters
Gthe gamma calculation class to use... normally you don't need to change this, keep the default

Constructor & Destructor Documentation

template<class G = internal::Gamma_c<>>
STLL::showSDL< G >::showSDL ( void  )
inline

Member Function Documentation

template<class G = internal::Gamma_c<>>
void STLL::showSDL< G >::setClipRect ( uint16_t  x = 0,
uint16_t  y = 0,
uint16_t  w = std::numeric_limits<uint16_t>::max(),
uint16_t  h = std::numeric_limits<uint16_t>::max() 
)
inline

set the clip rectangle

Default for the clip rectangle is as big as possible, output is always clipped to the target surface size. Defaults for this function are set in such a way that calling it without arguments clears the clip rectangle

Parameters
xx-coordinate of upper left corner
yy-coordinate of upper left corner
wwidth of the clip rectangle
hheight of clip rectangle
template<class G = internal::Gamma_c<>>
void STLL::showSDL< G >::setGamma ( uint8_t  gamma = 22)
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.

Parameters
gammathe new gamma value in 1/10th units. Use 22 for sRGB and 10 for normal linear
template<class G = internal::Gamma_c<>>
void STLL::showSDL< G >::showLayout ( const TextLayout_c l,
int  sx,
int  sy,
SDL_Surface *  s,
SubPixelArrangement  sp = SUBP_NONE,
ImageDrawer_c images = 0 
)
inline

display a single layout

Parameters
llayout to draw
sxx position on the target surface in 1/64th pixels
syy position on the target surface in 1/64th pixels
starget surface
spwhich kind of sub-pixel positioning do you want?
imagesa pointer to an image drawer class that is used to draw the images, when you give a nullptr here, no images will be drawn
gammathe gamma value of the target surface s in 0.1 increments. Screen surfaces usually have a gamma of 2.2, if you blit to a intermediate surface use a gamma of one, but then you should take care of gamma correction when blitting with alpha values.
Note
the function uses some lookup tables to quickly calculate the gamma data, that table is checked at the beginning of this function and recalculated, when necessary, so try to stick to the same gamma value for long stretches
template<class G = internal::Gamma_c<>>
void STLL::showSDL< G >::trimCache ( size_t  num)
inline

trims the font cache down to a maximal number of entries

the SDL output module keeps a cache of rendered glyphs to speed up the process of outputting layouts. This cache may get too big on memory. To keep things within limits you can call this function to remove entries. If there are more entries in the cache the ones that were used the longest time ago are removed

Parameters
nummaximal number of entries, e.g. 0 completely empties the cache

The documentation for this class was generated from the following file: