]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Removed code for RGBAPalette; now in its own file.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Nov 2006 16:27:39 +0000 (16:27 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Nov 2006 16:27:39 +0000 (16:27 +0000)
EVE/Reve/Reve.cxx
EVE/Reve/Reve.h

index c39c4ea9aa8b1290a3e7eedbca629e508f0d0944..6ab54f6a21db787264eb1ccef338a9875929ec36 100644 (file)
@@ -206,7 +206,7 @@ GeoManagerHolder::~GeoManagerHolder()
 }
 
 /**************************************************************************/
-// Color, palette management
+// Color management
 /**************************************************************************/
 
 void ColorFromIdx(Color_t ci, UChar_t* col, Bool_t alpha)
@@ -247,108 +247,6 @@ Color_t* FindColorVar(TObject* obj, const Text_t* varname)
   return (Color_t*) (((char*)obj) + off);
 }
 
-/**************************************************************************/
-// RGBAPalette
-/**************************************************************************/
-
-RGBAPalette::RGBAPalette() :
-  TObject(),
-  Reve::ReferenceCount(),
-  fInterpolate (kFALSE),
-  fWrap        (kFALSE),
-  fColorArray  (0)
-{
-  SetMinMax(0, 100);
-}
-
-RGBAPalette::RGBAPalette(Int_t min, Int_t max) :
-  TObject(),
-  Reve::ReferenceCount(),
-  fInterpolate (kFALSE),
-  fWrap        (kFALSE),
-  fColorArray  (0)
-{
-  SetMinMax(min, max);
-}
-
-RGBAPalette::RGBAPalette(Int_t min, Int_t max, Bool_t interp, Bool_t wrap) :
-  TObject(),
-  Reve::ReferenceCount(),
-  fInterpolate (interp),
-  fWrap        (wrap),
-  fColorArray  (0)
-{
-  SetMinMax(min, max);
-}
-
-RGBAPalette::~RGBAPalette()
-{
-  delete [] fColorArray;
-}
-
-/**************************************************************************/
-
-void RGBAPalette::SetupColor(Int_t val, UChar_t* pixel) const
-{
-  using namespace TMath;
-  Float_t div  = Max(1, fMaxVal - fMinVal);
-  Int_t   nCol = gStyle->GetNumberOfColors();
-
-  Float_t f;
-  if      (val <= fMinVal) f = 0;
-  else if (val >= fMaxVal) f = nCol - 1;
-  else                     f = (val - fMinVal)/div*(nCol - 1);
-
-  if (fInterpolate) {
-    Int_t  bin = (Int_t) f;
-    Float_t f1 = f - bin, f2 = 1.0f - f1;
-    ColorFromIdx(f1, gStyle->GetColorPalette(bin),
-                f2, gStyle->GetColorPalette(Min(bin + 1, nCol - 1)),
-                pixel);
-  } else {
-    ColorFromIdx(gStyle->GetColorPalette((Int_t) Nint(f)), pixel);    
-  }
-}
-
-void RGBAPalette::SetupColorArray() const
-{
-  if(fColorArray)
-    return;
-
-  fColorArray = new UChar_t [4 * fNBins];
-  UChar_t* p = fColorArray;
-  for(Int_t v=fMinVal; v<=fMaxVal; ++v, p+=4)
-    SetupColor(v, p);
-}
-
-void RGBAPalette::ClearColorArray()
-{
-  if(fColorArray) {
-    delete [] fColorArray;
-    fColorArray = 0;
-  }
-}
-
-/**************************************************************************/
-
-void RGBAPalette::SetMinMax(Int_t min, Int_t max)
-{
-  fMinVal = min;
-  fMaxVal = max;
-  fNBins  = max - min + 1;
-  ClearColorArray();
-}
-
-void RGBAPalette::SetInterpolate(Bool_t b)
-{
-  fInterpolate = b;
-  ClearColorArray();
-}
-
-void RGBAPalette::SetWrap(Bool_t b)
-{
-  fWrap = b;
-}
 
 /**************************************************************************/
 } // end namespace Reve
index 4baf2fc84cd48052c55361967dacf66f007ca732..f8ea6dc75b061dd81290a5bac3a54d85bb074612 100644 (file)
@@ -9,12 +9,14 @@
 #include <TString.h>
 #include <TError.h>
 #include <Gtypes.h>
+#include <GuiTypes.h>
 
 class TVirtualPad;
 class TGeoManager;
 
 namespace Reve {
 
+class RenderElement;
 
 /**************************************************************************/
 // Exceptions, string functions
@@ -107,6 +109,9 @@ public:
   ReferenceCount() : fRefCount(0) {}
   virtual ~ReferenceCount() {}
 
+  ReferenceCount(const ReferenceCount&) : fRefCount(0) {}
+  ReferenceCount& operator=(const ReferenceCount&) { return *this; }
+
   void IncRefCount() { ++fRefCount; }
   void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); }
 
@@ -117,7 +122,7 @@ public:
 
 
 /**************************************************************************/
-// Color, palette management
+// Color management
 /**************************************************************************/
 
 void     ColorFromIdx(Color_t ci, UChar_t* col, Bool_t alpha=kTRUE);
@@ -125,64 +130,6 @@ void     ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2,
                      UChar_t* col, Bool_t alpha=kTRUE);
 Color_t* FindColorVar(TObject* obj, const Text_t* varname);
 
-class RGBAPalette : public TObject, public ReferenceCount
-{
-  RGBAPalette(const RGBAPalette&);            // Not implemented
-  RGBAPalette& operator=(const RGBAPalette&); // Not implemented
-
-protected:
-  Int_t     fMinVal;
-  Int_t     fMaxVal;
-  Int_t     fNBins;
-  Bool_t    fInterpolate;
-  Bool_t    fWrap;
-
-  mutable UChar_t* fColorArray; //!
-
-  void SetupColor(Int_t val, UChar_t* pix) const;
-  
-public:
-  RGBAPalette();
-  RGBAPalette(Int_t min, Int_t max);
-  RGBAPalette(Int_t min, Int_t max, Bool_t interp, Bool_t wrap);
-  virtual ~RGBAPalette();
-
-  void SetupColorArray() const;
-  void ClearColorArray();
-
-  UChar_t* ColorFromArray(Int_t val) const;
-  void     ColorFromArray(Int_t val, UChar_t* pix, Bool_t alpha=kTRUE) const;
-
-  Int_t  GetMinVal() const        { return fMinVal; }
-  Int_t  GetMaxVal() const        { return fMaxVal; }
-  Bool_t GetInterpolate() const   { return fInterpolate; }
-  Bool_t GetWrap() const          { return fWrap; }
-
-  void   SetMinMax(Int_t min, Int_t max);
-  void   SetInterpolate(Bool_t b);
-  void   SetWrap(Bool_t b);
-
-  ClassDef(RGBAPalette, 1)
-};
-
-
-inline UChar_t* RGBAPalette::ColorFromArray(Int_t val) const
-{
-  if(!fColorArray)  SetupColorArray();
-  if(val < fMinVal) val = fWrap ? ((val+1-fMinVal)%fNBins + fMaxVal) : fMinVal;
-  if(val > fMaxVal) val = fWrap ? ((val-1-fMaxVal)%fNBins + fMinVal) : fMaxVal;
-  return fColorArray + 4 * (val - fMinVal);
-}
-
-inline void RGBAPalette::ColorFromArray(Int_t val, UChar_t* pix, Bool_t alpha) const
-{
-  UChar_t* c = ColorFromArray(val);
-  pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2];
-  if (alpha) pix[3] = c[3];
-}
-
-/**************************************************************************/
-
 }
 
 #endif