#define XRES 320 // Image X resolution
#define YRES 240 // Image Y resolution
#define TXRES 16 // Tile X resolution
#define TYRES 16 // Tile Y resolution
};
};
#define NPLANES (sizeof(thePlanes)/sizeof(PlaneDef))
static void *
buildTiles()
{
{
int words = pixels * IMGvectorSize(thePlanes[i].myColorModel);
bytes += words * IMGbyteSize(thePlanes[i].myFormat);
}
void *tdata = ::malloc(bytes);
char *
ptr = (
char *)tdata;
{
unsigned short *sdata;
unsigned char *cdata;
unsigned int *idata;
float *fdata;
int words = pixels * IMGvectorSize(thePlanes[i].myColorModel);
cdata = (unsigned char *)ptr;
sdata = (unsigned short *)ptr;
idata = (unsigned int *)ptr;
fdata = (float *)ptr;
for (
int c = 0;
c < words;
c++)
{
switch (thePlanes[i].myFormat)
{
case IMG_UINT: *idata++ = 0x84123456;
break;
default: *fdata++ = 0.763;
}
}
ptr += words*IMGbyteSize(thePlanes[i].myFormat);
}
return tdata;
}
static void
{
const char *colon = strchr(hostname, ':');
if (colon)
{
int len = colon - hostname;
colon++;
}
else
{
colon = hostname;
}
}
static void
{
{
auto finfo = UTmakeUnique<IMG_TileOptions>();
finfo->setPlaneInfo("ip", thePlanes[i].myName,
0, thePlanes[i].myFormat, thePlanes[i].myColorModel);
if (host) finfo->setFormatOption("sockethost", host);
if (port) finfo->setFormatOption("socketport", port);
flist.
append(std::move(finfo));
}
{
::fprintf(stderr,
"Error opening tile device\n");
::exit(1);
}
}
static void
writeTile(
IMG_TileDevice *dev,
void *tdata,
int tx0,
int tx1,
int ty0,
int ty1)
{
if (!dev->
writeTile(tdata, tx0, tx1, ty0, ty1))
{
::fprintf(stderr,
"Error writing data: %d %d %d %d\n",
tx0, tx1, ty0, ty1);
::exit(1);
}
}
int
{
#ifdef _WIN32
struct local {
creator(int middle)
{
}
};
#endif
splitHostPort(host, port, args.
argp(
's'));
sendPlaneDefinitions(dev, host, port);
void *tdata = buildTiles();
::writeTile(dev, tdata,
ty,
SYSmin(ty+TYRES, YRES)-1);
free(tdata);
return 0;
}