]> git.sur5r.net Git - iec16022/blob - image.h
Imported Upstream version 0.2
[iec16022] / image.h
1 /** 
2  *
3  * Image handling tools, (c) AJK 2001-2005
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  */ 
20
21 #ifndef __IMAGE_H
22 #define __IMAGE_H
23
24 typedef unsigned int Colour;    // RGB value
25
26 // Image object
27 typedef struct
28 {
29    int      W,                  // width
30             L,                  // Line length in Image (W+1)
31             H;                  // height
32    unsigned char *Image;        // image array, one byte per pixel
33    int      C;                  // colours (can be non power of 2, max 256)
34    Colour  *Colour;             // colour map (must have entry for each colour)
35 }
36 Image;
37
38 // macros and functions
39
40 #define ImagePixel(i,x,y)       ((i)->Image[1+(i)->L*(y)+(x)])
41
42 Image *ImageNew(int w,int h,int c);             // create a new blank image
43 void ImageFree(Image* i);                       // free an image
44 void ImageWriteGif(Image *i,int fh,int back,int trans,char *comment);
45 void ImageWritePNG(Image *i,int fh,int back,int trans,char *comment);
46 void ImageText(Image *i,int x,int y,int c,char *text);  // write 8x8 text
47 void ImageSmall(Image *i,int x,int y,int c,char *text); // write 4x6 text
48 void ImageRect(Image *i,int x,int y,int w,int h,int c); // fill a box
49 #define ImageWrite ImageWritePNG        // default
50
51 #endif /* __IMAGE_H */