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 )
void plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
void(* minmax)(PLPointer p, PLINT nx, PLINT ny, PLFLT *zmim, PLFLT *zmax)
void plP_esc(PLINT op, void *ptr)
PLFLT(* get)(PLPointer p, PLINT ix, PLINT iy)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT nx
void plfimage(PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax)
void PLFLT PLINT PLINT PLFLT x
void plimageslow(PLFLT *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
void c_plimagefr(const PLFLT *const *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
void plfimagefr(PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
static void pltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data)
void PLFLT PLINT PLINT PLFLT PLFLT y
void c_plimage(const PLFLT *const *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax)
#define PLESC_END_RASTERIZE
void RestoreWrite2BufferPixmap()
void plP_image(PLFLT *z, PLINT nx, PLINT ny, PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
void grimage(short *x, short *y, unsigned short *z, PLINT nx, PLINT ny)
void plabort(const char *errormsg)
#define PLESC_START_RASTERIZE
dx
if { $zoomopts($this,1) == 0 } then {
void plexit(const char *errormsg)