2 Copyright 2004 John Tsiombikas <nuclear@siggraph.org>
4 This is a small image library.
6 This library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 /* image file handling library
23 * author: John Tsiombikas 2003
24 * modified: John Tsiombikas 2004
30 #include "3dengfx_config.h"
32 /* always compile support for image formats that
33 * don't create any library dependencies.
35 #define IMGLIB_USE_TGA
36 #define IMGLIB_USE_PPM
38 /* for jpeg and png, make the default be to compile them in,
39 * unless explicitly disabled.
41 #ifndef IMGLIB_NO_JPEG
42 #define IMGLIB_USE_JPEG
43 #endif /* IMGLIB_NO_JPEG */
46 #define IMGLIB_USE_PNG
47 #endif /* IMGLIB_NO_PNG */
50 enum image_file_format {
59 IMG_SAVE_COMPRESS = 2,
65 #endif /* __cplusplus */
67 /* load_image() loads the specified image from file, returns the pixel data
68 * in 32bit mode, and changes xsz and ysz to the size of the image
70 void *load_image(const char *fname, unsigned long *xsz, unsigned long *ysz);
72 /* deallocate the image data with this function
73 * note: provided for consistency, simply calls free()
75 void free_image(void *img);
77 /* save the supplied image data in a file of the specified format */
78 int save_image(const char *fname, void *pixels, unsigned long xsz, unsigned long ysz, enum image_file_format fmt);
80 /* set/get save image options */
81 void set_image_save_flags(unsigned int flags);
82 unsigned int get_image_save_flags(void);
86 #endif /* __cplusplus */