Logo ROOT   6.12/07
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();
48  virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b);
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
64  kImgDefault = -1,
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; }
86  UInt_t GetImageCompression() const { return fImageCompression; }
87  EImageQuality GetImageQuality() const { return fImageQuality; }
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; }
104  Bool_t IsPaletteEnabled() const { return fPaletteEnabled; }
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
virtual void EditorClosed()
Definition: TAttImage.h:103
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
Definition: TAttImage.h:37
const char Option_t
Definition: RtypesCore.h:62
unsigned short UShort_t
Definition: RtypesCore.h:36
TH1 * h
Definition: legend2.C:5
TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Constructor.
Definition: TAttImage.cxx:254
EImageQuality GetImageQuality() const
Definition: TAttImage.h:87
EImageQuality fImageQuality
OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}
Definition: TAttImage.h:72
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SetImageQuality(EImageQuality lquality)
Definition: TAttImage.h:99
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
Definition: TAttImage.h:77
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition: TAttImage.h:38
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual const TImagePalette & GetPalette() const
Definition: TAttImage.h:88
UInt_t fImageCompression
compression [0 .. 100] 0: no compression
Definition: TAttImage.h:73
R__EXTERN TImagePalette * gWebImagePalette
Definition: TAttImage.h:110
Edit the palette via a GUI.
Definition: TAttImage.h:19
ROOT::R::TRInterface & r
Definition: Object.C:4
TImagePalette fPalette
color palette for value -> color conversion
Definition: TAttImage.h:75
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition: TAttImage.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
UInt_t GetImageCompression() const
Definition: TAttImage.h:86
virtual ~TPaletteEditor()
Definition: TAttImage.h:26
UInt_t fNumPoints
number of anchor points
Definition: TAttImage.h:36
Bool_t IsPaletteEnabled() const
Definition: TAttImage.h:104
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
Definition: TAttImage.h:40
Bool_t fConstRatio
keep aspect ratio of image on the screen
Definition: TAttImage.h:74
Color * colors
Definition: X3DBuffer.c:19
virtual void SetImageCompression(UInt_t lcompression)
Definition: TAttImage.h:97
void Copy(void *source, void *dest)
double Double_t
Definition: RtypesCore.h:55
virtual void SetPaletteEnabled(Bool_t on=kTRUE)
Definition: TAttImage.h:96
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:33
Binding & operator=(OUT(*fun)(void))
Mother of all ROOT objects.
Definition: TObject.h:37
#define R__EXTERN
Definition: DllImport.h:27
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
Definition: TAttImage.h:39
TPaletteEditor * fPaletteEditor
! GUI to edit the color palette
Definition: TAttImage.h:76
TImage attributes.
Definition: TAttImage.h:59
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
TAttImage * fAttImage
Definition: TAttImage.h:22
R__EXTERN TImagePalette * gHistImagePalette
Definition: TAttImage.h:109
virtual void CloseWindow()
Closes the window and deletes itself.
Definition: TAttImage.cxx:262
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
Bool_t GetConstRatio() const
Definition: TAttImage.h:85
static constexpr double g