d07c171f |
1 | #ifndef _BMG_LIB_ |
2 | #define _BMG_LIB_ |
3 | /* |
4 | // header file for the BMGLib DLL |
5 | // This DLL encapsulates the libTIFF library, libJPEG library, |
6 | // libPNG library, and the GeoTIFF library. |
7 | // |
8 | // Copyright 2000, 2001 M. Scott Heiman |
9 | // All Rights Reserved |
10 | // libTIFF is Copyright Sam Leffler and SGI |
11 | // libJPEG is Copyright (C) 1991-1998, Thomas G. Lane and is part of the |
12 | // Independent JPEG Group's software. |
13 | // libPNG is Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. |
14 | // (libpng versions 0.5, May 1995, through 0.89c, May 1996) |
15 | // Copyright (c) 1996, 1997 Andreas Dilger |
16 | // (libpng versions 0.90, December 1996, through 0.96, May 1997) |
17 | // Copyright (c) 1998, 1999 Glenn Randers-Pehrson |
18 | // (libpng versions 0.97, January 1998, through 1.0.5, October 15, 1999) |
19 | // zLib Copyright (C) 1995-1998 Jean-loup Gailly. |
20 | // GeoTIFF is Copyright (c) 1999, Frank Warmerdam |
21 | // libPROJ (used by GeoTIFF) is Copytight (c) 2000, Frank Warmerdam |
22 | // libUnGif is Copyright (c) 1997, Eric S. Raymond |
23 | // |
24 | // You may use the software for any purpose you see fit. You may modify |
25 | // it, incorporate it in a commercial application, use it for school, |
26 | // even turn it in as homework. You must keep the Copyright in the |
27 | // header and source files. This software is not in the "Public Domain". |
28 | // You may use this software at your own risk. I have made a reasonable |
29 | // effort to verify that this software works in the manner I expect it to; |
30 | // however,... |
31 | // |
32 | // THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" AND |
33 | // WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING |
34 | // WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A |
35 | // PARTICULAR PURPOSE. IN NO EVENT SHALL MICHAEL S. HEIMAN BE LIABLE TO |
36 | // YOU OR ANYONE ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR |
37 | // CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING |
38 | // WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, |
39 | // OR THE CLAIMS OF THIRD PARTIES, WHETHER OR NOT MICHAEL S. HEIMAN HAS |
40 | // BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON |
41 | // ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE |
42 | // POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. |
43 | */ |
44 | |
45 | #include "BMGImage.h" |
46 | #include "tiffrw.h" |
47 | #include "pngrw.h" |
48 | #include "jpegrw.h" |
49 | |
50 | #if defined(__cplusplus) |
51 | extern "C" { |
52 | #endif |
53 | |
54 | /* returns a BITMAPINFO structure with the given height, width, |
55 | bit count, and compression scheme. This structure DOES NOT contain any |
56 | palette information (bmiColors = NULL) */ |
57 | extern |
58 | BITMAPINFO CreateBMI( unsigned int dwWidth, /* width in pixels */ |
59 | unsigned int dwHeight, /* height in pixels */ |
60 | unsigned short wBitCount, /* 1, 4, 8, 16, 24, & 32 */ |
61 | int compression ); /* biCompression value */ |
62 | |
63 | /* returns an array of RGBA or BGRA values for all supported graphics file |
64 | formats. The RGBA pixel format is supported by all versions of OpenGL. |
65 | The BGRA format is an extension supported by may OpenGL vendors. */ |
66 | extern |
67 | BMGError GetUnpackedArray( const char *filename, |
68 | unsigned int *width, |
69 | unsigned int *height, |
70 | unsigned char **bits, |
71 | int bgra ); |
72 | |
73 | /* Saves an array of RGB, RGBA, BGR, and BGRA values to a file. The RGB and RGBA |
74 | pixel formats are supported by OpenGL. The BGR and BGRA extensions are |
75 | supported by many OpenGL vendors */ |
76 | extern |
77 | BMGError SaveUnpackedArray( const char *filename, |
78 | unsigned char bytes_per_pixel, |
79 | unsigned int width, |
80 | unsigned int height, |
81 | unsigned char *bits, |
82 | int bgra ); |
83 | |
84 | /* saves the contents of an HBITMAP to a file. The extension of the file name |
85 | // determines the file type. returns 1 if successfull, 0 otherwise */ |
86 | extern |
87 | BMGError SaveBitmapToFile( HBITMAP hBitmap, /* bitmap to be saved */ |
88 | const char *filename, /* name of output file */ |
89 | void *parameters ); |
90 | |
91 | /* Creates an HBITMAP to an image file. The extension of the file name |
92 | // determines the file type. returns an HBITMAP if successfull, NULL |
93 | // otherwise */ |
94 | extern |
95 | HBITMAP CreateBitmapFromFile( const char *filename, |
96 | void *parameters, |
97 | int blend ); |
98 | |
99 | /* extracts a BMGImageStruct from any one of the supported image files */ |
100 | extern |
101 | BMGError GetDataFromFile( const char *filename, |
102 | struct BMGImageStruct *img, |
103 | void *parameters ); |
104 | |
105 | /* the following functions will read/write image files using raw data */ |
106 | extern |
107 | BMGError ReadRGB( const char *filename, |
108 | struct BMGImageStruct *img ); |
109 | |
110 | extern |
111 | BMGError WriteRGB( const char *filename, |
112 | struct BMGImageStruct img ); |
113 | |
114 | extern |
115 | BMGError ReadTGA( const char *filename, |
116 | struct BMGImageStruct *img ); |
117 | |
118 | extern |
119 | BMGError WriteTGA( const char *filename, |
120 | struct BMGImageStruct img ); |
121 | |
122 | extern |
123 | BMGError ReadBMP( const char *filename, |
124 | struct BMGImageStruct *img ); |
125 | |
126 | extern |
127 | BMGError WriteBMP( const char *filename, |
128 | struct BMGImageStruct img ); |
129 | |
130 | extern |
131 | BMGError ReadCEL( const char *filename, |
132 | struct BMGImageStruct *img ); |
133 | |
134 | extern |
135 | BMGError ReadGIF( const char *filename, |
136 | struct BMGImageStruct *img ); |
137 | |
138 | extern |
139 | BMGError ReadPSD( const char *filename, |
140 | struct BMGImageStruct *img ); |
141 | |
142 | extern |
143 | BMGError ReadIFF( const char *filename, |
144 | struct BMGImageStruct *img ); |
145 | |
146 | extern |
147 | BMGError ReadPCX( const char *filename, |
148 | struct BMGImageStruct *img ); |
149 | |
150 | #if defined(__cplusplus) |
151 | } |
152 | #endif |
153 | |
154 | #endif |
155 | |