image.h

Go to the documentation of this file.
00001 
00006 /*
00007  * Copyright (C) 2006  Lab. Visgraf/IMPA and AnimaMundi
00008  * 
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License
00011  * as published by the Free Software Foundation; either version 2
00012  * of the License, or (at your option) any later version.
00013  * 
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022  * 
00023 */
00024 
00025 #ifndef IMAGE_H
00026 #define IMAGE_H
00027 
00028 #include "aux.h"
00029 
00030 #define IMG_MONOCOL 0
00031 #define IMG_MAPPCOL 1
00032 #define IMG_TRUECOL 2
00033 
00034 #define IMG_DV_W 720
00035 #define IMG_DV_H 480
00036 
00037 typedef unsigned char Byte;
00038 
00039 typedef struct Bcolor {
00040   Byte z, y, x;
00041 } Bcolor;
00042 
00043 typedef struct CMap {
00044   Byte r[256];
00045   Byte g[256];
00046   Byte b[256];
00047 } CMap;
00048 
00049 typedef struct Image {
00050   int type;
00051   int w, h;
00052   CMap  *m;
00053   union {
00054     Byte   *b;
00055     Bcolor *c;
00056   } u;
00057 } Image;
00058 
00059 #define img_type(_) (_)->type
00060 #define img_cmap(_) (_)->m
00061 
00062 Image *img_create(int type, int w, int h);
00063 void  img_clear(Image *i, Color c);
00064 Image *img_read(char *fname);
00065 void  img_write(Image *i, char *fname, int cflag);
00066 
00067 void  img_puti(Image *i, int u, int v, int c);
00068 int   img_geti(Image *i, int u, int v);
00069 
00070 void  img_putc(Image *i, int u, int v, Color c);
00071 Color img_getc(Image *i, int u, int v);
00072 
00073 void img_free(Image *i);
00074 
00075 void  cmap_read(CMap *m, int maplength, int fd);
00076 
00077 #endif

Generated on Tue Jan 22 17:07:29 2008 for MUAN by  doxygen 1.4.7