Located in affine/pixNtiff/ are several C files that are used to read and write Alias's PIX, TIFF, and TGA file formats. Included is also the ability to write X Windows bitmaps or read Pixar's zfile format.
Each fully supported format has two self-named C files prefixed with a 'r' for reading and a 'w' for writing. TIFF for example has rtiff.c and wtiff.c with the functions ReadTiff() and WriteTiff() respectively. Each 'r' and 'w' file has an associated header file with a ".h" filename extension. Refer to these headers for the main function exported by its associated C file.
The writing functions rely on a data structure called simply BITMAP defined in the header affine/pixNtiff/bitmap.h with the following code:
typedef struct _BITMAP {
unsigned int xres;
unsigned int yres;
unsigned int rowbytes; /* for an RGB image rowbytes = 3*xres */
/* rowbytes is needed incase padding is needed */
int pixelsize; /* number of bits per pixel */
PBITS pbits;
} BITMAP;
typedef BITMAP *PBITMAP;
The field pixelsize is the number of bits needed to store a pixel's
color. This field has a special meaning when given the value
BITMAP_IEEE (defined in bitmap.h as -32) and indicates to the function
WriteTiff() in wtiff.c to treat the bitmap data as an array of single
precision IEEE floats.
Of the supported formats in the Affine Toolkit, only TIFF supports
IEEE floats.
So far the code in affine/pixNtiff/ has avoided issues with the processor's endedness -- Actually I noticed that the rz.c code slipped by with a dependence on endedness. I'll fix and test it later. -- A flag called LITTLE_ENDIAN is used by parts of the Affine Toolkit such as code in affine/ribdump. For information on big-endian and little-endian refer to the section Ten Little Endians for a brief overview of what the term "endian" means.
The field rowbytes is the number of bits rounded up to the nearest number of bytes that can store a full row of pixels. This field is so far only used by the wX.c code because only the WriteX() function handles writing images with a pixel row size not divisible by 8 bits.