]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/jpg/imagefile.h
Libflac: Tell it that we have stdint.h so it finds SIZE_MAX
[plan9front.git] / sys / src / cmd / jpg / imagefile.h
1 typedef struct Rawimage Rawimage;
2
3 struct Rawimage
4 {
5         Rectangle       r;
6         uchar   *cmap;
7         int             cmaplen;
8         int             nchans;
9         uchar   *chans[4];
10         int             chandesc;
11         int             chanlen;
12
13         int             fields;         /* defined by format */
14         int             gifflags;       /* gif only; graphics control extension flag word */
15         int             gifdelay;       /* gif only; graphics control extension delay in cs */
16         int             giftrindex;     /* gif only; graphics control extension transparency index */
17         int             gifloopcount;   /* number of times to loop in animation; 0 means forever */
18 };
19
20 enum
21 {
22         /* Channel descriptors */
23         CRGB    = 0,    /* three channels, no map */
24         CYCbCr  = 1,    /* three channels, no map, level-shifted 601 color space */
25         CY      = 2,    /* one channel, luminance */
26         CRGB1   = 3,    /* one channel, map present */
27         CRGBV   = 4,    /* one channel, map is RGBV, understood */
28         CRGB24  = 5,    /* one channel in correct data order for loadimage(RGB24) */
29         CRGBA32 = 6,    /* one channel in correct data order for loadimage(RGBA32) */
30         CYA16   = 7,    /* one channel in correct data order for loadimage(Grey8+Alpha8) */
31         CRGBVA16= 8,    /* one channel in correct data order for loadimage(CMAP8+Alpha8) */
32
33         /* GIF flags */
34         TRANSP  = 1,
35         INPUT   = 2,
36         DISPMASK = 7<<2
37 };
38
39
40 enum{   /* PNG flags */
41         II_GAMMA =      1 << 0,
42         II_COMMENT =    1 << 1,
43 };
44
45 typedef struct ImageInfo {
46         ulong   fields_set;
47         double  gamma;
48         char    *comment;
49 } ImageInfo;
50
51
52 Rawimage**      readjpg(int, int);
53 Rawimage**      Breadjpg(Biobuf*, int);
54 Rawimage**      readpng(int, int);
55 Rawimage**      Breadpng(Biobuf*, int);
56 Rawimage**      readtif(int, int);
57 Rawimage**      Breadtif(Biobuf*, int);
58 Rawimage**      readgif(int, int, int);
59 Rawimage**      readpixmap(int, int);
60 Rawimage*       torgbv(Rawimage*, int);
61 Rawimage*       totruecolor(Rawimage*, int);
62 int             writerawimage(int, Rawimage*);
63 void*           _remaperror(char*, ...);
64
65 typedef struct Memimage Memimage;       /* avoid necessity to include memdraw.h */
66
67 char*           startgif(Biobuf*, Image*, int);
68 char*           writegif(Biobuf*, Image*, char*, int, int);
69 void            endgif(Biobuf*);
70 char*           memstartgif(Biobuf*, Memimage*, int);
71 char*           memwritegif(Biobuf*, Memimage*, char*, int, int);
72 void            memendgif(Biobuf*);
73 Image*          onechan(Image*);
74 Memimage*       memonechan(Memimage*);
75
76 char*           writeppm(Biobuf*, Image*, char*, int);
77 char*           memwriteppm(Biobuf*, Memimage*, char*, int);
78 char*           writejpg(Biobuf*, Image*, char*, int, int);
79 char*           memwritejpg(Biobuf*, Memimage*, char*, int, int);
80 Image*          multichan(Image*);
81 Memimage*       memmultichan(Memimage*);
82
83 char*           memwritepng(Biobuf*, Memimage*, ImageInfo*);
84
85 char*           writetif(Biobuf*, Image*, char*, int, int);
86 char*           memwritetif(Biobuf*, Memimage*, char*, int, int);