00001 /* $Id: bmp.h 17248 2009-08-21 20:21:05Z rubidium $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * OpenTTD 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, version 2. 00006 * OpenTTD 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. 00007 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 00008 */ 00009 00012 #ifndef BMP_H 00013 #define BMP_H 00014 00015 #include "gfx_type.h" 00016 00017 struct BmpInfo { 00018 uint32 offset; 00019 uint32 width; 00020 uint32 height; 00021 bool os2_bmp; 00022 uint16 bpp; 00023 uint32 compression; 00024 uint32 palette_size; 00025 }; 00026 00027 struct BmpData { 00028 Colour *palette; 00029 byte *bitmap; 00030 }; 00031 00032 #define BMP_BUFFER_SIZE 1024 00033 00034 struct BmpBuffer { 00035 byte data[BMP_BUFFER_SIZE]; 00036 int pos; 00037 int read; 00038 FILE *file; 00039 uint real_pos; 00040 }; 00041 00042 void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file); 00043 bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data); 00044 bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data); 00045 void BmpDestroyData(BmpData *data); 00046 00047 #endif /* BMP_H */