yi[0] = 280.; ye[0] = 220.;
yi[0] = 220.; ye[0] = 280.;
    x20( String[] args ) {	double x[] = new double[XDIM];	double y[] = new double[YDIM];	double z[][]= new double[XDIM][YDIM];	double r[][];	double xi[] = new double[1];	double yi[] = new double[1];	double xe[] = new double[1];	double ye[] = new double[1];	int i, j, width, height, num_col;	int n[] = new int[1];	double img_f[][];	/*	  Bugs in plimage():	  -at high magnifications, the left and right edge are ragged, try	  ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5	  Bugs in x20c.c:	  -if the window is resized after a selection is made on "lena", when	  making a new selection the old one will re-appear.	*/	// plplot initialization	// Parse and process command line arguments.	//pls.MergeOpts(options, "x20c options", NULL);	pls.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM );	// Initialize PLplot.	pls.init();	/* view image border pixels */	if (dbg) {	    pls.env(1., (double) XDIM, 1., (double) YDIM, 1, 1); /* no plot box */	    /* build a one pixel square border, for diagnostics */	    for (i=0; i<XDIM; i++)		z[i][YDIM-1] = 1.; /* right */	    for (i=0; i<XDIM; i++)		z[i][0] = 1.; /* left */	    for (i=0; i<YDIM; i++)		z[0][i] = 1.; /* top */	    for (i=0; i<YDIM; i++)		z[XDIM-1][i] = 1.; /* botton */	    pls.lab("...around a blue square."," ","A red border should appear...");	    pls.image(z, 1., (double) XDIM, 1., (double) YDIM, 0., 0.,		      1., (double) XDIM, 1., (double) YDIM);	    pls.adv(0);	}	/* sombrero-like demo */	if (!nosombrero) {	    r = new double[XDIM][YDIM];	    pls.col0(2); /* draw a yellow plot box, useful for diagnostics! :( */	    pls.env(0., 2.*Math.PI, 0, 3.*Math.PI, 1, -1);	    for (i=0; i<XDIM; i++)		x[i] = i*2.*Math.PI/(XDIM-1);	    for (i=0; i<YDIM; i++)		y[i] = i*3.*Math.PI/(YDIM-1);	    for (i=0; i<XDIM; i++)		for (j=0; j<YDIM; j++) {		    r[i][j] = Math.sqrt(x[i]*x[i]+y[j]*y[j])+1e-3;		    z[i][j] = Math.sin(r[i][j]) / (r[i][j]);		}	    pls.lab("No, an amplitude clipped \"sombrero\"", "", "Saturn?");	    pls.ptex(2., 2., 3., 4., 0., "Transparent image");	    pls.image(z, 0., 2.*Math.PI, 0., 3.*Math.PI, 0.05, 1.,		      0., 2.*Math.PI, 0., 3.*Math.PI);	    /* save the plot */	    if (f_name != null)		save_plot(f_name);	    pls.adv(0);	}	/* read Lena image */	if ((img_f = read_img("lena.pgm", n)) == null && 	    (img_f = read_img("../lena.pgm", n)) == null ) {	    System.out.println("File error - aborting"); 	    pls.end();	    System.exit(1);	}	num_col = n[0];	width = img_f.length;	height = img_f[0].length;	/* set gray colormap */	gray_cmap(num_col);	/* display Lena */	pls.env(1., width, 1., height, 1, -1);	if (!nointeractive)	    pls.lab("Set and drag Button 1 to (re)set selection, Button 2 to finish."," ","Lena...");	else	    pls.lab(""," ","Lena...");	pls.image(img_f, 1., (double) width, 1., (double) height, 0., 0.,		  1., width, 1., height);	// selection/expansion demo	if (!nointeractive) {	    xi[0] = 200.; xe[0] = 330.;	    yi[0] = 280.; ye[0] = 220.;	    if (get_clip(xi, xe, yi, ye)) { // get selection rectangle		pls.end();		System.exit(0);	    }	    /*	      I'm unable to continue, clearing the plot and advancing to the next	      one, without hiting the enter key, or pressing the button... help!	      Forcing the xwin driver to leave locate mode and destroying the	      xhairs (in GetCursorCmd()) solves some problems, but I still have	      to press the enter key or press Button-2 to go to next plot, even	      if a pladv() is not present!  Using plbop() solves the problem, but	      it shouldn't be needed!	    */	    /* pls.bop(); */	    /*	      spause(false), adv(0), spause(true), also works,	      but the above question remains.	      With this approach, the previous pause state is lost,	      as there is no API call to get its current state.	    */	    pls.spause(false);	    pls.adv(0);	    // display selection only	    pls.image(img_f, 1., (double) width, 1., (double) height, 0., 0., xi[0], xe[0], ye[0], yi[0]);	    pls.spause(true);	    pls.adv(0);	    // zoom in selection	    pls.env(xi[0], xe[0], ye[0], yi[0], 1, -1);	    pls.image(img_f, 1., (double) width, 1., (double) height, 0., 0., xi[0], xe[0], ye[0], yi[0]);	    pls.adv(0);	}	pls.end();    }