# CEGUI::RenderCache Class Reference

Class that acts as a cache for images that need to be rendered. More...

List of all members.

## Public Member Functions

| RenderCache ()
| Constructor.
| ~RenderCache ()
| Destructor.
bool | hasCachedImagery () const
| Return whether the cache contains anything to draw.
void | render (const Point &basePos, float baseZ, const Rect &clipper) const
| Send the contents of the cache to the Renderer.
void | clearCachedImagery ()
| Erase any stored image information.
void | cacheImage (const Image &image, const Rect &destArea, float zOffset, const ColourRect &cols, const Rect *clipper=0, bool clipToDisplay=false)
| Add an image to the cache.
void | cacheText (const String &text, const Font *font, TextFormatting format, const Rect &destArea, float zOffset, const ColourRect &cols, const Rect *clipper=0, bool clipToDisplay=false)
| Add a text to the cache.

## Classes

struct | ImageInfo
| internal struct that holds info about a single image to be drawn.
struct | TextInfo
| internal struct that holds info about text to be drawn.

## Detailed Description

Class that acts as a cache for images that need to be rendered.

This is in many ways an optimisation cache, it allows a full image redraw to occur while limiting the amount of information that needs to be re-calculated.

  Basically, unless the actual images (or their size) change, or the colours (or alpha) change then imagery cached in here will suffice for a full redraw. The reasoning behind this is that when some window underneath window 'X' changes, a full image redraw is required by the renderer, however, since window 'X' is unchanged, performing a total recalculation of all imagery is very wasteful, and so we use this cache to limit such waste.

  As another example, when a window is simply moved, there is no need to perform a total imagery recalculation; we can still use the imagery cached here since it is position independant.

## Member Function Documentation

void CEGUI::RenderCache::cacheImage | ( | const Image & | image,
|  | const Rect & | destArea,
|  | float | zOffset,
|  | const ColourRect & | cols,
|  | const Rect * | clipper = `0`,
|  | bool | clipToDisplay = `false`
| ) |

Add an image to the cache.

Parameters:

  | image | Image object to be cached.
  | destArea | Destination area over which the Image object will be rendered. This area should be position independant; so position (0,0) will be to top-left corner of whatever it is you're rendering (like a Window for example).
  | zOffset | Zero based z offset for this image. Allows imagery to be layered.
  | cols | ColourRect object describing the colours to be applied when rendering this image.

Returns:
  Nothing

void CEGUI::RenderCache::cacheText | ( | const String & | text,
|  | const Font * | font,
|  | TextFormatting | format,
|  | const Rect & | destArea,
|  | float | zOffset,
|  | const ColourRect & | cols,
|  | const Rect * | clipper = `0`,
|  | bool | clipToDisplay = `false`
| ) |

Add a text to the cache.

Parameters:

  | text | String object to be cached.
  | font | Font to be used when rendering.
  | format | TextFormatting value specifying the formatting to use when rendering.
  | destArea | Destination area over which the Image object will be rendered. This area should be position independant; so position (0,0) will be to top-left corner of whatever it is you're rendering (like a Window for example).
  | zOffset | Zero based z offset for this image. Allows imagery to be layered.
  | cols | ColourRect object describing the colours to be applied when rendering this image.

Returns:
  Nothing

bool CEGUI::RenderCache::hasCachedImagery | ( |  | ) | const

Return whether the cache contains anything to draw.

Returns:
  - true if the cache contains information about images to be drawn.
  - false if the cache is empty.

void CEGUI::RenderCache::render | ( | const Point & | basePos,
|  | float | baseZ,
|  | const Rect & | clipper
| ) | const

Send the contents of the cache to the Renderer.

Parameters:

  | basePos | Point that describes a screen offset that cached imagery will be rendered relative to.
  | baseZ | Z value that cached imagery will use as a base figure when calculating final z values.
  | clipper | Rect object describing a rect to which imagery will be clipped.

Returns:
  Nothing