• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *   SGI image file format library definitions for CUPS.
3  *
4  *   Copyright 2007-2011 by Apple Inc.
5  *   Copyright 1993-2005 by Easy Software Products.
6  *
7  *   These coded instructions, statements, and computer programs are the
8  *   property of Apple Inc. and are protected by Federal copyright
9  *   law.  Distribution and use rights are outlined in the file "COPYING"
10  *   which should have been included with this file.
11  */
12 
13 #ifndef _SGI_H_
14 #  define _SGI_H_
15 
16 #  include <stdio.h>
17 #  include <stdlib.h>
18 #  include <string.h>
19 
20 #  ifdef __cplusplus
21 extern "C" {
22 #  endif
23 
24 
25 /*
26  * Constants...
27  */
28 
29 #  define SGI_MAGIC	474	/* Magic number in image file */
30 
31 #  define SGI_READ	0	/* Read from an SGI image file */
32 #  define SGI_WRITE	1	/* Write to an SGI image file */
33 
34 #  define SGI_COMP_NONE	0	/* No compression */
35 #  define SGI_COMP_RLE	1	/* Run-length encoding */
36 #  define SGI_COMP_ARLE	2	/* Agressive run-length encoding */
37 
38 
39 /*
40  * Image structure...
41  */
42 
43 typedef struct
44 {
45   FILE			*file;		/* Image file */
46   int			mode,		/* File open mode */
47 			bpp,		/* Bytes per pixel/channel */
48 			comp;		/* Compression */
49   unsigned short	xsize,		/* Width in pixels */
50 			ysize,		/* Height in pixels */
51 			zsize;		/* Number of channels */
52   long			firstrow,	/* File offset for first row */
53 			nextrow,	/* File offset for next row */
54 			**table,	/* Offset table for compression */
55 			**length;	/* Length table for compression */
56   unsigned short	*arle_row;	/* Advanced RLE compression buffer */
57   long			arle_offset,	/* Advanced RLE buffer offset */
58 			arle_length;	/* Advanced RLE buffer length */
59 } sgi_t;
60 
61 
62 /*
63  * Prototypes...
64  */
65 
66 extern int	sgiClose(sgi_t *sgip);
67 extern int	sgiGetRow(sgi_t *sgip, unsigned short *row, int y, int z);
68 extern sgi_t	*sgiOpen(const char *filename, int mode, int comp, int bpp,
69 		         int xsize, int ysize, int zsize);
70 extern sgi_t	*sgiOpenFile(FILE *file, int mode, int comp, int bpp,
71 		             int xsize, int ysize, int zsize);
72 extern int	sgiPutRow(sgi_t *sgip, unsigned short *row, int y, int z);
73 
74 #  ifdef __cplusplus
75 }
76 #  endif
77 #endif /* !_SGI_H_ */
78 
79