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