16 #define TACHYON_INTERNAL 1 22 int writepsd48(
char *name,
int xres,
int yres,
unsigned char *imgdata) {
27 const char *sig =
"8BPS";
28 const char ver[] = { 0, 1, 0, 0, 0, 0, 0, 0 };
29 const char chn[] = { 0, 3 };
30 const char mod[] = { 0, 16, 0, 3 };
31 const char hdr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
33 ofp=fopen(name,
"wb");
38 width[0] = (xres >> 24) & 0xff;
39 width[1] = (xres >> 16) & 0xff;
40 width[2] = (xres >> 8) & 0xff;
41 width[3] = xres & 0xff;
43 height[0] = (yres >> 24) & 0xff;
44 height[1] = (yres >> 16) & 0xff;
45 height[2] = (yres >> 8) & 0xff;
46 height[3] = yres & 0xff;
48 fwrite(sig, 4, 1, ofp);
49 fwrite(ver, 8, 1, ofp);
50 fwrite(chn, 2, 1, ofp);
51 fwrite(height, 4, 1, ofp);
52 fwrite(width, 4, 1, ofp);
53 fwrite(mod, 4, 1, ofp);
54 fwrite(hdr, 14, 1, ofp);
57 int paddr = xres * yres * 2 * p;
58 for (y=0; y<yres; y++) {
59 fwrite(&imgdata[paddr + (yres - y - 1)*xres*2], 1, 2*xres, ofp);
int writepsd48(char *name, int xres, int yres, unsigned char *imgdata)
Tachyon cross-platform timers, special math function wrappers, and RNGs.
#define IMAGENOERR
no error
Tachyon public API function prototypes and declarations used to drive the ray tracing engine...
#define IMAGEBADFILE
can't find or can't open the file