1 /* This file is part of GEGL. 2 * 3 * This library is free software; you can redistribute it and/or 4 * modify it under the terms of the GNU Lesser General Public 5 * License as published by the Free Software Foundation; either 6 * version 3 of the License, or (at your option) any later version. 7 * 8 * This library is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public 14 * License along with GEGL; if not, see <https://www.gnu.org/licenses/>. 15 * 16 * Copyright 2006, 2007 Øyvind Kolås <pippin@gimp.org> 17 */ 18 19 #ifndef __GEGL_TILE_BACKEND_H__ 20 #define __GEGL_TILE_BACKEND_H__ 21 22 #include "gegl-tile-source.h" 23 24 /*** 25 * GeglTileBackend is a simple basic GeglTileSource that provide and store tiles. This classe is 26 * generic and is specialized in subclasses for different kind of storage. 27 */ 28 29 G_BEGIN_DECLS 30 31 #define GEGL_TYPE_TILE_BACKEND (gegl_tile_backend_get_type ()) 32 #define GEGL_TILE_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_TILE_BACKEND, GeglTileBackend)) 33 #define GEGL_TILE_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_TILE_BACKEND, GeglTileBackendClass)) 34 #define GEGL_IS_TILE_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_TILE_BACKEND)) 35 #define GEGL_IS_TILE_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_TILE_BACKEND)) 36 #define GEGL_TILE_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_TILE_BACKEND, GeglTileBackendClass)) 37 38 typedef struct _GeglTileBackendClass GeglTileBackendClass; 39 typedef struct _GeglTileBackendPrivate GeglTileBackendPrivate; 40 41 struct _GeglTileBackend 42 { 43 GeglTileSource parent_instance; 44 GeglTileBackendPrivate *priv; 45 }; 46 47 struct _GeglTileBackendClass 48 { 49 GeglTileSourceClass parent_class; 50 gpointer padding[4]; 51 }; 52 53 /** 54 * gegl_tile_backend_get_tile_size: 55 * @tile_backend: a #GeglTileBackend 56 * 57 * Return value: the size in bytes for a tile from this backend 58 */ 59 gint gegl_tile_backend_get_tile_size (GeglTileBackend *tile_backend); 60 61 /** 62 * gegl_tile_backend_get_tile_width: 63 * @tile_backend: a #GeglTileBackend 64 * 65 * Return value: the width of tile from this backend 66 */ 67 gint gegl_tile_backend_get_tile_width (GeglTileBackend *tile_backend); 68 69 /** 70 * gegl_tile_backend_get_tile_height: 71 * @tile_backend: a #GeglTileBackend 72 * 73 * Return value: the height of tile from this backend 74 */ 75 gint gegl_tile_backend_get_tile_height (GeglTileBackend *tile_backend); 76 77 /** 78 * gegl_tile_backend_get_format: (skip) 79 * @tile_backend: a #GeglTileBackend 80 * 81 * Gets pixel format of @tile_backend 82 * 83 * Return value: (transfer none): the #Babl format 84 */ 85 const Babl *gegl_tile_backend_get_format (GeglTileBackend *tile_backend); 86 87 /** 88 * gegl_tile_backend_peek_storage: 89 * @tile_backend: a #GeglTileBackend 90 * 91 * Gets a pointer to the GeglTileStorage that uses the backend 92 * 93 * Return value: (transfer none): the #GeglTileStorage 94 */ 95 GeglTileSource *gegl_tile_backend_peek_storage (GeglTileBackend *tile_backend); 96 97 /** 98 * gegl_tile_backend_set_extent: 99 * @tile_backend: a #GeglTileBackend 100 * @rectangle: the new extent 101 * 102 * Specify the extent of the backend, can be used to pre-prime the 103 * backend with the width/height information when constructing proxy 104 * GeglBuffers to interact with other systems 105 */ 106 void gegl_tile_backend_set_extent (GeglTileBackend *tile_backend, 107 const GeglRectangle *rectangle); 108 109 110 /** 111 * gegl_tile_backend_get_extent: (skip) 112 * @tile_backend: a #GeglTileBackend 113 */ 114 GeglRectangle gegl_tile_backend_get_extent (GeglTileBackend *tile_backend); 115 116 /** 117 * gegl_tile_backend_set_flush_on_destroy: 118 * @tile_backend: a #GeglTileBackend 119 * @flush_on_destroy: true if the backend needs to be flushed 120 * 121 * Control whether cached data will be written to the backend before it 122 * is destroyed. If false unwritten data will be discarded. 123 */ 124 void gegl_tile_backend_set_flush_on_destroy (GeglTileBackend *tile_backend, 125 gboolean flush_on_destroy); 126 127 gboolean gegl_tile_backend_get_flush_on_destroy (GeglTileBackend *tile_backend); 128 129 /** 130 * gegl_tile_backend_command: 131 * @backend: a #GeglTileBackend 132 * @command: the tile command 133 * @x: x coordinate 134 * @y: y coordinate 135 * @z: tile zoom level 136 * @data: user data 137 * 138 * The default tile-backend command handler. Tile backends should forward 139 * commands they don't handle themselves to this function. 140 * 141 * Returns: Command result. 142 */ 143 gpointer gegl_tile_backend_command (GeglTileBackend *backend, 144 GeglTileCommand command, 145 gint x, 146 gint y, 147 gint z, 148 gpointer data); 149 150 GType gegl_tile_backend_get_type (void) G_GNUC_CONST; 151 152 /** 153 * gegl_tile_backend_unlink_swap: 154 * @path: the path where the gegl tile backend has swapped. 155 * 156 * Delete a swap file from disk. This must be used by tile backends which may 157 * swap to disk under certain circonstances. 158 * 159 * For safety, this function will check that the swap file is in the swap 160 * directory before deletion but it won't perform any other check. 161 * 162 * Deprecated: 0.4.14: This function is not compatible with a dynamically- 163 * changing swap path. Use gegl_buffer_swap_remove_file() instead. 164 */ 165 G_DEPRECATED_FOR (gegl_buffer_swap_remove_file) 166 void gegl_tile_backend_unlink_swap (gchar *path); 167 168 G_END_DECLS 169 170 #endif 171