Initial revision
[imager.git] / datatypes.h
CommitLineData
02d1d628
AMH
1#ifndef _DATATYPES_H_
2#define _DATATYPES_H_
3
4#include "io.h"
5
6#define MAXCHANNELS 4
7
8typedef struct { unsigned char gray_color; } gray_color;
9typedef struct { unsigned char r,g,b; } rgb_color;
10typedef struct { unsigned char r,g,b,a; } rgba_color;
11typedef struct { unsigned char c,m,y,k; } cmyk_color;
12
13typedef int undef_int; /* special value to put in typemaps to retun undef on 0 and 1 on 1 */
14
15typedef union {
16 gray_color gray;
17 rgb_color rgb;
18 rgba_color rgba;
19 cmyk_color cmyk;
20 unsigned char channel[MAXCHANNELS];
21 unsigned int ui;
22} i_color;
23
24
25struct _i_img {
26 int channels;
27 int xsize,ysize,bytes;
28 unsigned char *data;
29 unsigned int ch_mask;
30
31 int (*i_f_ppix) (struct _i_img *,int,int,i_color *);
32 int (*i_f_gpix) (struct _i_img *,int,int,i_color *);
33 void *ext_data;
34};
35
36typedef struct _i_img i_img;
37
38/* used for palette indices in some internal code (which might be
39 exposed at some point
40*/
41typedef unsigned char i_palidx;
42
43