30 #define COLOR_NO_PLOT ( -1.0 )
45 plsc->plbuf_write = 0;
55 plsc->plbuf_write = 1;
108 for ( ix = 0; ix < nx; ix++ )
110 for ( iy = 0; iy < ny; iy++ )
113 color = idata[ix * ny + iy];
121 xf[2] = xf[3] = ix + 1;
123 yf[1] = yf[2] = iy + 1;
127 for ( i = 0; i < 4; i++ )
130 ( *pltr )( xf[i], yf[i], &tx, &ty, pltr_data );
137 for ( i = 0; i < 4; i++ )
140 xf[i] = xmin + xf[i] *
dx;
141 yf[i] = ymin + yf[i] *
dy;
156 plsc->dev_nptsX = nx;
157 plsc->dev_nptsY = ny;
201 xmin, xmax, ymin, ymax, zmin, zmax,
202 valuemin, valuemax,
pltr, pltr_data );
222 PLFLT color_min, color_max, color_range;
224 if ( plsc->level < 3 )
226 plabort(
"plimagefr: window must be set up first" );
230 if ( nx <= 0 || ny <= 0 )
232 plabort(
"plimagefr: nx and ny must be positive" );
236 if ( ( z = (
PLFLT *) malloc( (
size_t) ( ny * nx ) *
sizeof (
PLFLT ) ) ) == NULL )
238 plexit(
"plimagefr: Insufficient memory" );
242 init_color = plsc->icol0;
249 idataops->
minmax( idatap, nx, ny, &zmin, &zmax );
253 color_min = plsc->cmap1_min;
254 color_max = plsc->cmap1_max;
255 color_range = color_max - color_min;
263 for ( ix = 0; ix < nx; ix++ )
265 for ( iy = 0; iy < ny; iy++ )
267 if ( valuemin == valuemax )
270 z[ix * ny + iy] = ( color_max + color_min ) / 2.0;
274 datum = idataops->
get( idatap, ix, iy );
275 if (
isnan( datum ) || datum < zmin || datum > zmax )
282 if ( datum < valuemin )
286 else if ( datum > valuemax )
292 color_min + ( datum - valuemin +
COLOR_MIN ) / ( valuemax - valuemin ) *
COLOR_MAX * color_range;
338 xmin, xmax, ymin, ymax, zmin, zmax,
339 Dxmin, Dxmax, Dymin, Dymax );
347 PLINT ix, iy, ixx, iyy, xm, ym, nnx, nny;
356 if ( nx <= 0 || ny <= 0 )
358 plabort(
"plimage: nx and ny must be positive" );
362 if ( Dxmin < xmin || Dxmax > xmax || Dymin < ymin || Dymax > ymax )
364 plabort(
"plimage: Dxmin or Dxmax or Dymin or Dymax not compatible with xmin or xmax or ymin or ymax." );
368 if ( Dxmax < Dxmin || xmax < xmin || Dymax < Dymin || ymax < ymin )
370 plabort(
"plimage: All (Dxmin < Dxmax) and (Dymin < Dymax) and (xmin < xmax) and (ymin < ymax) must hold." );
376 idataops->
minmax( idatap, nx, ny, &data_min, &data_max );
378 if ( xmin == Dxmin && xmax == Dxmax && ymin == Dymin && ymax == Dymax )
381 z = (
PLFLT **) idatap;
394 nnx = (
PLINT) ceil( ( Dxmax - Dxmin ) /
dx );
395 nny = (
PLINT) ceil( ( Dymax - Dymin ) /
dy );
400 xm = (
PLINT) floor( ( Dxmin - xmin ) /
dx );
401 ym = (
PLINT) floor( ( Dymin - ymin ) /
dy );
410 for ( ix = xm; ix < xm + nnx; ix++ )
413 for ( iy = ym; iy < ym + nny; iy++ )
415 z[ixx][iyy++] = idataops->
get( idatap, ix, iy );
423 plfimagefr( zops, (
PLPointer) z, nnx, nny, Dxmin, Dxmax, Dymin, Dymax, zmin, zmax,
424 data_min, data_max, NULL, NULL );
427 if ( copied ==
TRUE )