2009-09-29 19:08:01 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
2010-02-09 17:42:07 +00:00
|
|
|
#ifndef __ST_TEXTURE_CACHE_H__
|
|
|
|
#define __ST_TEXTURE_CACHE_H__
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
#include <gio/gio.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
#include <clutter/clutter.h>
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
#define ST_TYPE_TEXTURE_CACHE (st_texture_cache_get_type ())
|
|
|
|
#define ST_TEXTURE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ST_TYPE_TEXTURE_CACHE, StTextureCache))
|
|
|
|
#define ST_TEXTURE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ST_TYPE_TEXTURE_CACHE, StTextureCacheClass))
|
|
|
|
#define ST_IS_TEXTURE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ST_TYPE_TEXTURE_CACHE))
|
|
|
|
#define ST_IS_TEXTURE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ST_TYPE_TEXTURE_CACHE))
|
|
|
|
#define ST_TEXTURE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ST_TYPE_TEXTURE_CACHE, StTextureCacheClass))
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
typedef struct _StTextureCache StTextureCache;
|
|
|
|
typedef struct _StTextureCacheClass StTextureCacheClass;
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
typedef struct _StTextureCachePrivate StTextureCachePrivate;
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
struct _StTextureCache
|
|
|
|
{
|
|
|
|
GObject parent;
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
StTextureCachePrivate *priv;
|
|
|
|
};
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
struct _StTextureCacheClass
|
|
|
|
{
|
2009-09-08 19:47:30 +00:00
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
};
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
typedef enum {
|
|
|
|
ST_TEXTURE_CACHE_POLICY_NONE,
|
|
|
|
ST_TEXTURE_CACHE_POLICY_FOREVER
|
|
|
|
} StTextureCachePolicy;
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
GType st_texture_cache_get_type (void) G_GNUC_CONST;
|
2009-09-08 19:47:30 +00:00
|
|
|
|
|
|
|
StTextureCache* st_texture_cache_get_default (void);
|
|
|
|
|
2010-06-08 10:15:16 +00:00
|
|
|
ClutterGroup *
|
|
|
|
st_texture_cache_load_sliced_image (StTextureCache *cache,
|
|
|
|
const gchar *path,
|
|
|
|
gint grid_width,
|
|
|
|
gint grid_height);
|
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
ClutterActor *st_texture_cache_bind_pixbuf_property (StTextureCache *cache,
|
|
|
|
GObject *object,
|
|
|
|
const char *property_name);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_icon_name (StTextureCache *cache,
|
|
|
|
const char *name,
|
|
|
|
gint size);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
|
|
|
|
GIcon *icon,
|
|
|
|
gint size);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_thumbnail (StTextureCache *cache,
|
|
|
|
int size,
|
|
|
|
const char *uri,
|
|
|
|
const char *mimetype);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_recent_thumbnail (StTextureCache *cache,
|
|
|
|
int size,
|
|
|
|
GtkRecentInfo *info);
|
|
|
|
|
|
|
|
void st_texture_cache_evict_thumbnail (StTextureCache *cache,
|
|
|
|
const char *uri);
|
|
|
|
|
|
|
|
void st_texture_cache_evict_recent_thumbnail (StTextureCache *cache,
|
|
|
|
GtkRecentInfo *info);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_uri_async (StTextureCache *cache,
|
2010-09-15 00:56:34 +00:00
|
|
|
const gchar *uri,
|
2010-02-09 17:42:07 +00:00
|
|
|
int available_width,
|
|
|
|
int available_height);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_uri_sync (StTextureCache *cache,
|
|
|
|
StTextureCachePolicy policy,
|
2010-09-15 00:56:34 +00:00
|
|
|
const gchar *uri,
|
2010-02-09 17:42:07 +00:00
|
|
|
int available_width,
|
|
|
|
int available_height,
|
|
|
|
GError **error);
|
|
|
|
|
2010-02-09 18:24:33 +00:00
|
|
|
CoglHandle st_texture_cache_load_file_to_cogl_texture (StTextureCache *cache,
|
|
|
|
const gchar *file_path);
|
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
ClutterActor *st_texture_cache_load_file_simple (StTextureCache *cache,
|
|
|
|
const gchar *file_path);
|
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_from_data (StTextureCache *cache,
|
|
|
|
const guchar *data,
|
|
|
|
gsize len,
|
|
|
|
int size,
|
|
|
|
GError **error);
|
|
|
|
ClutterActor *st_texture_cache_load_from_raw (StTextureCache *cache,
|
|
|
|
const guchar *data,
|
|
|
|
gsize len,
|
|
|
|
gboolean has_alpha,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int rowstride,
|
|
|
|
int size,
|
|
|
|
GError **error);
|
|
|
|
|
2010-09-02 00:48:11 +00:00
|
|
|
/**
|
|
|
|
* StTextureCacheLoader: (skip)
|
|
|
|
* @cache: a #StTextureCache
|
|
|
|
* @key: Unique identifier for this texture
|
|
|
|
* @data: Callback user data
|
|
|
|
* @error: A #GError
|
|
|
|
*
|
|
|
|
* See st_texture_cache_load(). Implementations should return a
|
|
|
|
* texture handle for the given key, or set @error.
|
|
|
|
*
|
|
|
|
*/
|
2010-02-09 21:53:59 +00:00
|
|
|
typedef CoglHandle (*StTextureCacheLoader) (StTextureCache *cache, const char *key, void *data, GError **error);
|
|
|
|
|
|
|
|
CoglHandle st_texture_cache_load (StTextureCache *cache,
|
|
|
|
const char *key,
|
|
|
|
StTextureCachePolicy policy,
|
|
|
|
StTextureCacheLoader load,
|
|
|
|
void *data,
|
|
|
|
GError **error);
|
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
gboolean st_texture_cache_pixbuf_equal (StTextureCache *cache, GdkPixbuf *a, GdkPixbuf *b);
|
|
|
|
|
|
|
|
#endif /* __ST_TEXTURE_CACHE_H__ */
|