NbtkTextureCache

NbtkTextureCache — A per-process store to cache textures

Synopsis

                    NbtkTextureCache;
NbtkTextureCache*   nbtk_texture_cache_get_default      (void);
ClutterTexture*     nbtk_texture_cache_get_texture      (NbtkTextureCache *self,
                                                         const gchar *path);
ClutterActor*       nbtk_texture_cache_get_actor        (NbtkTextureCache *self,
                                                         const gchar *path);
gint                nbtk_texture_cache_get_size         (NbtkTextureCache *self);
void                nbtk_texture_cache_load_cache       (NbtkTextureCache *self,
                                                         const char *filename);

Object Hierarchy

  GObject
   +----NbtkTextureCache

Description

NbtkTextureCache allows an application to re-use an previously loaded textures.

Details

NbtkTextureCache

typedef struct _NbtkTextureCache NbtkTextureCache;

The contents of this structure are private and should only be accessed through the public API.


nbtk_texture_cache_get_default ()

NbtkTextureCache*   nbtk_texture_cache_get_default      (void);

Returns the default texture cache. This is owned by Nbtk and should not be unreferenced or freed.

Returns :

a NbtkTextureCache

nbtk_texture_cache_get_texture ()

ClutterTexture*     nbtk_texture_cache_get_texture      (NbtkTextureCache *self,
                                                         const gchar *path);

Create a new ClutterTexture with the specified image. Adds the image to the cache if the image had not been previously loaded. Subsequent calls with the same image path will return a new ClutterTexture with the previously loaded image.

self :

A NbtkTextureCache

path :

A path to a image file

Returns :

a newly created ClutterTexture

nbtk_texture_cache_get_actor ()

ClutterActor*       nbtk_texture_cache_get_actor        (NbtkTextureCache *self,
                                                         const gchar *path);

Create a new ClutterSubTexture with the specified image. Adds the image to the cache if the image had not been previously loaded. Subsequent calls with the same image path will return a new ClutterTexture with the previously loaded image.

Use this function if all you need is an actor for drawing.

self :

A NbtkTextureCache

path :

A path to a image file

Returns :

a newly created ClutterTexture

nbtk_texture_cache_get_size ()

gint                nbtk_texture_cache_get_size         (NbtkTextureCache *self);

Returns the number of items in the texture cache

self :

A NbtkTextureCache

Returns :

the current size of the cache

nbtk_texture_cache_load_cache ()

void                nbtk_texture_cache_load_cache       (NbtkTextureCache *self,
                                                         const char *filename);

self :

filename :