Logo ROOT  
Reference Guide
TAttImage.h
Go to the documentation of this file.
1 // @(#)root/graf:$Id$
2 // Author: Reiner Rohlfs 24/03/02
3 
4 /*************************************************************************
5  * Copyright (C) 2001-2002, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TAttImage
13 #define ROOT_TAttImage
14 
15 #include "TObject.h"
16 
17 class TAttImage;
18 
20 
21 protected:
22  TAttImage *fAttImage; // image attributes to be edited
23 
24 public:
25  TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
26  virtual ~TPaletteEditor() { }
27 
28  virtual void CloseWindow();
29 
30  ClassDef(TPaletteEditor, 0) // Base class for palette editor
31 };
32 
33 class TImagePalette : public TObject {
34 
35 public:
36  UInt_t fNumPoints; ///< number of anchor points
37  Double_t *fPoints; ///< [fNumPoints] value of each anchor point [0..1]
38  UShort_t *fColorRed; ///< [fNumPoints] red color at each anchor point
39  UShort_t *fColorGreen; ///< [fNumPoints] green color at each anchor point
40  UShort_t *fColorBlue; ///< [fNumPoints] blue color at each anchor point
41  UShort_t *fColorAlpha; ///< [fNumPoints] alpha at each anchor point
42 
43  TImagePalette();
44  TImagePalette(const TImagePalette &palette);
45  TImagePalette(UInt_t numPoints);
46  TImagePalette(Int_t ncolors, Int_t *colors);
47  virtual ~TImagePalette();
49  virtual Int_t *GetRootColors();
50 
51  TImagePalette &operator=(const TImagePalette &palette);
52 
53  static TImagePalette* Create(Option_t* opts);
54  static TImagePalette* CreateCOLPalette(Int_t nContours);
55 
56  ClassDef(TImagePalette,2) // Color Palette for value -> color conversion
57 };
58 
59 class TAttImage {
60 
61 public:
62  // Defines level of output quality/speed ratio
65  kImgPoor = 0,
66  kImgFast = 1,
67  kImgGood = 2,
68  kImgBest = 3
69  };
70 
71 protected:
72  EImageQuality fImageQuality; ///< *OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}*
73  UInt_t fImageCompression; ///< compression [0 .. 100] 0: no compression
74  Bool_t fConstRatio; ///< keep aspect ratio of image on the screen
75  TImagePalette fPalette; ///< color palette for value -> color conversion
76  TPaletteEditor *fPaletteEditor; ///<! GUI to edit the color palette
77  Bool_t fPaletteEnabled; ///<! kTRUE - palette is drawn on the image
78 
79 public:
80  TAttImage();
81  TAttImage(EImageQuality lquality, UInt_t lcompression, Bool_t constRatio);
82  virtual ~TAttImage();
83 
84  void Copy(TAttImage &attline) const;
85  Bool_t GetConstRatio() const { return fConstRatio; }
88  virtual const TImagePalette &GetPalette() const { return fPalette; }
89 
90  virtual void ResetAttImage(Option_t *option="");
91  virtual void SaveImageAttributes(std::ostream &out, const char *name,
92  EImageQuality qualdef = kImgDefault,
93  UInt_t comprdef = 0,
94  Bool_t constRatiodef = kTRUE);
95  virtual void SetConstRatio(Bool_t constRatio = kTRUE); // *TOGGLE*
96  virtual void SetPaletteEnabled(Bool_t on = kTRUE) { fPaletteEnabled = on; }
97  virtual void SetImageCompression(UInt_t lcompression)
98  { fImageCompression = (lcompression > 100) ? 100 : lcompression; } // *MENU*
99  virtual void SetImageQuality(EImageQuality lquality)
100  { fImageQuality = lquality;} // *SUBMENU*
101  virtual void SetPalette(const TImagePalette *palette);
102  virtual void StartPaletteEditor(); // *MENU*
103  virtual void EditorClosed() { fPaletteEditor = 0; }
105 
106  ClassDef(TAttImage,1) //Image attributes
107 };
108 
109 R__EXTERN TImagePalette *gHistImagePalette; // palette used in TH2::Draw("col")
110 R__EXTERN TImagePalette *gWebImagePalette; // 6x6x6 colors web palette
111 
112 #endif
TAttImage::EditorClosed
virtual void EditorClosed()
Definition: TAttImage.h:103
gHistImagePalette
R__EXTERN TImagePalette * gHistImagePalette
Definition: TAttImage.h:109
TAttImage
TImage attributes.
Definition: TAttImage.h:59
TPaletteEditor::~TPaletteEditor
virtual ~TPaletteEditor()
Definition: TAttImage.h:26
TAttImage::fConstRatio
Bool_t fConstRatio
keep aspect ratio of image on the screen
Definition: TAttImage.h:74
TAttImage::kImgBest
@ kImgBest
Definition: TAttImage.h:68
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
Option_t
const char Option_t
Definition: RtypesCore.h:66
TImagePalette::fNumPoints
UInt_t fNumPoints
number of anchor points
Definition: TAttImage.h:36
TAttImage::kImgGood
@ kImgGood
Definition: TAttImage.h:67
TAttImage::SetConstRatio
virtual void SetConstRatio(Bool_t constRatio=kTRUE)
Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
Definition: TAttImage.cxx:641
UShort_t
unsigned short UShort_t
Definition: RtypesCore.h:40
TImagePalette::~TImagePalette
virtual ~TImagePalette()
Destructor.
Definition: TAttImage.cxx:441
TImagePalette::fColorGreen
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
Definition: TAttImage.h:39
TPaletteEditor::fAttImage
TAttImage * fAttImage
Definition: TAttImage.h:22
r
ROOT::R::TRInterface & r
Definition: Object.C:4
colors
Color * colors
Definition: X3DBuffer.c:21
TImagePalette::fColorBlue
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
Definition: TAttImage.h:40
TAttImage::EImageQuality
EImageQuality
Definition: TAttImage.h:63
TAttImage::fImageQuality
EImageQuality fImageQuality
OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",...
Definition: TAttImage.h:72
TImagePalette::fColorAlpha
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition: TAttImage.h:41
TAttImage::Copy
void Copy(TAttImage &attline) const
Copy this image attributes to a new attimage.
Definition: TAttImage.cxx:567
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
b
#define b(i)
Definition: RSha256.hxx:100
TAttImage::SetPaletteEnabled
virtual void SetPaletteEnabled(Bool_t on=kTRUE)
Definition: TAttImage.h:96
bool
TAttImage::fPalette
TImagePalette fPalette
color palette for value -> color conversion
Definition: TAttImage.h:75
TImagePalette::operator=
TImagePalette & operator=(const TImagePalette &palette)
Assignment operator.
Definition: TAttImage.cxx:453
gWebImagePalette
R__EXTERN TImagePalette * gWebImagePalette
Definition: TAttImage.h:110
TAttImage::kImgPoor
@ kImgPoor
Definition: TAttImage.h:65
TAttImage::SetImageQuality
virtual void SetImageQuality(EImageQuality lquality)
Definition: TAttImage.h:99
TAttImage::fPaletteEnabled
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
Definition: TAttImage.h:77
TAttImage::StartPaletteEditor
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
Definition: TAttImage.cxx:780
TImagePalette::CreateCOLPalette
static TImagePalette * CreateCOLPalette(Int_t nContours)
Factory method to creates an image palette for histogram plotting.
Definition: TAttImage.cxx:748
h
#define h(i)
Definition: RSha256.hxx:106
TImagePalette::FindColor
virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b)
Returns an index of the closest color.
Definition: TAttImage.cxx:485
TPaletteEditor::TPaletteEditor
TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Constructor.
Definition: TAttImage.cxx:254
TAttImage::kImgDefault
@ kImgDefault
Definition: TAttImage.h:64
TAttImage::SaveImageAttributes
virtual void SaveImageAttributes(std::ostream &out, const char *name, EImageQuality qualdef=kImgDefault, UInt_t comprdef=0, Bool_t constRatiodef=kTRUE)
Save image attributes as C++ statement(s) on output stream, but not the palette.
Definition: TAttImage.cxx:620
TAttImage::IsPaletteEnabled
Bool_t IsPaletteEnabled() const
Definition: TAttImage.h:104
TAttImage::fPaletteEditor
TPaletteEditor * fPaletteEditor
! GUI to edit the color palette
Definition: TAttImage.h:76
TAttImage::TAttImage
TAttImage()
TAttImage default constructor.
Definition: TAttImage.cxx:524
TAttImage::fImageCompression
UInt_t fImageCompression
compression [0 .. 100] 0: no compression
Definition: TAttImage.h:73
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TImagePalette::fColorRed
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition: TAttImage.h:38
TAttImage::SetPalette
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Definition: TAttImage.cxx:650
unsigned int
TAttImage::GetImageQuality
EImageQuality GetImageQuality() const
Definition: TAttImage.h:87
TAttImage::~TAttImage
virtual ~TAttImage()
TAttImage destructor.
Definition: TAttImage.cxx:559
Double_t
double Double_t
Definition: RtypesCore.h:59
TObject.h
TAttImage::GetConstRatio
Bool_t GetConstRatio() const
Definition: TAttImage.h:85
TImagePalette::TImagePalette
TImagePalette()
Default constructor, sets all pointers to 0.
Definition: TAttImage.cxx:270
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TAttImage::GetPalette
virtual const TImagePalette & GetPalette() const
Definition: TAttImage.h:88
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
TImagePalette
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:33
R__EXTERN
#define R__EXTERN
Definition: DllImport.h:27
TPaletteEditor::CloseWindow
virtual void CloseWindow()
Closes the window and deletes itself.
Definition: TAttImage.cxx:262
TAttImage::kImgFast
@ kImgFast
Definition: TAttImage.h:66
TAttImage::SetImageCompression
virtual void SetImageCompression(UInt_t lcompression)
Definition: TAttImage.h:97
TImagePalette::Create
static TImagePalette * Create(Option_t *opts)
Factory method to creates an image palette of a specific typ.
Definition: TAttImage.cxx:702
TImagePalette::GetRootColors
virtual Int_t * GetRootColors()
Returns a list of ROOT colors.
Definition: TAttImage.cxx:507
TPaletteEditor
Edit the palette via a GUI.
Definition: TAttImage.h:19
TAttImage::ResetAttImage
virtual void ResetAttImage(Option_t *option="")
Reset this image attributes to default values.
Definition: TAttImage.cxx:584
TImagePalette::fPoints
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
Definition: TAttImage.h:37
TAttImage::GetImageCompression
UInt_t GetImageCompression() const
Definition: TAttImage.h:86
int
g
#define g(i)
Definition: RSha256.hxx:105