2009-09-29 19:08:01 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
2010-11-10 22:00:45 +00:00
|
|
|
/*
|
|
|
|
* st-texture-cache.h: Object for loading and caching images as textures
|
|
|
|
*
|
|
|
|
* Copyright 2009, 2010 Red Hat, Inc.
|
|
|
|
* Copyright 2010, Maxim Ermilov
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 2.1 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
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-10-31 19:39:32 +00:00
|
|
|
#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
|
|
|
|
#error "Only <st/st.h> can be included directly.h"
|
|
|
|
#endif
|
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
#include <gio/gio.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <clutter/clutter.h>
|
2009-09-08 19:47:30 +00:00
|
|
|
|
2010-10-31 19:39:32 +00:00
|
|
|
#include <st/st-types.h>
|
2010-11-02 20:12:56 +00:00
|
|
|
#include <st/st-theme-node.h>
|
2010-10-31 19:39:32 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
#define ST_TYPE_TEXTURE_CACHE (st_texture_cache_get_type ())
|
2015-09-24 14:08:13 +00:00
|
|
|
G_DECLARE_FINAL_TYPE (StTextureCache, st_texture_cache,
|
|
|
|
ST, TEXTURE_CACHE, GObject)
|
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
|
|
|
typedef enum {
|
|
|
|
ST_TEXTURE_CACHE_POLICY_NONE,
|
|
|
|
ST_TEXTURE_CACHE_POLICY_FOREVER
|
|
|
|
} StTextureCachePolicy;
|
2009-09-08 19:47:30 +00:00
|
|
|
|
|
|
|
StTextureCache* st_texture_cache_get_default (void);
|
|
|
|
|
2012-02-14 16:33:10 +00:00
|
|
|
ClutterActor *
|
2012-11-05 22:11:27 +00:00
|
|
|
st_texture_cache_load_sliced_image (StTextureCache *cache,
|
2014-09-19 00:04:00 +00:00
|
|
|
GFile *file,
|
2012-11-05 22:11:27 +00:00
|
|
|
gint grid_width,
|
|
|
|
gint grid_height,
|
2014-03-23 02:20:50 +00:00
|
|
|
gint scale,
|
2012-11-05 22:11:27 +00:00
|
|
|
GFunc load_callback,
|
|
|
|
gpointer user_data);
|
2010-06-08 10:15:16 +00:00
|
|
|
|
2015-01-12 20:21:39 +00:00
|
|
|
ClutterActor *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
|
|
|
GObject *object,
|
|
|
|
const char *property_name);
|
2010-02-09 17:42:07 +00:00
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
|
2010-09-26 15:18:26 +00:00
|
|
|
StThemeNode *theme_node,
|
2010-02-09 17:42:07 +00:00
|
|
|
GIcon *icon,
|
2014-02-16 03:43:35 +00:00
|
|
|
gint size,
|
|
|
|
gint scale);
|
2010-02-09 17:42:07 +00:00
|
|
|
|
2014-09-19 00:04:00 +00:00
|
|
|
ClutterActor *st_texture_cache_load_file_async (StTextureCache *cache,
|
|
|
|
GFile *file,
|
|
|
|
int available_width,
|
|
|
|
int available_height,
|
|
|
|
int scale);
|
2010-02-09 17:42:07 +00:00
|
|
|
|
2014-08-07 18:40:01 +00:00
|
|
|
CoglTexture *st_texture_cache_load_file_to_cogl_texture (StTextureCache *cache,
|
2014-09-19 00:04:00 +00:00
|
|
|
GFile *file,
|
2014-08-07 18:40:01 +00:00
|
|
|
gint scale);
|
2010-02-09 18:24:33 +00:00
|
|
|
|
2010-12-10 22:15:39 +00:00
|
|
|
cairo_surface_t *st_texture_cache_load_file_to_cairo_surface (StTextureCache *cache,
|
2014-09-19 00:04:00 +00:00
|
|
|
GFile *file,
|
2014-03-23 03:29:23 +00:00
|
|
|
gint scale);
|
2010-12-10 22:15:39 +00:00
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
*/
|
2014-08-07 18:40:01 +00:00
|
|
|
typedef CoglTexture * (*StTextureCacheLoader) (StTextureCache *cache, const char *key, void *data, GError **error);
|
|
|
|
|
|
|
|
CoglTexture * st_texture_cache_load (StTextureCache *cache,
|
|
|
|
const char *key,
|
|
|
|
StTextureCachePolicy policy,
|
|
|
|
StTextureCacheLoader load,
|
|
|
|
void *data,
|
|
|
|
GError **error);
|
2010-02-09 21:53:59 +00:00
|
|
|
|
2010-02-09 17:42:07 +00:00
|
|
|
#endif /* __ST_TEXTURE_CACHE_H__ */
|