2009-09-29 15:08:01 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
2010-11-10 17:00:45 -05: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 12:42:07 -05:00
|
|
|
#ifndef __ST_TEXTURE_CACHE_H__
|
|
|
|
#define __ST_TEXTURE_CACHE_H__
|
2009-09-08 15:47:30 -04:00
|
|
|
|
2010-10-31 15:39:32 -04:00
|
|
|
#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
|
|
|
|
#error "Only <st/st.h> can be included directly.h"
|
|
|
|
#endif
|
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
#include <gio/gio.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <clutter/clutter.h>
|
2009-09-08 15:47:30 -04:00
|
|
|
|
2010-10-31 15:39:32 -04:00
|
|
|
#include <st/st-types.h>
|
2010-11-02 16:12:56 -04:00
|
|
|
#include <st/st-theme-node.h>
|
2019-03-08 08:06:38 -05:00
|
|
|
#include <st/st-widget.h>
|
2010-10-31 15:39:32 -04:00
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
#define ST_TYPE_TEXTURE_CACHE (st_texture_cache_get_type ())
|
2015-09-24 10:08:13 -04:00
|
|
|
G_DECLARE_FINAL_TYPE (StTextureCache, st_texture_cache,
|
|
|
|
ST, TEXTURE_CACHE, GObject)
|
2009-09-08 15:47:30 -04:00
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
typedef struct _StTextureCachePrivate StTextureCachePrivate;
|
2009-09-08 15:47:30 -04:00
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
struct _StTextureCache
|
|
|
|
{
|
|
|
|
GObject parent;
|
2009-09-08 15:47:30 -04:00
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
StTextureCachePrivate *priv;
|
|
|
|
};
|
2009-09-08 15:47:30 -04:00
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
typedef enum {
|
|
|
|
ST_TEXTURE_CACHE_POLICY_NONE,
|
|
|
|
ST_TEXTURE_CACHE_POLICY_FOREVER
|
|
|
|
} StTextureCachePolicy;
|
2009-09-08 15:47:30 -04:00
|
|
|
|
|
|
|
StTextureCache* st_texture_cache_get_default (void);
|
|
|
|
|
2012-02-14 11:33:10 -05:00
|
|
|
ClutterActor *
|
2012-11-05 17:11:27 -05:00
|
|
|
st_texture_cache_load_sliced_image (StTextureCache *cache,
|
2014-09-18 20:04:00 -04:00
|
|
|
GFile *file,
|
2012-11-05 17:11:27 -05:00
|
|
|
gint grid_width,
|
|
|
|
gint grid_height,
|
2017-05-11 00:25:00 -04:00
|
|
|
gint paint_scale,
|
|
|
|
gfloat resource_scale,
|
2012-11-05 17:11:27 -05:00
|
|
|
GFunc load_callback,
|
|
|
|
gpointer user_data);
|
2010-06-08 06:15:16 -04:00
|
|
|
|
2020-06-30 10:48:16 -04:00
|
|
|
GIcon *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
|
|
|
GObject *object,
|
|
|
|
const char *property_name);
|
2010-02-09 12:42:07 -05:00
|
|
|
|
|
|
|
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
|
2010-09-26 11:18:26 -04:00
|
|
|
StThemeNode *theme_node,
|
2010-02-09 12:42:07 -05:00
|
|
|
GIcon *icon,
|
2014-02-15 22:43:35 -05:00
|
|
|
gint size,
|
2017-05-11 00:25:00 -04:00
|
|
|
gint paint_scale,
|
|
|
|
gfloat resource_scale);
|
2010-02-09 12:42:07 -05:00
|
|
|
|
2014-09-18 20:04:00 -04:00
|
|
|
ClutterActor *st_texture_cache_load_file_async (StTextureCache *cache,
|
|
|
|
GFile *file,
|
|
|
|
int available_width,
|
|
|
|
int available_height,
|
2017-05-11 00:25:00 -04:00
|
|
|
int paint_scale,
|
|
|
|
gfloat resource_scale);
|
2010-02-09 12:42:07 -05:00
|
|
|
|
2014-08-07 14:40:01 -04:00
|
|
|
CoglTexture *st_texture_cache_load_file_to_cogl_texture (StTextureCache *cache,
|
2014-09-18 20:04:00 -04:00
|
|
|
GFile *file,
|
2017-05-11 00:25:00 -04:00
|
|
|
gint paint_scale,
|
|
|
|
gfloat resource_scale);
|
2010-02-09 13:24:33 -05:00
|
|
|
|
2010-12-10 17:15:39 -05:00
|
|
|
cairo_surface_t *st_texture_cache_load_file_to_cairo_surface (StTextureCache *cache,
|
2014-09-18 20:04:00 -04:00
|
|
|
GFile *file,
|
2017-05-11 00:25:00 -04:00
|
|
|
gint paint_scale,
|
|
|
|
gfloat resource_scale);
|
2010-12-10 17:15:39 -05:00
|
|
|
|
2010-09-01 20:48:11 -04: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 14:40:01 -04: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 16:53:59 -05:00
|
|
|
|
2019-08-01 19:58:20 -04:00
|
|
|
gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache);
|
|
|
|
|
2010-02-09 12:42:07 -05:00
|
|
|
#endif /* __ST_TEXTURE_CACHE_H__ */
|