• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (C)2004 Landmark Graphics Corporation
2  * Copyright (C)2005 Sun Microsystems, Inc.
3  * Copyright (C)2011 D. R. Commander
4  *
5  * This library is free software and may be redistributed and/or modified under
6  * the terms of the wxWindows Library License, Version 3.1 or (at your option)
7  * any later version.  The full license is in the LICENSE.txt file included
8  * with this distribution.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * wxWindows Library License for more details.
14 */
15 
16 // This provides rudimentary facilities for loading and saving true color
17 // BMP and PPM files
18 
19 #ifndef __BMP_H__
20 #define __BMP_H__
21 
22 #define BMPPIXELFORMATS 6
23 enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBX, BMP_BGR, BMP_BGRX, BMP_XBGR, BMP_XRGB};
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 // This will load a Windows bitmap from a file and return a buffer with the
30 // specified pixel format, scanline alignment, and orientation.  The width and
31 // height are returned in w and h.
32 
33 int loadbmp(char *filename, unsigned char **buf, int *w, int *h,
34 	enum BMPPIXELFORMAT f, int align, int dstbottomup);
35 
36 // This will save a buffer with the specified pixel format, pitch, orientation,
37 // width, and height as a 24-bit Windows bitmap or PPM (the filename determines
38 // which format to use)
39 
40 int savebmp(char *filename, unsigned char *buf, int w, int h,
41 	enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup);
42 
43 const char *bmpgeterr(void);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif
50