Index: trunk/SophyaPI/PI/parradapter.cc
===================================================================
--- trunk/SophyaPI/PI/parradapter.cc	(revision 104)
+++ trunk/SophyaPI/PI/parradapter.cc	(revision 105)
@@ -6,4 +6,5 @@
 #include <math.h>
 
+#include "ctimer.h"
 #include "parradapter.h"
 
@@ -28,5 +29,7 @@
 if ( (sx > 0) && (sy > 0) )   { sX = sx; sY = sy; }
 if (invX) { sgnX = -1;  offX = sX; } 
+else { sgnX = 1; offX = 0; }
 if (invY) { sgnY = -1;  offY = sY; } 
+else { sgnY = 1; offY = 0; }
 }
 
@@ -41,4 +44,5 @@
 int P2DArrayAdapter::CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)
 {
+TIMEF ; 
 double m = 0.;
 double s = 0.;
@@ -49,7 +53,8 @@
 
 if (min >= max) { min = -9.e19; max = 9.e19; }
-float minpix = 9.e19;
-float maxpix = -9.e19; 
+float minpix = max;
+float maxpix = min; 
 float pixv;
+printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max);
 
 int n = 0;
@@ -60,12 +65,12 @@
 }
 
+printf(" -> vit=%d \n", vit);
 for(int j=0; j<sY; j++) 
   for(int i=0; i<sX; i++)   {
-    if (n%vit != 0)  continue;
-    n++;
+    if (++n % vit != 0)  continue;
     pixv = Value(i,j);
     if (pixv <= max && pixv >= min) {  
       if (pixv < minpix)  minpix = pixv;
-      else if (pixv > maxpix)  maxpix = pixv; 
+      if (pixv > maxpix)  maxpix = pixv; 
       dv = (double)pixv;
       m += dv;  s += (dv*dv);
@@ -77,7 +82,8 @@
   }
 
-nbnul = n0;  nbsat = n9;
-
-n = sX*sY-(n0+n9);
+nbnul = n0*vit;  nbsat = n9*vit;
+min = minpix;  max = maxpix; 
+
+n -= (n0+n9);
 if (n > 0)
   { dv = (double)n;  m /= dv;  s = s/dv - m*m;
@@ -86,4 +92,5 @@
 else { moy = 0.;  sig = -1.; }
 
+printf("DEBUG_CHECKDYN: %d %g %g - %g %g \n", n, min, max, moy, sig);
 return(n);
 }
@@ -93,4 +100,5 @@
 void P2DArrayAdapter::ComputeLut_PicHisto(float& min, float& max, int nbsig, float fracmax)
 {
+TIMEF ; 
 int MINNBIN = 64;
 int MAXNBIN = 1024;
@@ -136,6 +144,5 @@
 for(int j=0; j<sY; j++)
   for(int i=0; i<sX; i++) {
-    if ( (kk%vitesse) != 0) continue;
-    kk++;
+    if ( (++kk % vitesse) != 0) continue;
    /* remplissage de l'histogramme */
     bin = (int)((Value(i, j) - minhis) / binwidth) ;
@@ -212,5 +219,7 @@
 /* --Methode-- */
 unsigned char * P2DArrayAdapter::ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
-                int xwsz, int ywsz, unsigned char * opix, int * oxsp, int * oysp){
+                int xwsz, int ywsz, unsigned char * opix, int * oxsp, int * oysp)
+{
+TIMEF ; 
 unsigned char *pix, *pp, ucp;
 int zmm=1;
@@ -260,38 +269,66 @@
 
 pp = pix;
-if (zm == 1)    // Pas de zoom  
-  {
-  for(j=ofy; j<ofy+npy; j++)
-    for(i=ofx; i<ofx+npx; i++) 
-      { *pp = (unsigned char) lut->Apply((*this)(i,j));  pp++; }
-  }
-else if (zm < -1)        // Compression 
-  {
-  float fv = (float)(zmm*zmm); 
-  for(j=ofy; j<ofy+npy; j+=zmm)
-    for(i=ofx; i<ofx+npx; i+=zmm)
-      {
-      vpx = 0;
-      for(l=0; l<zmm; l++)
-        for(k=0; k<zmm; k++)
-          vpx += (*this)(i+k, j+l);
-      *pp = (unsigned char) lut->Apply(vpx/fv); 
-      pp++;
-      }
-  }
-else      // Agrandissement
-  {
-  for(j=ofy; j<ofy+npy; j++)
-    for(i=ofx; i<ofx+npx; i++)
-      {
-      ucp = (unsigned char) lut->Apply((*this)(i,j));
-      for(l=0; l<zm; l++)
-        {
-        pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
-        for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
-	}
-      }
-  }
-
+if (eXY) { // Echange Axe X,Y 
+  if (zm == 1)  {  // Pas de zoom  
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++) 
+        { *pp = (unsigned char) lut->Apply( 
+                this->Value(j*sgnX+offX, i*sgnY+offY));  
+           pp++; }
+    }
+  else if (zm < -1) {       // Compression 
+    float fv = (float)(zmm*zmm); 
+    for(j=ofy; j<ofy+npy; j+=zmm)
+      for(i=ofx; i<ofx+npx; i+=zmm) {
+        vpx = 0;
+        for(l=0; l<zmm; l++)
+          for(k=0; k<zmm; k++)
+            vpx += this->Value( (j+l)*sgnX+offX, (i+k)*sgnY+offY);
+        *pp = (unsigned char) lut->Apply(vpx/fv); 
+        pp++;
+        }
+    }
+  else  {      // Agrandissement
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++)  {
+        ucp = (unsigned char) lut->Apply(this->Value(j*sgnX+offX, i*sgnY+offY));
+        for(l=0; l<zm; l++)  {
+          pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
+	  }
+        }
+    }
+  }     // Fin du cas avec echange d'axe X/Y 
+else {
+  if (zm == 1)  {  // Pas de zoom  
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++) 
+        { *pp = (unsigned char) lut->Apply( 
+                this->Value(i*sgnX+offX, j*sgnY+offY));  
+           pp++; }
+    }
+  else if (zm < -1) {       // Compression 
+    float fv = (float)(zmm*zmm); 
+    for(j=ofy; j<ofy+npy; j+=zmm)
+      for(i=ofx; i<ofx+npx; i+=zmm) {
+        vpx = 0;
+        for(l=0; l<zmm; l++)
+          for(k=0; k<zmm; k++)
+            vpx += this->Value( (i+k)*sgnX+offX, (j+l)*sgnY+offY);
+        *pp = (unsigned char) lut->Apply(vpx/fv); 
+        pp++;
+        }
+    }
+  else  {      // Agrandissement
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++)  {
+        ucp = (unsigned char) lut->Apply(this->Value(i*sgnX+offX, j*sgnY+offY));
+        for(l=0; l<zm; l++)  {
+          pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
+	  }
+        }
+    }
+  }
 return(pix);
 }
Index: trunk/SophyaPI/PI/pitestapp.cc
===================================================================
--- trunk/SophyaPI/PI/pitestapp.cc	(revision 104)
+++ trunk/SophyaPI/PI/pitestapp.cc	(revision 105)
@@ -206,5 +206,5 @@
 static ScSample *scs1, *scs2, *scs3;
 static PIScrollBar *scb, *scb2;
-static ExBWdg *exb1;
+static ExBWdg *exb1, *exb2;
 
 static PIWindow * wp3, *wp2, *wp4, *wp5, *wp6;
@@ -338,7 +338,9 @@
   app = new PITestApp(350, 350);
 
-  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  200, 200, 250, 250);
+  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  400, 200, 250, 250);
   ExBWdg bw(wp2, "BWdg", 150, 150, 10, 40);
   bw.SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_fixed);
+  ExBWdg bw2(wp2, "BWdg2", 180, 180, 200, 10);
+  bw.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
 
   wp4 = new PIWindow(app, "Window-4", PIWK_dialog,  200, 200, 350, 350);
