ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/idmap.h
Revision: 2.3
Committed: Fri Jul 26 16:18:07 2019 UTC (4 years, 9 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 2.2: +1 -1 lines
State: FILE REMOVED
Log Message:
Moved rcode map support to common directory

File Contents

# User Rev Content
1 greg 2.3 /* RCSid $Id: idmap.h,v 2.2 2019/07/23 17:20:20 greg Exp $ */
2 greg 2.1 /*
3     * Definitions and delcarations for loading identifier maps
4     *
5     * Include after stdio.h
6     * Includes resolu.h
7     */
8    
9     #ifndef _RAD_IDMAP_H_
10     #define _RAD_IDMAP_H_
11    
12     #include "resolu.h"
13    
14     #ifdef __cplusplus
15     extern "C" {
16     #endif
17    
18     #define IDMAP8FMT "8-bit_indexed_name"
19     #define IDMAP16FMT "16-bit_indexed_name"
20     #define IDMAP24FMT "24-bit_indexed_name"
21     #define IDMAPFMT "*-bit_indexed_name"
22    
23     #define HF_HEADOUT 0x2
24     #define HF_RESOUT 0x8
25    
26     /* Structure for reading identifier maps */
27     typedef struct {
28     FILE *finp; /* input file pointer */
29     long dstart; /* start of data */
30     long curpos; /* current input position */
31     RESOLU res; /* input resolution */
32     int bytespi; /* 1, 2, or 3 bytes per index */
33     int nids; /* ID count */
34     int *idoffset; /* offsets to identifiers */
35     char idtable[1]; /* nul-terminated ID strings */
36     } IDMAP;
37    
38     /* Get indexed ID */
39     #define mapID(mp,i) ( (i) >= (mp)->nids ? (char *)NULL : \
40     (mp)->idtable+(mp)->idoffset[i] )
41    
42     /* Open ID map file for reading, copying info to stdout based on hflags */
43     extern IDMAP *idmap_ropen(const char *fname, int hflags);
44    
45 greg 2.2 /* Read the next ID index from input */
46     extern int idmap_next_i(IDMAP *idmp);
47    
48 greg 2.1 /* Read the next ID from input */
49     extern const char *idmap_next(IDMAP *idmp);
50    
51     /* Seek to a specific pixel position in ID map */
52     extern int idmap_seek(IDMAP *idmp, int x, int y);
53    
54     /* Read ID at a pixel position */
55     extern const char *idmap_pix(IDMAP *idmp, int x, int y);
56    
57     /* Close ID map and free resources */
58     extern void idmap_close(IDMAP *idmp);
59    
60     #ifdef __cplusplus
61     }
62     #endif
63     #endif /* _RAD_IDMAP_H_ */