DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 1 | /* Copyright (C)2004 Landmark Graphics Corporation |
| 2 | * Copyright (C)2005 Sun Microsystems, Inc. |
| 3 | * |
| 4 | * This library is free software and may be redistributed and/or modified under |
| 5 | * the terms of the wxWindows Library License, Version 3.1 or (at your option) |
| 6 | * any later version. The full license is in the LICENSE.txt file included |
| 7 | * with this distribution. |
| 8 | * |
| 9 | * This library 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 | * wxWindows Library License for more details. |
| 13 | */ |
| 14 | |
| 15 | // This provides rudimentary facilities for loading and saving true color |
| 16 | // BMP and PPM files |
| 17 | |
| 18 | #ifndef __BMP_H__ |
| 19 | #define __BMP_H__ |
| 20 | |
| 21 | #define BMPPIXELFORMATS 6 |
| 22 | enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBA, BMP_BGR, BMP_BGRA, BMP_ABGR, BMP_ARGB}; |
| 23 | |
| 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #endif |
| 27 | |
| 28 | // This will load a Windows bitmap from a file and return a buffer with the |
| 29 | // specified pixel format, scanline alignment, and orientation. The width and |
| 30 | // height are returned in w and h. |
| 31 | |
| 32 | int loadbmp(char *filename, unsigned char **buf, int *w, int *h, |
| 33 | enum BMPPIXELFORMAT f, int align, int dstbottomup); |
| 34 | |
| 35 | // This will save a buffer with the specified pixel format, pitch, orientation, |
| 36 | // width, and height as a 24-bit Windows bitmap or PPM (the filename determines |
| 37 | // which format to use) |
| 38 | |
| 39 | int savebmp(char *filename, unsigned char *buf, int w, int h, |
| 40 | enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup); |
| 41 | |
| 42 | const char *bmpgeterr(void); |
| 43 | |
| 44 | #ifdef __cplusplus |
| 45 | } |
| 46 | #endif |
| 47 | |
| 48 | #endif |