ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/resolu.h
Revision: 2.7
Committed: Mon Jun 30 19:04:29 2003 UTC (20 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.6: +1 -2 lines
Log Message:
Removed stdio.h includes from calcomp.h, resolu.h, and color.h

File Contents

# User Rev Content
1 greg 2.7 /* RCSid $Id: resolu.h,v 2.6 2003/06/27 06:53:21 greg Exp $ */
2 greg 1.1 /*
3     * Definitions for resolution line in image file.
4     *
5 greg 2.3 * Include after <stdio.h>, <string.h>, and <time.h>
6     *
7 greg 1.1 * True image orientation is defined by an xy coordinate system
8     * whose origin is at the lower left corner of the image, with
9     * x increasing to the right and y increasing in the upward direction.
10     * This true orientation is independent of how the pixels are actually
11     * ordered in the file, which is indicated by the resolution line.
12     * This line is of the form "{+-}{XY} xyres {+-}{YX} yxres\n".
13     * A typical line for a 1024x600 image might be "-Y 600 +X 1024\n",
14     * indicating that the scanlines are in English text order (PIXSTANDARD).
15     */
16 schorsch 2.5 #ifndef _RAD_RESOLU_H_
17     #define _RAD_RESOLU_H_
18 greg 2.3 #ifdef __cplusplus
19     extern "C" {
20     #endif
21    
22 greg 1.1 /* flags for scanline ordering */
23     #define XDECR 1
24     #define YDECR 2
25     #define YMAJOR 4
26    
27     /* standard scanline ordering */
28     #define PIXSTANDARD (YMAJOR|YDECR)
29     #define PIXSTDFMT "-Y %d +X %d\n"
30    
31     /* structure for image dimensions */
32     typedef struct {
33 greg 2.3 int rt; /* orientation (from flags above) */
34 greg 1.1 int xr, yr; /* x and y resolution */
35     } RESOLU;
36    
37     /* macros to get scanline length and number */
38 greg 2.3 #define scanlen(rs) ((rs)->rt & YMAJOR ? (rs)->xr : (rs)->yr)
39     #define numscans(rs) ((rs)->rt & YMAJOR ? (rs)->yr : (rs)->xr)
40 greg 1.1
41     /* resolution string buffer and its size */
42     #define RESOLU_BUFLEN 32
43     extern char resolu_buf[RESOLU_BUFLEN];
44    
45     /* macros for reading/writing resolution struct */
46     #define fputsresolu(rs,fp) fputs(resolu2str(resolu_buf,rs),fp)
47     #define fgetsresolu(rs,fp) str2resolu(rs, \
48     fgets(resolu_buf,RESOLU_BUFLEN,fp))
49    
50     /* reading/writing of standard ordering */
51     #define fprtresolu(sl,ns,fp) fprintf(fp,PIXSTDFMT,ns,sl)
52     #define fscnresolu(sl,ns,fp) (fscanf(fp,PIXSTDFMT,ns,sl)==2)
53    
54 greg 2.3 /* defined in resolu.c */
55     extern void fputresolu(int ord, int sl, int ns, FILE *fp);
56     extern int fgetresolu(int *sl, int *ns, FILE *fp);
57     extern char * resolu2str(char *buf, RESOLU *rp);
58     extern int str2resolu(RESOLU *rp, char *buf);
59     /* defined in header.c */
60     extern void newheader(char *t, FILE *fp);
61     extern int isheadid(char *s);
62     extern int headidval(char *r, char *s);
63     extern int dateval(time_t *t, char *s);
64     extern int isdate(char *s);
65     extern void fputdate(time_t t, FILE *fp);
66     extern void fputnow(FILE *fp);
67     extern void printargs(int ac, char **av, FILE *fp);
68     extern int isformat(char *s);
69     extern int formatval(char *r, char *s);
70     extern void fputformat(char *s, FILE *fp);
71     extern int getheader(FILE *fp, int (*f)(), char *p);
72     extern int globmatch(char *pat, char *str);
73     extern int checkheader(FILE *fin, char *fmt, FILE *fout);
74    
75     #ifdef __cplusplus
76     }
77     #endif
78 schorsch 2.5 #endif /* _RAD_RESOLU_H_ */
79