30 #define COLOR_NO_PLOT ( -1.0 )
45 plsc->plbuf_write = 0;
55 plsc->plbuf_write = 1;
107 for ( ix = 0; ix < nx; ix++ )
109 for ( iy = 0; iy < ny; iy++ )
112 color = idata[ix * ny + iy];
120 xf[2] = xf[3] = ix + 1;
122 yf[1] = yf[2] = iy + 1;
126 for ( i = 0; i < 4; i++ )
129 ( *pltr )( xf[i], yf[i], &tx, &ty, pltr_data );
136 for ( i = 0; i < 4; i++ )
139 xf[i] = xmin + xf[i] * dx;
140 yf[i] = ymin + yf[i] * dy;
155 plsc->dev_nptsX = nx;
156 plsc->dev_nptsY = ny;
202 xmin, xmax, ymin, ymax, zmin, zmax,
203 valuemin, valuemax, NULL, NULL );
244 xmin, xmax, ymin, ymax, zmin, zmax,
245 valuemin, valuemax, pltr, pltr_data );
264 PLFLT color_min, color_max, color_range;
266 if ( plsc->level < 3 )
268 plabort(
"plimagefr: window must be set up first" );
272 if ( nx <= 0 || ny <= 0 )
274 plabort(
"plimagefr: nx and ny must be positive" );
278 if ( ( z = (
PLFLT *) malloc( (
size_t) ( ny * nx ) *
sizeof (
PLFLT ) ) ) == NULL )
280 plexit(
"plimagefr: Insufficient memory" );
284 init_color = plsc->icol0;
291 idataops->
minmax( idatap, nx, ny, &zmin, &zmax );
295 color_min = plsc->cmap1_min;
296 color_max = plsc->cmap1_max;
297 color_range = color_max - color_min;
305 for ( ix = 0; ix < nx; ix++ )
307 for ( iy = 0; iy < ny; iy++ )
309 if ( valuemin == valuemax )
312 z[ix * ny + iy] = ( color_max + color_min ) / 2.0;
316 datum = idataops->
get( idatap, ix, iy );
317 if (
isnan( datum ) || datum < zmin || datum > zmax )
324 if ( datum < valuemin )
328 else if ( datum > valuemax )
334 color_min + ( datum - valuemin +
COLOR_MIN ) / ( valuemax - valuemin ) *
COLOR_MAX * color_range;
342 dx = ( xmax - xmin ) / (
PLFLT) ( nx - 1 );
343 dy = ( ymax - ymin ) / (
PLFLT) ( ny - 1 );
345 plP_image( z, nx, ny, xmin, ymin, dx, dy, pltr, pltr_data );
380 xmin, xmax, ymin, ymax, zmin, zmax,
381 Dxmin, Dxmax, Dymin, Dymax );
389 PLINT ix, iy, ixx, iyy, xm, ym, nnx, nny;
390 PLFLT data_min, data_max, dx, dy;
398 if ( nx <= 0 || ny <= 0 )
400 plabort(
"plimage: nx and ny must be positive" );
404 if ( Dxmin < xmin || Dxmax > xmax || Dymin < ymin || Dymax > ymax )
406 plabort(
"plimage: Dxmin or Dxmax or Dymin or Dymax not compatible with xmin or xmax or ymin or ymax." );
410 if ( Dxmax < Dxmin || xmax < xmin || Dymax < Dymin || ymax < ymin )
412 plabort(
"plimage: All (Dxmin < Dxmax) and (Dymin < Dymax) and (xmin < xmax) and (ymin < ymax) must hold." );
418 idataops->
minmax( idatap, nx, ny, &data_min, &data_max );
420 if ( xmin == Dxmin && xmax == Dxmax && ymin == Dymin && ymax == Dymax )
423 z = (
PLFLT **) idatap;
432 dx = ( xmax - xmin ) / (
PLFLT) ( nx - 1 );
433 dy = ( ymax - ymin ) / (
PLFLT) ( ny - 1 );
436 nnx = (
PLINT) ceil( ( Dxmax - Dxmin ) / dx ) + 1;
437 nny = (
PLINT) ceil( ( Dymax - Dymin ) / dy ) + 1;
442 xm = (
PLINT) floor( ( Dxmin - xmin ) / dx );
443 ym = (
PLINT) floor( ( Dymin - ymin ) / dy );
452 for ( ix = xm; ix < xm + nnx; ix++ )
455 for ( iy = ym; iy < ym + nny; iy++ )
457 z[ixx][iyy++] = idataops->
get( idatap, ix, iy );
465 plfimagefr( zops, (
PLPointer) z, nnx, nny, Dxmin, Dxmax, Dymin, Dymax, zmin, zmax,
466 data_min, data_max, NULL, NULL );
469 if ( copied ==
TRUE )