Choosing graphics
to cache
Graphics caching is used primarily with static graphics (like those in a user interface, such as check boxes and radio buttons) that do not frequently change shape, size, rotation, or bundle attributes. In situations where the graphic is being dragged or drawn repeatedly, changing position a lot, frequently refreshed, or frequently recomposited, it might make sense to create a devicedependent cache of that graphic. Other situations where caching a graphic could be appropriate are the following:
- Sprite implementations
- Cursors, rubber bands, and menus
- Icons and other visible controls that move on the desktop and across screens
The choice to cache a graphic or not is an explicit choice because there is no way to detect when a graphic might be redrawn frequently enough, or be the right size or shape to warrant automatic caching. The cache storage can be large if the graphic is large, and some graphics include a lot of extra pixels that get cached although they are not actually drawn. For example, a cached diagonal line renders more slowly because it is stored as the diagonal line plus its bounding rectangle. The pixels that make up the interior of the bounding rectangle are stored and cached, but get ignored when the diagonal line is drawn.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker