1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
< |
|
3 |
< |
/* SCCSid "$SunId$ LBL" */ |
4 |
< |
|
1 |
> |
/* RCSid $Id$ */ |
2 |
|
/* |
3 |
|
* Definitions for resolution line in image file. |
4 |
|
* |
5 |
+ |
* Include after <stdio.h> |
6 |
+ |
* |
7 |
|
* 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. |
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 |
+ |
#ifndef _RAD_RESOLU_H_ |
17 |
+ |
#define _RAD_RESOLU_H_ |
18 |
|
|
19 |
+ |
#ifdef __cplusplus |
20 |
+ |
extern "C" { |
21 |
+ |
#endif |
22 |
+ |
|
23 |
|
/* flags for scanline ordering */ |
24 |
|
#define XDECR 1 |
25 |
|
#define YDECR 2 |
27 |
|
|
28 |
|
/* standard scanline ordering */ |
29 |
|
#define PIXSTANDARD (YMAJOR|YDECR) |
30 |
< |
#define PIXSTDFMT "-Y %d +X %d\n" |
30 |
> |
#define PIXSTDFMT "-Y %8d +X %8d\n" |
31 |
|
|
32 |
|
/* structure for image dimensions */ |
33 |
|
typedef struct { |
34 |
< |
int or; /* orientation (from flags above) */ |
34 |
> |
int rt; /* orientation (from flags above) */ |
35 |
|
int xr, yr; /* x and y resolution */ |
36 |
|
} RESOLU; |
37 |
|
|
38 |
|
/* macros to get scanline length and number */ |
39 |
< |
#define scanlen(rs) ((rs)->or & YMAJOR ? (rs)->xr : (rs)->yr) |
40 |
< |
#define numscans(rs) ((rs)->or & YMAJOR ? (rs)->yr : (rs)->xr) |
39 |
> |
#define scanlen(rs) ((rs)->rt & YMAJOR ? (rs)->xr : (rs)->yr) |
40 |
> |
#define numscans(rs) ((rs)->rt & YMAJOR ? (rs)->yr : (rs)->xr) |
41 |
|
|
42 |
|
/* resolution string buffer and its size */ |
43 |
|
#define RESOLU_BUFLEN 32 |
50 |
|
|
51 |
|
/* reading/writing of standard ordering */ |
52 |
|
#define fprtresolu(sl,ns,fp) fprintf(fp,PIXSTDFMT,ns,sl) |
53 |
< |
#define fscnresolu(sl,ns,fp) (fscanf(fp,PIXSTDFMT,ns,sl)==2) |
53 |
> |
#define fscnresolu(sl,ns,fp) (fgetresolu(sl,ns,fp)==PIXSTANDARD) |
54 |
|
|
55 |
< |
extern char *fgets(), *resolu2str(); |
55 |
> |
/* defined in resolu.c */ |
56 |
> |
extern void fputresolu(int ord, int sl, int ns, FILE *fp); |
57 |
> |
extern int fgetresolu(int *sl, int *ns, FILE *fp); |
58 |
> |
extern char * resolu2str(char *buf, RESOLU *rp); |
59 |
> |
extern int str2resolu(RESOLU *rp, char *buf); |
60 |
> |
|
61 |
> |
#ifdef __cplusplus |
62 |
> |
} |
63 |
> |
#endif |
64 |
> |
#endif /* _RAD_RESOLU_H_ */ |
65 |
> |
|