1998-01-22 15:02:57 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* 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 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1998-01-22 15:02:57 +08:00
|
|
|
*/
|
1997-11-25 06:05:25 +08:00
|
|
|
#ifndef __TILE_MANAGER_H__
|
|
|
|
#define __TILE_MANAGER_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "tile.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _TileManager TileManager;
|
|
|
|
|
|
|
|
typedef void (*TileValidateProc) (TileManager *tm,
|
1998-08-16 03:17:36 +08:00
|
|
|
Tile *tile);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Creates a new tile manager with the specified
|
|
|
|
* width for the toplevel. The toplevel sizes is
|
|
|
|
* used to compute the number of levels and there
|
|
|
|
* size. Each level is 1/2 the width and height of
|
|
|
|
* the level above it.
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
TileManager* tile_manager_new (int toplevel_width,
|
|
|
|
int toplevel_height,
|
|
|
|
int bpp);
|
|
|
|
|
|
|
|
/* Destroy a tile manager and all the tiles it contains.
|
|
|
|
*/
|
|
|
|
void tile_manager_destroy (TileManager *tm);
|
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
void tile_manager_set_validate_proc (TileManager *tm,
|
|
|
|
TileValidateProc proc);
|
|
|
|
|
1998-08-16 03:17:36 +08:00
|
|
|
/* Get a specified tile from a tile manager.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
Tile* tile_manager_get_tile (TileManager *tm,
|
|
|
|
int xpixel,
|
|
|
|
int ypixel,
|
1998-07-10 10:43:12 +08:00
|
|
|
int wantread,
|
|
|
|
int wantwrite);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Get a specified tile from a tile manager.
|
|
|
|
*/
|
|
|
|
Tile* tile_manager_get (TileManager *tm,
|
|
|
|
int tile_num,
|
1998-07-10 10:43:12 +08:00
|
|
|
int wantread,
|
|
|
|
int wantwrite);
|
|
|
|
|
1998-08-16 03:17:36 +08:00
|
|
|
/* Request that (if possible) the tile at x,y be swapped
|
1998-07-13 07:01:33 +08:00
|
|
|
* in. This is only a hint to improve performance; no guarantees.
|
|
|
|
* The tile may be swapped in or otherwise made more accessible
|
|
|
|
* if it is convenient...
|
|
|
|
*/
|
|
|
|
void tile_manager_get_async (TileManager *tm,
|
|
|
|
int xpixel,
|
1998-08-16 03:17:36 +08:00
|
|
|
int ypixel);
|
1998-07-13 07:01:33 +08:00
|
|
|
|
1998-07-10 10:43:12 +08:00
|
|
|
void tile_manager_map_tile (TileManager *tm,
|
|
|
|
int xpixel,
|
|
|
|
int ypixel,
|
|
|
|
Tile *srctile);
|
|
|
|
|
|
|
|
void tile_manager_map (TileManager *tm,
|
|
|
|
int time_num,
|
|
|
|
Tile *srctile);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Validate a tiles memory.
|
|
|
|
*/
|
|
|
|
void tile_manager_validate (TileManager *tm,
|
|
|
|
Tile *tile);
|
|
|
|
|
1998-08-12 01:35:34 +08:00
|
|
|
void tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num);
|
|
|
|
void tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
|
1998-08-16 03:17:36 +08:00
|
|
|
int xpixel, int ypixel);
|
1998-08-12 01:35:34 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Given a toplevel tile, this procedure will invalidate
|
1998-08-16 03:17:36 +08:00
|
|
|
* (set the dirty bit) for this toplevel tile.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
void tile_manager_invalidate_tiles (TileManager *tm,
|
|
|
|
Tile *toplevel_tile);
|
|
|
|
|
1998-07-29 07:13:36 +08:00
|
|
|
void tile_manager_set_user_data (TileManager *tm,
|
|
|
|
void *user_data);
|
|
|
|
|
|
|
|
void *tile_manager_get_user_data (TileManager *tm);
|
|
|
|
|
1998-08-16 03:17:36 +08:00
|
|
|
int tile_manager_level_width (TileManager *tm);
|
|
|
|
int tile_manager_level_height (TileManager *tm);
|
|
|
|
int tile_manager_level_bpp (TileManager *tm);
|
1998-07-29 07:13:36 +08:00
|
|
|
|
|
|
|
void tile_manager_get_tile_coordinates (TileManager *tm, Tile *tile,
|
|
|
|
int *x, int *y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-08-16 03:17:36 +08:00
|
|
|
void tile_manager_map_over_tile (TileManager *tm, Tile *tile, Tile *srctile);
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#endif /* __TILE_MANAGER_H__ */
|