home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / tile_manager.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-15  |  3.9 KB  |  121 lines

  1. /* The GIMP -- an image manipulation program
  2.  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3.  *
  4.  * This program is free software; you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation; either version 2 of the License, or
  7.  * (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * 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. #ifndef __TILE_MANAGER_H__
  19. #define __TILE_MANAGER_H__
  20.  
  21.  
  22. #include "tile.h"
  23.  
  24.  
  25. typedef struct _TileManager  TileManager;
  26.  
  27. typedef void (*TileValidateProc) (TileManager *tm,
  28.                   Tile        *tile);
  29.  
  30.  
  31. /* Creates a new tile manager with the specified
  32.  *  width for the toplevel. The toplevel sizes is
  33.  *  used to compute the number of levels and there
  34.  *  size. Each level is 1/2 the width and height of
  35.  *  the level above it.
  36.  * The toplevel is level 0. The smallest level in the
  37.  *  hierarchy is "nlevels - 1". That level will be smaller
  38.  *  than TILE_WIDTH x TILE_HEIGHT
  39.  */
  40. TileManager* tile_manager_new (int toplevel_width,
  41.                    int toplevel_height,
  42.                    int bpp);
  43.  
  44. /* Destroy a tile manager and all the tiles it contains.
  45.  */
  46. void tile_manager_destroy (TileManager *tm);
  47.  
  48. /* Set the validate procedure for the tile manager.
  49.  *  The validate procedure is called when an invalid tile
  50.  *  is referenced. If the procedure is NULL, then the tile
  51.  *  is set to valid and its memory is allocated, but
  52.  *  not initialized.
  53.  */
  54. void tile_manager_set_validate_proc (TileManager      *tm,
  55.                      TileValidateProc  proc);
  56.  
  57. /* Get a specified tile from a tile manager. 
  58.  */
  59. Tile* tile_manager_get_tile (TileManager *tm,
  60.                  int          xpixel,
  61.                  int          ypixel,
  62.                  int          wantread,
  63.                  int          wantwrite);
  64.  
  65. /* Get a specified tile from a tile manager.
  66.  */
  67. Tile* tile_manager_get (TileManager *tm,
  68.             int          tile_num,
  69.             int          wantread,
  70.             int          wantwrite);
  71.  
  72. /* Request that (if possible) the tile at x,y be swapped
  73.  * in.  This is only a hint to improve performance; no guarantees.
  74.  * The tile may be swapped in or otherwise made more accessible
  75.  * if it is convenient...
  76.  */
  77. void tile_manager_get_async (TileManager *tm,
  78.                  int          xpixel,
  79.                  int          ypixel);
  80.  
  81. void tile_manager_map_tile (TileManager *tm,
  82.                 int          xpixel,
  83.                 int          ypixel,
  84.                 Tile        *srctile);
  85.  
  86. void tile_manager_map (TileManager *tm,
  87.                int          time_num,
  88.                Tile        *srctile);
  89.  
  90. /* Validate a tiles memory.
  91.  */
  92. void tile_manager_validate (TileManager *tm,
  93.                 Tile        *tile);
  94.  
  95. void tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num);
  96. void tile_invalidate_tile (Tile **tile_ptr, TileManager *tm, 
  97.                int xpixel, int ypixel);
  98.  
  99. /* Given a toplevel tile, this procedure will invalidate
  100.  *  (set the dirty bit) for this toplevel tile.
  101.  */
  102. void tile_manager_invalidate_tiles (TileManager *tm,
  103.                     Tile        *toplevel_tile);
  104.  
  105. void tile_manager_set_user_data (TileManager *tm,
  106.                  void        *user_data);
  107.  
  108. void *tile_manager_get_user_data (TileManager *tm);
  109.  
  110. int tile_manager_level_width  (TileManager *tm);
  111. int tile_manager_level_height (TileManager *tm);
  112. int tile_manager_level_bpp    (TileManager *tm);
  113.  
  114. void tile_manager_get_tile_coordinates (TileManager *tm, Tile *tile,
  115.                     int *x, int *y);
  116.  
  117. void tile_manager_map_over_tile (TileManager *tm, Tile *tile, Tile *srctile);
  118.  
  119.  
  120. #endif /* __TILE_MANAGER_H__ */
  121.