2000-12-29 23:22:01 +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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#ifndef __TILE_H__
|
|
|
|
#define __TILE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#define TILE_WIDTH 64
|
|
|
|
#define TILE_HEIGHT 64
|
1998-07-03 07:29:44 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-12-14 03:48:24 +08:00
|
|
|
/* explicit guchar type rather than enum since gcc chooses an int
|
|
|
|
* representation but arrays of TileRowHints are quite space-critical
|
|
|
|
* in GIMP.
|
|
|
|
*/
|
|
|
|
typedef guchar TileRowHint;
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2004-02-18 21:53:19 +08:00
|
|
|
#define TILEROWHINT_UNKNOWN 0
|
1999-12-14 03:48:24 +08:00
|
|
|
#define TILEROWHINT_OPAQUE 1
|
|
|
|
#define TILEROWHINT_TRANSPARENT 2
|
|
|
|
#define TILEROWHINT_MIXED 3
|
|
|
|
#define TILEROWHINT_OUTOFRANGE 4
|
|
|
|
#define TILEROWHINT_UNDEFINED 5
|
2004-02-18 21:53:19 +08:00
|
|
|
#define TILEROWHINT_BROKEN 6
|
1999-05-09 23:45:37 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Initializes the fields of a tile to "good" values.
|
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_init (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint bpp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
1998-07-10 10:43:12 +08:00
|
|
|
/*
|
|
|
|
* tile_lock locks a tile into memory. This does what tile_ref used
|
|
|
|
* to do. It is the responsibility of the tile manager to take care
|
|
|
|
* of the copy-on-write semantics. Locks stack; a tile remains locked
|
|
|
|
* in memory as long as it's been locked more times than it has been
|
|
|
|
* released. tile_release needs to know whether the release was for
|
|
|
|
* write access. (This is a hack, and should be handled better.)
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_lock (Tile *tile);
|
|
|
|
void tile_release (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
gboolean dirty);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Allocate the data for the tile.
|
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_alloc (Tile *tile);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Return the size in bytes of the tiles data.
|
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
gint tile_size (Tile *tile);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
gint tile_ewidth (Tile *tile);
|
|
|
|
gint tile_eheight (Tile *tile);
|
|
|
|
gint tile_bpp (Tile *tile);
|
1998-08-12 01:35:34 +08:00
|
|
|
|
2004-02-19 02:57:43 +08:00
|
|
|
gboolean tile_is_valid (Tile *tile);
|
1998-08-12 01:35:34 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_mark_valid (Tile *tile);
|
1998-08-12 01:35:34 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
TileRowHint tile_get_rowhint (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint yoff);
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_set_rowhint (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint yoff,
|
|
|
|
TileRowHint rowhint);
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_sanitize_rowhints (Tile *tile);
|
1999-05-09 23:45:37 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
void * tile_data_pointer (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint xoff,
|
|
|
|
gint yoff);
|
1998-08-12 01:35:34 +08:00
|
|
|
|
1998-07-10 10:43:12 +08:00
|
|
|
/* tile_attach attaches a tile to a tile manager: this function
|
|
|
|
* increments the tile's share count and inserts a tilelink into the
|
|
|
|
* tile's link list. tile_detach reverses the process.
|
|
|
|
* If a tile's share count is zero after a tile_detach, the tile is
|
|
|
|
* discarded.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
1998-07-10 10:43:12 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_attach (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
void *tm,
|
|
|
|
gint tile_num);
|
2000-12-29 23:22:01 +08:00
|
|
|
void tile_detach (Tile *tile,
|
2006-04-12 20:49:29 +08:00
|
|
|
void *tm,
|
|
|
|
gint tile_num);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* __TILE_H__ */
|