125 |
|
} |
126 |
|
|
127 |
|
|
128 |
+ |
static double inpaspect; /* aspect ratio of input picture */ |
129 |
+ |
|
130 |
+ |
static |
131 |
+ |
headaspect(s) /* check string for aspect ratio */ |
132 |
+ |
char *s; |
133 |
+ |
{ |
134 |
+ |
if (isaspect(s)) |
135 |
+ |
inpaspect *= aspectval(s); |
136 |
+ |
} |
137 |
+ |
|
138 |
+ |
|
139 |
|
DATARRAY * |
140 |
|
getpict(pname) /* get picture pname */ |
141 |
|
char *pname; |
169 |
|
error(SYSTEM, errmsg); |
170 |
|
} |
171 |
|
/* get dimensions */ |
172 |
< |
getheader(fp, NULL); |
172 |
> |
inpaspect = 1.0; |
173 |
> |
getheader(fp, headaspect); |
174 |
|
if (fgetresolu(&width, &height, fp) != (YMAJOR|YDECR)) |
175 |
|
goto readerr; |
176 |
|
for (i = 0; i < 3; i++) { |
179 |
|
pp[i].dim[1].ne = height; |
180 |
|
pp[i].dim[0].org = |
181 |
|
pp[i].dim[1].org = 0.0; |
182 |
< |
if (width <= height) { |
182 |
> |
if (width <= height*inpaspect) { |
183 |
|
pp[i].dim[0].siz = 1.0; |
184 |
< |
pp[i].dim[1].siz = (double)height/width; |
184 |
> |
pp[i].dim[1].siz = inpaspect*(double)height/width; |
185 |
|
} else { |
186 |
< |
pp[i].dim[0].siz = (double)width/height; |
186 |
> |
pp[i].dim[0].siz = (double)width/height/inpaspect; |
187 |
|
pp[i].dim[1].siz = 1.0; |
188 |
|
} |
189 |
|
pp[i].arr = (DATATYPE *)malloc(width*height*sizeof(DATATYPE)); |