2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1998-01-22 07:02:57 +00:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 05:44:11 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1998-01-22 07:02:57 +00:00
|
|
|
*/
|
2000-12-29 15:22:01 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
#ifndef __TILE_MANAGER_H__
|
|
|
|
#define __TILE_MANAGER_H__
|
|
|
|
|
2003-11-16 17:51:36 +00:00
|
|
|
struct _PixelDataHandle
|
2001-11-29 01:06:44 +00:00
|
|
|
{
|
2005-05-08 20:24:54 +00:00
|
|
|
guchar *data;
|
|
|
|
gint width;
|
2006-07-06 10:58:44 +00:00
|
|
|
gint height;
|
2005-05-08 20:24:54 +00:00
|
|
|
gint stride;
|
2006-07-06 10:58:44 +00:00
|
|
|
gint bpp;
|
2001-11-29 01:06:44 +00:00
|
|
|
};
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2006-07-06 12:27:32 +00:00
|
|
|
/* Creates a new tile manager with the specified width for the
|
|
|
|
* toplevel. The toplevel size is used to compute the number of
|
|
|
|
* levels and their size. Each level is 1/2 the width and height of
|
1997-11-24 22:05:25 +00:00
|
|
|
* the level above it.
|
2001-05-15 11:25:25 +00:00
|
|
|
*
|
2006-07-06 12:27:32 +00:00
|
|
|
* The toplevel is level 0. The smallest level in the hierarchy
|
|
|
|
* is "nlevels - 1". That level will be smaller than TILE_WIDTH x
|
|
|
|
* TILE_HEIGHT
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2006-07-06 12:27:32 +00:00
|
|
|
TileManager * tile_manager_new (gint width,
|
|
|
|
gint height,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint bpp);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2003-05-26 17:02:06 +00:00
|
|
|
/* Ref/Unref a tile manager.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2003-05-26 17:02:06 +00:00
|
|
|
TileManager * tile_manager_ref (TileManager *tm);
|
|
|
|
void tile_manager_unref (TileManager *tm);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2006-07-06 12:27:32 +00:00
|
|
|
/* Set the validate procedure for the tile manager. The validate
|
|
|
|
* procedure is called when an invalid tile is referenced. If the
|
|
|
|
* procedure is NULL, then the tile is set to valid and its memory is
|
|
|
|
* allocated, but not initialized.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_manager_set_validate_proc (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
TileValidateProc proc);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2003-11-16 17:51:36 +00:00
|
|
|
/* Get a specified tile from a tile manager.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2000-12-29 15:22:01 +00:00
|
|
|
Tile * tile_manager_get_tile (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint xpixel,
|
|
|
|
gint ypixel,
|
|
|
|
gint wantread,
|
|
|
|
gint wantwrite);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
/* Get a specified tile from a tile manager.
|
|
|
|
*/
|
2000-12-29 15:22:01 +00:00
|
|
|
Tile * tile_manager_get (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint tile_num,
|
|
|
|
gint wantread,
|
|
|
|
gint wantwrite);
|
1998-07-10 02:43:12 +00:00
|
|
|
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_manager_map_tile (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint xpixel,
|
|
|
|
gint ypixel,
|
|
|
|
Tile *srctile);
|
1998-07-10 02:43:12 +00:00
|
|
|
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_manager_map (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint tile_num,
|
|
|
|
Tile *srctile);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
/* Validate a tiles memory.
|
|
|
|
*/
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_manager_validate (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
Tile *tile);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_invalidate (Tile **tile_ptr,
|
2006-04-12 12:49:29 +00:00
|
|
|
TileManager *tm,
|
|
|
|
gint tile_num);
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_invalidate_tile (Tile **tile_ptr,
|
2006-04-12 12:49:29 +00:00
|
|
|
TileManager *tm,
|
|
|
|
gint xpixel,
|
|
|
|
gint ypixel);
|
1998-08-11 17:35:34 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
/* Given a toplevel tile, this procedure will invalidate
|
1998-08-15 19:17:36 +00:00
|
|
|
* (set the dirty bit) for this toplevel tile.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2001-05-15 11:25:25 +00:00
|
|
|
void tile_manager_invalidate_tiles (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
Tile *toplevel_tile);
|
1998-07-28 23:13:36 +00:00
|
|
|
|
2001-05-15 11:25:25 +00:00
|
|
|
void tile_manager_set_user_data (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gpointer user_data);
|
2001-05-15 11:25:25 +00:00
|
|
|
gpointer tile_manager_get_user_data (const TileManager *tm);
|
1998-07-28 23:13:36 +00:00
|
|
|
|
2001-05-15 11:25:25 +00:00
|
|
|
gint tile_manager_width (const TileManager *tm);
|
|
|
|
gint tile_manager_height (const TileManager *tm);
|
|
|
|
gint tile_manager_bpp (const TileManager *tm);
|
2001-01-23 13:01:48 +00:00
|
|
|
|
2001-05-15 11:25:25 +00:00
|
|
|
void tile_manager_get_offsets (const TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint *x,
|
|
|
|
gint *y);
|
2001-05-15 11:25:25 +00:00
|
|
|
void tile_manager_set_offsets (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint x,
|
|
|
|
gint y);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2004-09-19 19:47:26 +00:00
|
|
|
gint64 tile_manager_get_memsize (const TileManager *tm,
|
|
|
|
gboolean sparse);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_manager_get_tile_coordinates (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
Tile *tile,
|
|
|
|
gint *x,
|
|
|
|
gint *y);
|
1998-08-15 19:17:36 +00:00
|
|
|
|
2000-12-29 15:22:01 +00:00
|
|
|
void tile_manager_map_over_tile (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
Tile *tile,
|
|
|
|
Tile *srctile);
|
1998-08-15 19:17:36 +00:00
|
|
|
|
2001-11-29 01:06:44 +00:00
|
|
|
PixelDataHandle * request_pixel_data (TileManager *tm,
|
2006-04-12 12:49:29 +00:00
|
|
|
gint x1,
|
2006-07-06 10:58:44 +00:00
|
|
|
gint y1,
|
|
|
|
gint x2,
|
|
|
|
gint y2,
|
2006-04-12 12:49:29 +00:00
|
|
|
gboolean wantread,
|
|
|
|
gboolean wantwrite);
|
2001-11-29 01:06:44 +00:00
|
|
|
|
|
|
|
void release_pixel_data (PixelDataHandle *pdh);
|
|
|
|
|
2005-05-08 20:24:54 +00:00
|
|
|
void read_pixel_data (TileManager *tm,
|
|
|
|
gint x1,
|
|
|
|
gint y1,
|
|
|
|
gint x2,
|
|
|
|
gint y2,
|
|
|
|
guchar *buffer,
|
|
|
|
guint stride);
|
|
|
|
|
|
|
|
void write_pixel_data (TileManager *tm,
|
|
|
|
gint x1,
|
|
|
|
gint y1,
|
|
|
|
gint x2,
|
|
|
|
gint y2,
|
|
|
|
const guchar *buffer,
|
|
|
|
guint stride);
|
2001-11-29 01:06:44 +00:00
|
|
|
|
2003-04-04 11:19:57 +00:00
|
|
|
/* Fill buffer with the pixeldata for the pixel at coordinates x,y
|
|
|
|
* if x,y is outside the area of the tilemanger, nothing is done.
|
|
|
|
*/
|
2006-07-06 10:58:44 +00:00
|
|
|
void read_pixel_data_1 (TileManager *tm,
|
2006-07-06 12:27:32 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
2005-05-08 20:24:54 +00:00
|
|
|
guchar *buffer);
|
|
|
|
|
2006-07-06 10:58:44 +00:00
|
|
|
void write_pixel_data_1 (TileManager *tm,
|
2006-07-06 12:27:32 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
2006-04-12 12:49:29 +00:00
|
|
|
const guchar *buffer);
|
2001-05-15 11:25:25 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
#endif /* __TILE_MANAGER_H__ */
|