This should have been included in the the earlier "Support arbitrary
storage of 2D user data" patch (or the "Make plgriddata call
plfgriddata" patch).
---
include/plplot.h | 10 ++++++++++
src/plimage.c | 33 +++++++++++++++++++++++----------
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/include/plplot.h b/include/plplot.h
index 16f7a99..b174bc1 100644
--- a/include/plplot.h
+++ b/include/plplot.h
@@ -1708,6 +1708,16 @@ c_plimage( PLFLT **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 );
+/*
+ * Like plimage, but uses an operator functions to access image data from
+ * idatap.
+ */
+
+PLDLLIMPEXP 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 );
+
/* Set up a new line style */
PLDLLIMPEXP void
diff --git a/src/plimage.c b/src/plimage.c
index 04bea2d..bfa5ef7 100644
--- a/src/plimage.c
+++ b/src/plimage.c
@@ -324,12 +324,23 @@ c_plimage( PLFLT **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 )
{
- PLINT ix, iy, ixx, iyy, xm, ym, nnx, nny;
- PLFLT data_min, data_max, dx, dy;
+ plfimage( plf2ops_c(), (PLPointer) idata, nx, ny,
+ xmin, xmax, ymin, ymax, zmin, zmax,
+ Dxmin, Dxmax, Dymin, Dymax );
+}
+
+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 )
+{
+ PLINT ix, iy, ixx, iyy, xm, ym, nnx, nny;
+ PLFLT data_min, data_max, dx, dy;
/* z holds the subimage (Dxmin, Dymin) - (Dxmax, Dymax) */
- PLFLT **z;
+ PLFLT **z;
+ PLF2OPS zops;
/* Was any space allocated for z? */
- PLBOOL copied;
+ PLBOOL copied;
copied = FALSE;
if ( nx <= 0 || ny <= 0 )
@@ -352,14 +363,15 @@ c_plimage( PLFLT **idata, PLINT nx, PLINT ny,
/* Find the minimum and maximum values in the image. Use these values to
* for the color scale range. */
- plMinMax2dGrid( idata, nx, ny, &data_max, &data_min );
+ idataops->minmax( idatap, nx, ny, &data_max, &data_min );
if ( xmin == Dxmin && xmax == Dxmax && ymin == Dymin && ymax == Dymax )
{
/* If the whole image should be shown, then no copying is needed. */
- z = idata;
- nnx = nx;
- nny = ny;
+ z = (PLFLT **) idatap;
+ zops = idataops;
+ nnx = nx;
+ nny = ny;
}
else
{
@@ -380,6 +392,7 @@ c_plimage( PLFLT **idata, PLINT nx, PLINT ny,
/* Allocate space for the sub-image */
plAlloc2dGrid( &z, nnx, nny );
+ zops = plf2ops_c();
/* Go through the image and select the pixels within the given
* (Dxmin, Dymin) - (Dxmax, Dymax) window. */
@@ -389,7 +402,7 @@ c_plimage( PLFLT **idata, PLINT nx, PLINT ny,
ixx++; iyy = 0;
for ( iy = ym; iy < ym + nny; iy++ )
{
- z[ixx][iyy++] = idata[ix][iy];
+ z[ixx][iyy++] = idataops->get( idatap, ix, iy );
}
}
@@ -397,7 +410,7 @@ c_plimage( PLFLT **idata, PLINT nx, PLINT ny,
copied = TRUE;
}
- plimagefr( z, nnx, nny, Dxmin, Dxmax, Dymin, Dymax, zmin, zmax,
+ plfimagefr( zops, (PLPointer) z, nnx, nny, Dxmin, Dxmax, Dymin, Dymax, zmin, zmax,
data_min, data_max, NULL, NULL );
/* Only free the memory if it was allocated by us... */
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel