|
Packit Service |
2781ba |
/* This file is part of GEGL.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
2781ba |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
2781ba |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
2781ba |
* version 3 of the License, or (at your option) any later version.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
2781ba |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
2781ba |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
2781ba |
* Lesser General Public License for more details.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
2781ba |
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Copyright 2006-2011 Øyvind Kolås <pippin@gimp.org>
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#ifndef __GEGL_TILE_SOURCE_H__
|
|
Packit Service |
2781ba |
#define __GEGL_TILE_SOURCE_H__
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#include <glib-object.h>
|
|
Packit Service |
2781ba |
#include <babl/babl.h>
|
|
Packit Service |
2781ba |
#include "gegl-tile.h"
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/***
|
|
Packit Service |
2781ba |
* GeglTileSource is the very top classes of the tile/buffer handling of Gegl. It defines the generic
|
|
Packit Service |
2781ba |
* command mechanism to interact with a set of tiles. This classe is derived in GeglTileBackend and
|
|
Packit Service |
2781ba |
* GeglTileHandler.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
G_BEGIN_DECLS
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#define GEGL_TYPE_TILE_SOURCE (gegl_tile_source_get_type ())
|
|
Packit Service |
2781ba |
#define GEGL_TILE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_TILE_SOURCE, GeglTileSource))
|
|
Packit Service |
2781ba |
#define GEGL_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_TILE_SOURCE, GeglTileSourceClass))
|
|
Packit Service |
2781ba |
#define GEGL_IS_TILE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_TILE_SOURCE))
|
|
Packit Service |
2781ba |
#define GEGL_IS_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_TILE_SOURCE))
|
|
Packit Service |
2781ba |
#define GEGL_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_TILE_SOURCE, GeglTileSourceClass))
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
typedef gint GeglTileCommand;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
struct _GeglTileSource
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
GObject parent_instance;
|
|
Packit Service |
2781ba |
gpointer (*command) (GeglTileSource *gegl_tile_source,
|
|
Packit Service |
2781ba |
GeglTileCommand command,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z,
|
|
Packit Service |
2781ba |
gpointer data);
|
|
Packit Service |
2781ba |
gpointer padding[4];
|
|
Packit Service |
2781ba |
};
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
struct _GeglTileSourceClass
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
GObjectClass parent_class;
|
|
Packit Service |
2781ba |
gpointer padding[4];
|
|
Packit Service |
2781ba |
};
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
GType gegl_tile_source_get_type (void) G_GNUC_CONST;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/* All commands have the ability to pass commands to all tiles the handlers
|
|
Packit Service |
2781ba |
* add abstraction to the commands the documentaiton given here is valid
|
|
Packit Service |
2781ba |
* when the commands are issued to a full blown GeglBuffer instance.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
enum _GeglTileCommand
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
GEGL_TILE_IDLE = 0,
|
|
Packit Service |
2781ba |
GEGL_TILE_SET,
|
|
Packit Service |
2781ba |
GEGL_TILE_GET,
|
|
Packit Service |
2781ba |
GEGL_TILE_IS_CACHED,
|
|
Packit Service |
2781ba |
GEGL_TILE_EXIST,
|
|
Packit Service |
2781ba |
GEGL_TILE_VOID,
|
|
Packit Service |
2781ba |
GEGL_TILE_FLUSH,
|
|
Packit Service |
2781ba |
GEGL_TILE_REFETCH,
|
|
Packit Service |
2781ba |
GEGL_TILE_REINIT,
|
|
Packit Service |
2781ba |
GEGL_TILE_LAST_COMMAND
|
|
Packit Service |
2781ba |
};
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#ifdef NOT_REALLY_COS_THIS_IS_MACROS
|
|
Packit Service |
2781ba |
/* The functions documented below are actually macros, all using the command vfunc */
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/**
|
|
Packit Service |
2781ba |
* gegl_tile_source_get_tile:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
* @x: x coordinate
|
|
Packit Service |
2781ba |
* @y: y coordinate
|
|
Packit Service |
2781ba |
* @z: tile zoom level
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Get a GeglTile *from the buffer, mipmap tiles for levels z!=0 will be
|
|
Packit Service |
2781ba |
* created on the fly as needed, empty tiles returned are copy on write
|
|
Packit Service |
2781ba |
* and must be locked before written to, and unlocked afterwards.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Returns: the tile at x,y,z or NULL if the tile could not be provided.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
GeglTile *gegl_tile_source_get_tile (GeglTileSource *source,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/**
|
|
Packit Service |
2781ba |
* gegl_tile_source_set_tile:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
* @x: x coordinate
|
|
Packit Service |
2781ba |
* @y: y coordinate
|
|
Packit Service |
2781ba |
* @z: tile zoom level
|
|
Packit Service |
2781ba |
* @tile: a #GeglTile
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Set a GeglTile in *from the buffer.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Returns: the TRUE if the set was successful.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
gboolean gegl_tile_source_set_tile (GeglTileSource *source,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z,
|
|
Packit Service |
2781ba |
GeglTile *tile);
|
|
Packit Service |
2781ba |
/**
|
|
Packit Service |
2781ba |
* gegl_tile_source_is_cached:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
* @x: tile x coordinate
|
|
Packit Service |
2781ba |
* @y: tile y coordinate
|
|
Packit Service |
2781ba |
* @z: tile zoom level
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Checks if a tile is in cache and easily retrieved.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
gboolean gegl_tile_source_is_cached (GeglTileSource *source,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z);
|
|
Packit Service |
2781ba |
/**
|
|
Packit Service |
2781ba |
* gegl_tile_source_exist:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
* @x: x coordinate
|
|
Packit Service |
2781ba |
* @y: y coordinate
|
|
Packit Service |
2781ba |
* @z: tile zoom level
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Checks if a tile exists, this check would not cause the tile to be swapped
|
|
Packit Service |
2781ba |
* in.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
gboolean gegl_tile_source_exist (GeglTileSource *source,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/**
|
|
Packit Service |
2781ba |
* gegl_tile_source_reinit:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Causes all tiles in cache to be refetched.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
void gegl_tile_source_reinit (GeglTileSource *source);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/**
|
|
Packit Service |
2781ba |
* gegl_tile_source_void:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
* @x: x coordinate
|
|
Packit Service |
2781ba |
* @y: y coordinate
|
|
Packit Service |
2781ba |
* @z: tile zoom level
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Causes all references to a tile to be removed.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
void gegl_tile_source_void (GeglTileSource *source,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z);
|
|
Packit Service |
2781ba |
/* INTERNAL API
|
|
Packit Service |
2781ba |
* gegl_tile_source_refetch:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
* @x: x coordinate
|
|
Packit Service |
2781ba |
* @y: y coordinate
|
|
Packit Service |
2781ba |
* @z: tile zoom level
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* A message used internally when watching external buffers to indicate that
|
|
Packit Service |
2781ba |
* a refresh of all data relating to the coordinates needs to be refetched.
|
|
Packit Service |
2781ba |
* Subsequent get calls should get new and valid data for the tile coordinates.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
void gegl_tile_source_refetch (GeglTileSource *source,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint z);
|
|
Packit Service |
2781ba |
/* INTERNAL API
|
|
Packit Service |
2781ba |
* gegl_tile_source_idle:
|
|
Packit Service |
2781ba |
* @source: a GeglTileSource *
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Allow different parts of the buffer to do idle work (saving cached
|
|
Packit Service |
2781ba |
* data lazily, perhaps prefetching in the future?), monitoring for
|
|
Packit Service |
2781ba |
* changes or other tasks. Used internally by the buffer object.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Returns: the TRUE if some work was done.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
gboolean gegl_tile_source_idle (GeglTileSource *source);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#endif
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#define gegl_tile_source_command(source,cmd,x,y,z,tile)\
|
|
Packit Service |
2781ba |
(((GeglTileSource*)(source))->command(source,cmd,x,y,z,tile))
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#define gegl_tile_source_set_tile(source,x,y,z,tile) \
|
|
Packit Service |
2781ba |
(gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_SET,x,y,z,tile))
|
|
Packit Service |
2781ba |
#define gegl_tile_source_get_tile(source,x,y,z) \
|
|
Packit Service |
2781ba |
(GeglTile*)gegl_tile_source_command(source,GEGL_TILE_GET,x,y,z,NULL)
|
|
Packit Service |
2781ba |
#define gegl_tile_source_is_cached(source,x,y,z) \
|
|
Packit Service |
2781ba |
(gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_IS_CACHED,x,y,z,NULL))
|
|
Packit Service |
2781ba |
#define gegl_tile_source_exist(source,x,y,z) \
|
|
Packit Service |
2781ba |
(gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_EXIST,x,y,z,NULL))
|
|
Packit Service |
2781ba |
#define gegl_tile_source_void(source,x,y,z) \
|
|
Packit Service |
2781ba |
gegl_tile_source_command(source,GEGL_TILE_VOID,x,y,z,NULL)
|
|
Packit Service |
2781ba |
#define gegl_tile_source_refetch(source,x,y,z) \
|
|
Packit Service |
2781ba |
gegl_tile_source_command(source,GEGL_TILE_REFETCH,x,y,z,NULL)
|
|
Packit Service |
2781ba |
#define gegl_tile_source_reinit(source) \
|
|
Packit Service |
2781ba |
gegl_tile_source_command(source,GEGL_TILE_REINIT,0,0,0,NULL)
|
|
Packit Service |
2781ba |
#define gegl_tile_source_idle(source) \
|
|
Packit Service |
2781ba |
(gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_IDLE,0,0,0,NULL))
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
G_END_DECLS
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#endif
|