OSDN Git Service

finalize changelog
[jnethack/source.git] / include / tileset.h
1 /* NetHack 3.6    tileset.h    $NHDT-Date: 1457207052 2016/03/05 19:44:12 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.0 $ */
2 /* Copyright (c) Ray Chason, 2016. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 #ifndef TILESET_H
6 #define TILESET_H
7
8 struct Pixel {
9     unsigned char r, g, b, a;
10 };
11
12 struct TileImage {
13     /* Image data */
14     unsigned width, height;
15     struct Pixel *pixels; /* for direct color */
16     unsigned char *indexes; /* for paletted images */
17 };
18
19 boolean FDECL(read_tiles, (const char *filename, BOOLEAN_P true_color));
20 const struct Pixel *NDECL(get_palette);
21 void NDECL(free_tiles);
22 const struct TileImage *FDECL(get_tile, (unsigned tile_index));
23
24 /* Used internally by the tile set code */
25 struct TileSetImage {
26     /* Image data */
27     unsigned width, height;
28     struct Pixel *pixels; /* for direct color */
29     unsigned char *indexes; /* for paletted images */
30     struct Pixel palette[256];
31     
32     /* Image description from the file */
33     char *image_desc;
34
35     /* Tile dimensions */
36     unsigned tile_width, tile_height;
37 };
38
39 boolean FDECL(read_bmp_tiles, (const char *filename, struct TileSetImage *image));
40 boolean FDECL(read_gif_tiles, (const char *filename, struct TileSetImage *image));
41 boolean FDECL(read_png_tiles, (const char *filename, struct TileSetImage *image));
42
43 #endif