home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / tile.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-28  |  2.3 KB  |  89 lines

  1. #ifndef __TILE_H__
  2. #define __TILE_H__
  3.  
  4.  
  5. #define TILE_WIDTH   64
  6. #define TILE_HEIGHT  64
  7.  
  8. /* Uncomment for verbose debugging on copy-on-write logic
  9. #define TILE_DEBUG
  10. */
  11.  
  12. /* sanity checking on new tile hinting code */
  13. /* #define HINTS_SANITY */
  14.  
  15. #include <sys/types.h>
  16. #include <glib.h>
  17.  
  18. #include "config.h"
  19.  
  20. typedef struct _Tile Tile;
  21.  
  22. /*  explicit guchar type rather than enum since gcc chooses an int
  23.  *  representation but arrays of TileRowHints are quite space-critical
  24.  *  in GIMP.
  25.  */
  26. typedef guchar TileRowHint;
  27. #define TILEROWHINT_BROKEN      0
  28. #define TILEROWHINT_OPAQUE      1
  29. #define TILEROWHINT_TRANSPARENT 2
  30. #define TILEROWHINT_MIXED       3
  31. #define TILEROWHINT_OUTOFRANGE  4
  32. #define TILEROWHINT_UNDEFINED   5
  33. #define TILEROWHINT_UNKNOWN     6
  34.  
  35.  
  36. /* Initializes the fields of a tile to "good" values.
  37.  */
  38. void tile_init (Tile *tile,
  39.         int   bpp);
  40.  
  41.  
  42. /*
  43.  * tile_lock locks a tile into memory.  This does what tile_ref used
  44.  * to do.  It is the responsibility of the tile manager to take care
  45.  * of the copy-on-write semantics.  Locks stack; a tile remains locked
  46.  * in memory as long as it's been locked more times than it has been
  47.  * released.  tile_release needs to know whether the release was for
  48.  * write access.  (This is a hack, and should be handled better.)
  49.  */
  50.  
  51. void tile_lock (Tile *);
  52. void tile_release (Tile *, int);
  53.  
  54. /* Allocate the data for the tile.
  55.  */
  56. void tile_alloc (Tile *tile);
  57.  
  58. /* Return the size in bytes of the tiles data.
  59.  */
  60. int tile_size (Tile *tile);
  61.  
  62. int tile_ewidth (Tile *tile);
  63. int tile_eheight (Tile *tile);
  64. int tile_bpp (Tile *tile);
  65.  
  66. int tile_is_valid (Tile *tile);
  67.  
  68. void tile_mark_valid (Tile *tile);
  69.  
  70. /* DOCUMENT ME -- adm */
  71. TileRowHint tile_get_rowhint (Tile *tile, int yoff);
  72. void tile_set_rowhint (Tile *tile, int yoff, TileRowHint rowhint);
  73. void tile_sanitize_rowhints (Tile *tile);
  74.  
  75. void *tile_data_pointer (Tile *tile, int xoff, int yoff);
  76.  
  77. /* tile_attach attaches a tile to a tile manager: this function
  78.  * increments the tile's share count and inserts a tilelink into the
  79.  * tile's link list.  tile_detach reverses the process.
  80.  * If a tile's share count is zero after a tile_detach, the tile is
  81.  * discarded.
  82.  */
  83.  
  84. void tile_attach (Tile *tile, void *tm, int tile_num);
  85. void tile_detach (Tile *tile, void *tm, int tile_num);
  86.  
  87.  
  88. #endif /* __TILE_H__ */
  89.