tile-manager.h 4.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* 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
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 */
18

Elliot Lee's avatar
Elliot Lee committed
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef __TILE_MANAGER_H__
#define __TILE_MANAGER_H__


/* 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
 */
32
33
34
TileManager * tile_manager_new               (gint toplevel_width,
					      gint toplevel_height,
					      gint bpp);
Elliot Lee's avatar
Elliot Lee committed
35
36
37

/* Destroy a tile manager and all the tiles it contains.
 */
38
void          tile_manager_destroy           (TileManager *tm);
Elliot Lee's avatar
Elliot Lee committed
39
40
41
42
43
44
45

/* 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.
 */
46
47
void          tile_manager_set_validate_proc (TileManager      *tm,
					      TileValidateProc  proc);
Elliot Lee's avatar
Elliot Lee committed
48

49
/* Get a specified tile from a tile manager. 
Elliot Lee's avatar
Elliot Lee committed
50
 */
51
52
53
54
55
Tile        * tile_manager_get_tile          (TileManager *tm,
					      gint         xpixel,
					      gint         ypixel,
					      gint         wantread,
					      gint         wantwrite);
Elliot Lee's avatar
Elliot Lee committed
56
57
58

/* Get a specified tile from a tile manager.
 */
59
60
61
62
Tile        * tile_manager_get               (TileManager *tm,
					      gint         tile_num,
					      gint         wantread,
					      gint         wantwrite);
63

64
/* Request that (if possible) the tile at x,y be swapped
65
66
67
68
 * 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...
 */
69
70
71
void          tile_manager_get_async         (TileManager *tm,
					      gint         xpixel,
					      gint         ypixel);
72

73
74
75
76
void          tile_manager_map_tile          (TileManager *tm,
					      gint         xpixel,
					      gint         ypixel,
					      Tile        *srctile);
77

78
79
80
void          tile_manager_map               (TileManager *tm,
					      gint         time_num,
					      Tile        *srctile);
Elliot Lee's avatar
Elliot Lee committed
81
82
83

/* Validate a tiles memory.
 */
84
85
void          tile_manager_validate          (TileManager  *tm,
					      Tile         *tile);
Elliot Lee's avatar
Elliot Lee committed
86

87
88
89
90
91
92
93
void          tile_invalidate                (Tile        **tile_ptr,
					      TileManager  *tm,
					      gint          tile_num);
void          tile_invalidate_tile           (Tile        **tile_ptr,
					      TileManager  *tm, 
					      gint          xpixel,
					      gint          ypixel);
scott's avatar
scott committed
94

Elliot Lee's avatar
Elliot Lee committed
95
/* Given a toplevel tile, this procedure will invalidate
96
 *  (set the dirty bit) for this toplevel tile.
Elliot Lee's avatar
Elliot Lee committed
97
 */
98
99
void          tile_manager_invalidate_tiles (TileManager       *tm,
					     Tile              *toplevel_tile);
100

101
102
103
void          tile_manager_set_user_data    (TileManager       *tm,
					     gpointer           user_data);
gpointer      tile_manager_get_user_data    (const TileManager *tm);
104

105
106
107
gint          tile_manager_level_width      (const TileManager *tm);
gint          tile_manager_level_height     (const TileManager *tm);
gint          tile_manager_level_bpp        (const TileManager *tm);
Elliot Lee's avatar
Elliot Lee committed
108

109
110
111
112
void          tile_manager_get_tile_coordinates (TileManager *tm,
						 Tile        *tile,
						 gint        *x,
						 gint        *y);
113

114
115
116
void          tile_manager_map_over_tile        (TileManager *tm,
						 Tile        *tile,
						 Tile        *srctile);
117

Elliot Lee's avatar
Elliot Lee committed
118
#endif /* __TILE_MANAGER_H__ */