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