static Boln writeUByte (tkimg_MFile *handle, UByte b) { UByte buf[1]; buf[0] = b; if (1 != tkimg_Write (handle, (CONST char *)buf, 1)) return FALSE; return TRUE; }
static Boln writeByte (tkimg_MFile *handle, Byte b) { Byte buf[1]; buf[0] = b; if (1 != tkimg_Write (handle, buf, 1)) return FALSE; return TRUE; }
static Boln writeShort (tkimg_MFile *handle, Short s) { Byte buf[2]; buf[0] = s; buf[1] = s >> 8; if (2 != tkimg_Write (handle, buf, 2)) return FALSE; return TRUE; }
static Boln writePixel (tkimg_MFile *handle, UByte b, UByte g, UByte r, UByte m, Int nchan) { UByte buf[4]; buf[0] = b; buf[1] = g; buf[2] = r; buf[3] = m; if (nchan != tkimg_Write (handle, (CONST char *)buf, nchan)) return FALSE; return TRUE; }
static Boln writeHeader (tkimg_MFile *handle, RAWHEADER *th) { char buf[1024]; sprintf (buf, strMagic, "RAW"); tkimg_Write (handle, buf, strlen (buf)); sprintf (buf, strWidth, th->width); tkimg_Write (handle, buf, strlen (buf)); sprintf (buf, strHeight, th->height); tkimg_Write (handle, buf, strlen (buf)); sprintf (buf, strNumChan, th->nChans); tkimg_Write (handle, buf, strlen (buf)); sprintf (buf, strByteOrder, isIntel()? strIntel: strMotorola); tkimg_Write (handle, buf, strlen (buf)); sprintf (buf, strScanOrder, th->scanOrder == TOP_DOWN? strTopDown: strBottomUp); tkimg_Write (handle, buf, strlen (buf)); sprintf (buf, strPixelType, (th->pixelType == TYPE_FLOAT? strFloat: (th->pixelType == TYPE_USHORT? strUShort: (th->pixelType == TYPE_UBYTE? strUByte: strUnknown)))); tkimg_Write (handle, buf, strlen (buf)); return TRUE; }