Changeset 10 in Sophya


Ignore:
Timestamp:
Mar 8, 1996, 8:02:56 PM (30 years ago)
Author:
eros
Message:

Parametres bool refr (refresh) pour divers methodes de PIPixmap et

PIImage pour optimisation (Valeur par defaut = true) Reza

Location:
trunk/SophyaPI/PI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pibwdgx.cc

    r9 r10  
    1717#define NMAXFONTSZ  5
    1818static XFontStruct * fntst[NMAXFONTSZ][3];
    19 static int fntsz[NMAXFONTSZ] = {7,10,12,14,16};
     19static int fntsz[NMAXFONTSZ] = {8,10,12,14,16};
    2020static  PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont };
    2121#define NMAXCOL  10
  • trunk/SophyaPI/PI/pidemo.cc

    r9 r10  
    257257      if ( CurrentPIImage())
    258258        {
    259         CurrentPIImage()->SetZoom(1);
    260         CurrentPIImage()->SetOffset(0, 0);
     259        CurrentPIImage()->SetZoom(1, false);
     260        CurrentPIImage()->SetOffset(0, 0, false);
    261261        CurrentImgWin()->SetSize(CurrentImage()->XSize(),
    262262                                  CurrentImage()->YSize());
     
    267267      if ( CurrentPIImage())
    268268        {
    269         CurrentPIImage()->SetZoom(2);
    270         CurrentPIImage()->SetOffset(0, 0);
     269        CurrentPIImage()->SetZoom(2, false);
     270        CurrentPIImage()->SetOffset(0, 0, false);
    271271        CurrentImgWin()->SetSize(CurrentImage()->XSize()*2,
    272272                                  CurrentImage()->YSize()*2);
     
    277277      if ( CurrentPIImage())
    278278        {
    279         CurrentPIImage()->SetZoom(-2);
    280         CurrentPIImage()->SetOffset(0, 0);
     279        CurrentPIImage()->SetZoom(-2, false);
     280        CurrentPIImage()->SetOffset(0, 0, false);
    281281        CurrentImgWin()->SetSize(CurrentImage()->XSize()/2,
    282282                                  CurrentImage()->YSize()/2);
     
    287287      if ( CurrentPIImage())
    288288        {
    289         CurrentPIImage()->SetZoom(4);
    290         CurrentPIImage()->SetOffset(0, 0);
     289        CurrentPIImage()->SetZoom(4, false);
     290        CurrentPIImage()->SetOffset(0, 0, false);
    291291        CurrentImgWin()->SetSize(CurrentImage()->XSize()*4,
    292292                                  CurrentImage()->YSize()*4);
     
    297297      if ( CurrentPIImage())
    298298        {
    299         CurrentPIImage()->SetZoom(-4);
     299        CurrentPIImage()->SetZoom(-4, false);
    300300        CurrentPIImage()->SetOffset(0, 0);
    301301        CurrentImgWin()->SetSize(CurrentImage()->XSize()/4,
  • trunk/SophyaPI/PI/piimage.cc

    r9 r10  
    4949
    5050/* --Methode-- */
    51 void PIImage::SetImage(RzImage *pim)
     51void PIImage::SetImage(RzImage *pim, bool refr)
    5252{
    5353
     
    5757if (img)
    5858  {
    59   SetSize(img->XSize(), img->YSize());
     59//  SetSize(img->XSize(), img->YSize());
    6060  SetPave();
    6161  if (img->minPix>img->maxPix) img->CheckDyn();
    62   SetLut(img->minPix, img->maxPix, kLutType_Lin, 1);
    63   }
    64 //printf("Debug_SetImage: %ld %ld \n", (long)img, (long)lut);
    65 return;
    66 }
    67 
    68 
    69 /* --Methode-- */
    70 void PIImage::SetZoomWin(PIPixmap * zw)
     62  SetLut(img->minPix, img->maxPix, kLutType_Lin, 1, refr);
     63  }
     64return;
     65}
     66
     67
     68/* --Methode-- */
     69void PIImage::SetZoomWin(PIPixmap * zw, bool refr)
    7170{
    7271zow = zw;
    73 if (zow)  zow->SetColMap(GetColMapId());
    74 }
    75 
    76 
    77 
    78 /* --Methode-- */
    79 void PIImage::SetLut(float min, float max, int typlut, int lauto)
     72if (zow && refr && img)
     73  {
     74  zow->SetColMap(GetColMapId(), false);
     75  ComputeZoomPixmap();
     76  }
     77return;
     78}
     79
     80
     81
     82/* --Methode-- */
     83void PIImage::SetLut(float min, float max, int typlut, int lauto, bool refr)
    8084{
    8185if (lut) delete(lut);
     
    99103lut = new LUT(min, max, NbCol(), typlut);
    100104
    101 Apply();
    102 return;
    103 }
    104 
    105 
    106 /* --Methode-- */
    107 void PIImage::SetLut(LUT *clut)
     105if (refr) Apply();
     106return;
     107}
     108
     109
     110/* --Methode-- */
     111void PIImage::SetLut(LUT *clut, bool refr)
    108112{
    109113LUT * olut = lut;
     
    111115if (olut) delete olut;
    112116
    113 Apply();
    114 return;
    115 }
    116 
    117 
    118 /* --Methode-- */
    119 void PIImage::SetZoom(int zm)
     117if (refr) Apply();
     118return;
     119}
     120
     121
     122/* --Methode-- */
     123void PIImage::SetZoom(int zm, bool refr)
    120124{
    121125if ((zm == 0) || (zm == -1) )  zoom = 1;
     
    124128else zoom = zm;
    125129SetOffset();
    126 Apply();
    127 return;
    128 }
    129 
    130 /* --Methode-- */
    131 void PIImage::SetOffset(int ox, int oy)
     130if (refr) Apply();
     131return;
     132}
     133
     134/* --Methode-- */
     135void PIImage::SetOffset(int ox, int oy, bool refr)
    132136{
    133137if (img == NULL)  {offx = offy = 0;  return; }
     
    137141if (oy >= (img->YSize()-1))  oy = img->YSize()-2;
    138142offx = ox;  offy = oy;
    139 return;
    140 }
    141 
    142 /* --Methode-- */
    143 void PIImage::SetColMap(CMapId cmap)
    144 {
    145 PIPixmap::SetColMap(cmap);
    146 if (zow)  zow->SetColMap(cmap);
     143if (refr) Apply();
     144return;
     145}
     146
     147/* --Methode-- */
     148void PIImage::SetColMap(CMapId cmap, bool refr)
     149{
     150PIPixmap::SetColMap(cmap, refr);
     151if (zow)  zow->SetColMap(cmap, refr);
    147152return;
    148153}
     
    155160if (zow != NULL)
    156161  {
    157   zow->SetColMap(GetColMapId());
     162  zow->SetColMap(GetColMapId(), false);
    158163  ComputeZoomPixmap();
    159164  }
  • trunk/SophyaPI/PI/piimage.h

    r8 r10  
    4141  ~PIImage();
    4242
    43   void SetImage(RzImage *pim);
    44   void SetZoomWin(PIPixmap * zw);
     43  void SetImage(RzImage *pim, bool refr=true);
     44  void SetZoomWin(PIPixmap * zw, bool refr=true);
    4545  inline void SetTextWin(PILabel * tw) { txw = tw; };
    4646
    47   void SetLut(float min, float max,
    48              int typlut=kLutType_Lin, int lauto=0);
    49   void SetLut(LUT *clut);
    50   void SetZoom(int zm);
     47  void SetLut(float min, float max, int typlut=kLutType_Lin,
     48              int lauto=0, bool refr=true);
     49  void SetLut(LUT *clut, bool refr=true);
    5150
    52   void SetOffset(int ox, int oy);
     51  void SetZoom(int zm, bool refr=true);
     52  void SetOffset(int ox, int oy, bool refr=true);
    5353
    54   virtual void SetColMap(CMapId cmap);
     54  virtual void SetColMap(CMapId cmap, bool refr=true);
    5555
    5656  inline RzImage * Image() { return(img); }
  • trunk/SophyaPI/PI/pipixmapgen.cc

    r6 r10  
    2929
    3030/* --Methode-- */
    31 void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy)
     31void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr)
    3232{
    3333pixmap = pix; nx = sx; ny = sy;
    34 Refresh();   
     34if (refr) Refresh();   
    3535}
    3636
    3737
    3838/* --Methode-- */
    39 void PIPixmapGen::SetColMap(CMapId cmapid)
     39void PIPixmapGen::SetColMap(CMapId cmapid, bool refr)
    4040{
    41   if (cmap) delete cmap;
    42   cmap = new PIColorMap(cmapid);
    43   Refresh(); 
     41if (cmap) delete cmap;
     42cmap = new PIColorMap(cmapid);
     43if (refr)  Refresh(); 
    4444}
    4545
  • trunk/SophyaPI/PI/pipixmapgen.h

    r2 r10  
    2020  virtual long    kind() {return ClassId; }
    2121
    22   virtual void  SetPixmap(unsigned char *pix, int sx, int sy);
    23   void          SetColMap(CMapId cmapid);
     22  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
     23  void          SetColMap(CMapId cmapid, bool refr=true);
    2424  inline CMapId GetColMapId() { return (cmap->Type()); };
    2525  inline int    NbCol() { return(cmap->NCol()); };
Note: See TracChangeset for help on using the changeset viewer.