31 |
|
|
32 |
|
#include "tiff.h" /* for int32 */ |
33 |
|
#include "rtio.h" |
34 |
+ |
#include "color.h" |
35 |
|
#include "resolu.h" |
36 |
|
|
37 |
|
#define MAXLINE 2048 |
58 |
|
{ |
59 |
|
fputs(HDRSTR, fp); |
60 |
|
fputs(s, fp); |
61 |
< |
putc('\n', fp); |
61 |
> |
fputc('\n', fp); |
62 |
|
} |
63 |
|
|
64 |
|
|
210 |
|
FILE *fp |
211 |
|
) |
212 |
|
{ |
213 |
+ |
int align = 0; |
214 |
+ |
|
215 |
|
fputs(FMTSTR, fp); |
216 |
|
fputs(s, fp); |
217 |
< |
putc('\n', fp); |
217 |
> |
/* pad to align binary type for mmap() */ |
218 |
> |
if (globmatch(PICFMT, s)) |
219 |
> |
align = 0; /* not needed for picture data */ |
220 |
> |
else if (!strncmp("float", s, 5)) |
221 |
> |
align = sizeof(float); |
222 |
> |
else if (!strncmp("double", s, 6)) |
223 |
> |
align = sizeof(double); |
224 |
> |
else if (!strncmp("16-bit", s, 6)) |
225 |
> |
align = 2; |
226 |
> |
else if (!strncmp("32-bit", s, 6)) |
227 |
> |
align = 4; |
228 |
> |
else if (!strncmp("64-bit", s, 6)) |
229 |
> |
align = 8; |
230 |
> |
if (align) { |
231 |
> |
long pos = ftell(fp); |
232 |
> |
if (pos >= 0) { |
233 |
> |
pos = (pos + 2) % align; |
234 |
> |
if (pos) align -= pos; |
235 |
> |
else align = 0; |
236 |
> |
} else |
237 |
> |
align = 0; |
238 |
> |
} |
239 |
> |
while (align-- > 0) |
240 |
> |
putc(' ', fp); |
241 |
> |
fputc('\n', fp); |
242 |
|
} |
243 |
|
|
244 |
|
|