/* * Template program for generating an image * */ #include "VisXV4.h" /* VisionX structure include file */ #include "Vutil.h" /* VisionX utility header files */ VXparam_t par[] = /* command line structure */ { { "s=", 0, " image size, vgtemp: create im "}, { "of=", 0, " output file "}, { 0, 0, 0} }; #define SVAL par[0].val #define OUTFILE par[1].val int icomp ( VisXimage_t * ); int main(int argc, char** argv) { Vfstruct (im); int i,s; float bbx[6]; VXparse(&argc, &argv, par); /* parse the command line */ for (i = 0; i<6; i++ ) { /* set up bounding box */ bbx[i] = 0.0; } s = 4; if (SVAL) s = atoi (SVAL); bbx[1] = bbx[3] = s; Vfnewim(&im, VX_PBYTE, bbx, 1); icomp ( &im ); Vfwrite(&im, OUTFILE); exit(0); } /* example function ... distance from origin mod 256 */ int icomp ( VisXimage_t *im ) { int x, y; for ( y= im->ylo; y <= im->yhi; y++) { for ( x= im->xlo; x <= im->xhi; x++) { im->u[y][x] = sqrt ( x * x + y * y ); } } return (1); }