#include <canvasresource.h>
Inheritance diagram for KrCanvasResource::
Public Methods | |
KrCanvasResource (const std::string &name, int width, int height, int alphaSupport) | |
A Canvas Resource is NOT created by a dat file, but is created by the client program. More... | |
virtual U32 | Type () |
The type of the resource. ( ex, KYRATAG_SPRITE ). | |
virtual const std::string & | TypeName () |
The name of the type. ( ex, "Sprite" ). | |
virtual KrCanvasResource * | ToCanvasResource () |
Return a pointer if this is a canvas resource. | |
int | Width () |
Width. | |
int | Height () |
Height. | |
KrRGBA * | Pixels () |
Base memory of the image. | |
int | Alpha () |
Returns true if this canvas is constructed to use an alpha channel. | |
void | Refresh () |
Refresh must be called if the CanvasResource changes so that the Canvas objects can be updated. More... | |
virtual void | CacheScale (GlFixed xScale, GlFixed yScale) |
Create a cached resourced. More... | |
virtual bool | IsScaleCached (GlFixed xScale, GlFixed yScale) |
Check the cache for a given scale. | |
virtual void | FreeScaleCache () |
Free up the cache. |
But like all objects in Kyra, there is a resource and instance (Image) component.
|
A Canvas Resource is NOT created by a dat file, but is created by the client program. Once a Canvas Resource is created (and normally placed in the vault) it is used like any other resource, with the exception that a Canvas Resource can be changed at run time. You can reach in, change the pixels in the Resource, and the call Refresh(). After Refresh() is called, the Canvas's using the CanvasResource will update to reflect the new image.
|
|
Create a cached resourced. A resource can be drawn much more quickly if its scaled image is pre-calculated. This generates and scaled version of the resource and stores it for fast drawing. The cached version will always be used before a version generated on the fly. Reimplemented from KrResource. |
|
Refresh must be called if the CanvasResource changes so that the Canvas objects can be updated. This is generally called just after writing to the canvas. |