5 * Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
6 * Email koolsmoky(at)users.sourceforge.net
7 * Web http://www.3dfxzone.it/koolsmoky
9 * this is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
14 * this is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GNU Make; see the file COPYING. If not, write to
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include "TxInternal.h"
32 typedef struct tagBITMAPFILEHEADER {
40 typedef struct tagBITMAPINFOHEADER {
46 uint32_t biCompression;
48 uint32_t biXPelsPerMeter;
49 uint32_t biYPelsPerMeter;
51 uint32_t biClrImportant;
54 typedef struct tagBITMAPFILEHEADER BITMAPFILEHEADER;
55 typedef struct tagBITMAPINFOHEADER BITMAPINFOHEADER;
58 #define DDSD_CAPS 0x00000001
59 #define DDSD_HEIGHT 0x00000002
60 #define DDSD_WIDTH 0x00000004
61 #define DDSD_PITCH 0x00000008
62 #define DDSD_PIXELFORMAT 0x00001000
63 #define DDSD_MIPMAPCOUNT 0x00020000
64 #define DDSD_LINEARSIZE 0x00080000
65 #define DDSD_DEPTH 0x00800000
67 #define DDPF_ALPHAPIXELS 0x00000001
68 #define DDPF_FOURCC 0x00000004
69 #define DDPF_RGB 0x00000040
71 #define DDSCAPS_COMPLEX 0x00000008
72 #define DDSCAPS_TEXTURE 0x00001000
73 #define DDSCAPS_MIPMAP 0x00400000
75 typedef struct tagDDSPIXELFORMAT {
79 uint32_t dwRGBBitCount;
83 uint32_t dwRGBAlphaBitMask;
86 typedef struct tagDDSFILEHEADER {
92 uint32_t dwLinearSize;
94 uint32_t dwMipMapCount;
95 uint32_t dwReserved1[11];
104 boolean getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr);
105 boolean getBMPInfo(FILE *fp, BITMAPFILEHEADER *bmp_fhdr, BITMAPINFOHEADER *bmp_ihdr);
106 boolean getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr);
110 uint8* readPNG(FILE* fp, int* width, int* height, uint16* format);
111 boolean writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, uint16 format, uint8 *palette);
112 uint8* readBMP(FILE* fp, int* width, int* height, uint16* format);
113 uint8* readDDS(FILE* fp, int* width, int* height, uint16* format);
116 #endif /* __TXIMAGE_H__ */