plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

imagefile.h (2295B)


      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 *b, int);
     54 Rawimage**	readpng(int, int);
     55 Rawimage**	Breadpng(Biobuf *b, int);
     56 Rawimage**	readgif(int, int);
     57 Rawimage**	readpixmap(int, int);
     58 Rawimage*	torgbv(Rawimage*, int);
     59 Rawimage*	totruecolor(Rawimage*, int);
     60 int		writerawimage(int, Rawimage*);
     61 void*		_remaperror(char*, ...);
     62 
     63 #ifndef _MEMDRAW_H_
     64 typedef struct Memimage Memimage;	/* avoid necessity to include memdraw.h */
     65 #endif
     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*);
     77 char*		memwriteppm(Biobuf*, Memimage*, char*);
     78 Image*		multichan(Image*);
     79 Memimage*	memmultichan(Memimage*);
     80 
     81 char*		memwritepng(Biobuf*, Memimage*, ImageInfo*);
     82 extern int drawlog2[];