/afs/csl.tjhsst.edu/students/2007/kkassing/work/liballoy/image.h

Go to the documentation of this file.
00001 #ifndef __IMAGE_H__
00002 #define __IMAGE_H__
00003 
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <string.h>
00007 #include <math.h>
00008 
00009 #ifdef _ALLOY_SDL_IMAGE
00010  #include <SDL/SDL_image.h>
00011 #else
00012  #ifdef _ALLOY_JPG
00013   #include "jpeglib.h"
00014  #endif
00015  #ifdef _ALLOY_PNG
00016   #include "png.h"
00017  #endif
00018 #endif
00019 
00020 //typedef unsigned char byte;
00021 
00022 typedef unsigned char alloy_byte;
00023 
00024 typedef struct alloy_image
00025 {
00026         int width;
00027         int height;
00028         int components;
00029         alloy_byte* data;
00030 } alloy_image_t;
00031 
00032 #ifdef _ALLOY_SDL_IMAGE
00033 
00034 #define alloy_load_jpg(a) alloy_load_sdl(a)
00035 #define alloy_load_png(a) alloy_load_sdl(a)
00036 #define alloy_load_bmp(a) alloy_load_sdl(a)
00037 #define alloy_load_gif(a) alloy_load_sdl(a)
00038 #define alloy_load_pnm(a) alloy_load_sdl(a)
00039 #define alloy_load_xpm(a) alloy_load_sdl(a)
00040 #define alloy_load_pcx(a) alloy_load_sdl(a)
00041 #define alloy_load_tif(a) alloy_load_sdl(a)
00042 #define alloy_load_tga(a) alloy_load_sdl(a)
00043 
00044 alloy_image_t alloy_load_sdl(const char*);
00045 
00046 #else
00047 
00048 #ifdef _ALLOY_JPG
00049 alloy_image_t alloy_load_jpg(const char*);
00050 #endif
00051 #ifdef _ALLOY_PNG
00052 alloy_image_t alloy_load_png(const char*);
00053 #endif
00054 
00055 typedef struct alloy_pcx_header
00056 {
00057         alloy_byte id;
00058         alloy_byte ver;
00059         alloy_byte enc;
00060         alloy_byte bpp;
00061         short xmin;
00062         short ymin;
00063         short xmax;
00064         short ymax;
00065         short xres;
00066         short yres;
00067         alloy_byte cmap[48];
00068         alloy_byte rsv;
00069         alloy_byte planes;
00070         short linesize;
00071         short palette;
00072         short hssize;
00073         short vssize;
00074         alloy_byte filler[54];
00075 } alloy_pcx_header_t;
00076 
00077 alloy_image_t alloy_load_pcx(const char*);
00078 
00079 typedef struct alloy_bmp_header
00080 {
00081         int size;
00082         int rsv;
00083         int offset;
00084         int hdr_size;
00085         int width;
00086         int height;
00087         short planes;
00088         short bitcount;
00089         int compression;
00090         int im_size;
00091         int xres;
00092         int yres;
00093         int clr_used;
00094         int clr_impt;
00095 } alloy_bmp_header_t;
00096 
00097 alloy_image_t alloy_load_bmp(const char*);
00098 
00099 typedef struct alloy_tga_header
00100 {
00101         alloy_byte id_size;
00102         alloy_byte cmap_type;
00103         alloy_byte im_type;
00104         short cmap_start;
00105         short cmap_len;
00106         alloy_byte cmap_bits;
00107         short xstart;
00108         short ystart;
00109         short width;
00110         short height;
00111         alloy_byte bits;
00112         alloy_byte desc;
00113 } alloy_tga_header_t;
00114 
00115 alloy_image_t alloy_load_tga(const char*);
00116 
00117 #endif
00118 
00119 typedef struct alloy_wal_header
00120 {
00121         char name[32];
00122         int width;
00123         int height;
00124         int offset[4];
00125         char next_name[32];
00126         int flags;
00127         int contents;
00128         int value;
00129 } alloy_wal_header_t;
00130 
00131 alloy_image_t alloy_load_wal(const char*);
00132 
00133 #endif

Generated on Fri Jun 1 09:08:56 2007 for Antigone by  doxygen 1.4.7