46 #define XRES 320 // Image X resolution
47 #define YRES 240 // Image Y resolution
48 #define TXRES 16 // Tile X resolution
49 #define TYRES 16 // Tile Y resolution
63 #define NPLANES (sizeof(thePlanes)/sizeof(PlaneDef))
70 for (
int i = 0; i <
NPLANES; i++)
72 int words = pixels * IMGvectorSize(thePlanes[i].myColorModel);
73 bytes += words * IMGbyteSize(thePlanes[i].myFormat);
76 void *tdata = ::malloc(bytes);
77 char *
ptr = (
char *)tdata;
78 for (
int i = 0; i <
NPLANES; i++)
80 unsigned short *sdata;
85 int words = pixels * IMGvectorSize(thePlanes[i].myColorModel);
87 cdata = (
unsigned char *)ptr;
88 sdata = (
unsigned short *)ptr;
89 idata = (
unsigned int *)ptr;
93 for (
int c = 0;
c < words;
c++)
95 switch (thePlanes[i].myFormat)
99 case IMG_UINT: *idata++ = 0x84123456;
break;
100 default: *fdata++ = 0.763;
104 ptr += words*IMGbyteSize(thePlanes[i].myFormat);
113 const char *colon = strchr(hostname,
':');
116 int len = colon - hostname;
134 for (
int i = 0; i <
NPLANES; i++)
136 auto finfo = UTmakeUnique<IMG_TileOptions>();
138 finfo->setPlaneInfo(
"ip", thePlanes[i].myName,
139 0, thePlanes[i].myFormat, thePlanes[i].myColorModel);
146 if (host) finfo->setFormatOption(
"sockethost", host);
147 if (port) finfo->setFormatOption(
"socketport", port);
149 flist.
append(std::move(finfo));
154 ::fprintf(stderr,
"Error opening tile device\n");
160 writeTile(
IMG_TileDevice *dev,
void *tdata,
int tx0,
int tx1,
int ty0,
int ty1)
162 if (!dev->
writeTile(tdata, tx0, tx1, ty0, ty1))
164 ::fprintf(stderr,
"Error writing data: %d %d %d %d\n",
192 splitHostPort(host, port, args.
argp(
's'));
196 sendPlaneDefinitions(dev, host, port);
198 void *tdata = buildTiles();
201 ::writeTile(dev, tdata,
static IMG_TileDevice * newDevice(const char *filename, const UT_Options *options=NULL)
int theMain(int argc, char *argv[])
virtual int openMulti(IMG_TileOptionList &flist, int xres, int yres, int tile_width, int tile_height, fpreal aspect)
void stripOptions(const char *options)
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
static void setMPlayDevCreator(IMG_TileDevice *(*creator)(int))
void harden()
Take shallow copy and make it deep.
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
virtual int writeTile(const void *data, unsigned x0, unsigned x1, unsigned y0, unsigned y1)=0
**If you just want to fire and args
const char * argp(int opt, int which=0) const
void append(UT_UniquePtr< IMG_TileOptions > opt)
void initialize(int argc, const char *const argv[])
IMG_ColorModel myColorModel