#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#define MAGIC 0x1234567a
#define MAGIC_SWAP 0xa7654321 // Swapped magic number
namespace HDK_Sample {
typedef struct {
unsigned int magic;
unsigned int xres;
unsigned int yres;
unsigned int model;
} IMG_SampleHeader;
public:
unsigned &
y)
const override;
};
}
using namespace HDK_Sample;
const char *
{
return "Sample";
}
const char *
{
return "Sample HDK Format";
}
const char *
{
return "HDK Sample image format. Not very useful";
}
const char *
{
return "smp";
}
IMG_File *
{
}
int
{
static const char *extensions[] = { "smp", ".SMP", 0 };
}
int
{
}
void
{
x = UINT_MAX;
y = UINT_MAX;
}
{
myByteSwap = 0;
}
{
}
int
{
return readHeader();
}
static const char *theTextureOptions[] = {
"camera:orthowidth",
"camera:zoom",
"camera:projection",
"image:crop",
"image:window",
"image:pixelaspect",
"image:samples",
"space:world",
NULL
};
static void
writeTextureOption(
const char *token,
const char *
value)
{
}
int
{
myStat = stat;
if (!writeHeader())
return 0;
for (int i = 0; theTextureOptions[i]; ++i)
{
if (value)
writeTextureOption(theTextureOptions[i], value);
}
return true;
}
int
{
if (myOS) myOS->flush();
return 1;
}
static inline void
{
}
int
IMG_Sample::readHeader()
{
return 0;
{
myByteSwap = 1;
swapHeader(header);
}
return 0;
myStat.setResolution(header.
xres, header.
yres);
plane = myStat.addDefaultPlane();
return 1;
}
int
IMG_Sample::writeHeader()
{
header.
xres = myStat.getXres();
header.
yres = myStat.getYres();
header.
model = myStat.getPlane()->getColorModel();
header.
data = myStat.getPlane()->getDataType();
return 0;
return 1;
}
int
{
int nbytes;
if (y >= myStat.getYres()) return 0;
nbytes = myStat.bytesPerScanline();
if (!readBytes((char *)buf, nbytes))
return 0;
if (myByteSwap)
{
switch (myStat.getPlane()->getDataType())
{
break;
break;
break;
default:
break;
}
}
return 1;
}
int
{
return (!myOS->write((char *)buf, myStat.bytesPerScanline())) ? 0 : 1;
}
void
{
}