Logo ROOT   6.07/09
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 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18 
19 #ifndef ROOT_Riosfwd
20 #include "Riosfwd.h"
21 #endif
22 
23 class TAttImage;
24 
26 
27 protected:
28  TAttImage *fAttImage; // image attributes to be edited
29 
30 public:
31  TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
32  virtual ~TPaletteEditor() { }
33 
34  virtual void CloseWindow();
35 
36  ClassDef(TPaletteEditor, 0) // Base class for palette editor
37 };
38 
39 class TImagePalette : public TObject {
40 
41 public:
42  UInt_t fNumPoints; ///< number of anchor points
43  Double_t *fPoints; ///< [fNumPoints] value of each anchor point [0..1]
44  UShort_t *fColorRed; ///< [fNumPoints] red color at each anchor point
45  UShort_t *fColorGreen; ///< [fNumPoints] green color at each anchor point
46  UShort_t *fColorBlue; ///< [fNumPoints] blue color at each anchor point
47  UShort_t *fColorAlpha; ///< [fNumPoints] alpha at each anchor point
48 
49  TImagePalette();
50  TImagePalette(const TImagePalette &palette);
51  TImagePalette(UInt_t numPoints);
52  TImagePalette(Int_t ncolors, Int_t *colors);
53  virtual ~TImagePalette();
54  virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b);
55  virtual Int_t *GetRootColors();
56 
57  TImagePalette &operator=(const TImagePalette &palette);
58 
59  static TImagePalette* Create(Option_t* opts);
60  static TImagePalette* CreateCOLPalette(Int_t nContours);
61 
62  ClassDef(TImagePalette,2) // Color Palette for value -> color conversion
63 };
64 
65 class TAttImage {
66 
67 public:
68  // Defines level of output quality/speed ratio
70  kImgDefault = -1,
71  kImgPoor = 0,
72  kImgFast = 1,
73  kImgGood = 2,
74  kImgBest = 3
75  };
76 
77 protected:
78  EImageQuality fImageQuality; ///< *OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}*
79  UInt_t fImageCompression; ///< compression [0 .. 100] 0: no compression
80  Bool_t fConstRatio; ///< keep aspect ratio of image on the screen
81  TImagePalette fPalette; ///< color palette for value -> color conversion
82  TPaletteEditor *fPaletteEditor; ///<! GUI to edit the color palette
83  Bool_t fPaletteEnabled; ///<! kTRUE - palette is drawn on the image
84 
85 public:
86  TAttImage();
87  TAttImage(EImageQuality lquality, UInt_t lcompression, Bool_t constRatio);
88  virtual ~TAttImage();
89 
90  void Copy(TAttImage &attline) const;
91  Bool_t GetConstRatio() const { return fConstRatio; }
92  UInt_t GetImageCompression() const { return fImageCompression; }
93  EImageQuality GetImageQuality() const { return fImageQuality; }
94  virtual const TImagePalette &GetPalette() const { return fPalette; }
95 
96  virtual void ResetAttImage(Option_t *option="");
97  virtual void SaveImageAttributes(std::ostream &out, const char *name,
98  EImageQuality qualdef = kImgDefault,
99  UInt_t comprdef = 0,
100  Bool_t constRatiodef = kTRUE);
101  virtual void SetConstRatio(Bool_t constRatio = kTRUE); // *TOGGLE*
102  virtual void SetPaletteEnabled(Bool_t on = kTRUE) { fPaletteEnabled = on; }
103  virtual void SetImageCompression(UInt_t lcompression)
104  { fImageCompression = (lcompression > 100) ? 100 : lcompression; } // *MENU*
105  virtual void SetImageQuality(EImageQuality lquality)
106  { fImageQuality = lquality;} // *SUBMENU*
107  virtual void SetPalette(const TImagePalette *palette);
108  virtual void StartPaletteEditor(); // *MENU*
109  virtual void EditorClosed() { fPaletteEditor = 0; }
110  Bool_t IsPaletteEnabled() const { return fPaletteEnabled; }
111 
112  ClassDef(TAttImage,1) //Image attributes
113 };
114 
115 R__EXTERN TImagePalette *gHistImagePalette; // palette used in TH2::Draw("col")
116 R__EXTERN TImagePalette *gWebImagePalette; // 6x6x6 colors web palette
117 
118 #endif
virtual void EditorClosed()
Definition: TAttImage.h:109
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
Definition: TAttImage.h:43
const char Option_t
Definition: RtypesCore.h:62
unsigned short UShort_t
Definition: RtypesCore.h:36
TH1 * h
Definition: legend2.C:5
Bool_t IsPaletteEnabled() const
Definition: TAttImage.h:110
TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Constructor.
Definition: TAttImage.cxx:254
EImageQuality fImageQuality
OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}
Definition: TAttImage.h:78
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SetImageQuality(EImageQuality lquality)
Definition: TAttImage.h:105
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
Definition: TAttImage.h:83
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition: TAttImage.h:44
EImageQuality GetImageQuality() const
Definition: TAttImage.h:93
#define ClassDef(name, id)
Definition: Rtypes.h:254
UInt_t GetImageCompression() const
Definition: TAttImage.h:92
UInt_t fImageCompression
compression [0 .. 100] 0: no compression
Definition: TAttImage.h:79
R__EXTERN TImagePalette * gWebImagePalette
Definition: TAttImage.h:116
Edit the palette via a GUI.
Definition: TAttImage.h:25
virtual const TImagePalette & GetPalette() const
Definition: TAttImage.h:94
TRandom2 r(17)
TImagePalette fPalette
color palette for value -> color conversion
Definition: TAttImage.h:81
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition: TAttImage.h:47
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual ~TPaletteEditor()
Definition: TAttImage.h:32
UInt_t fNumPoints
number of anchor points
Definition: TAttImage.h:42
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
Definition: TAttImage.h:46
Bool_t fConstRatio
keep aspect ratio of image on the screen
Definition: TAttImage.h:80
Color * colors
Definition: X3DBuffer.c:19
virtual void SetImageCompression(UInt_t lcompression)
Definition: TAttImage.h:103
void Copy(void *source, void *dest)
double Double_t
Definition: RtypesCore.h:55
virtual void SetPaletteEnabled(Bool_t on=kTRUE)
Definition: TAttImage.h:102
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:39
Mother of all ROOT objects.
Definition: TObject.h:44
#define R__EXTERN
Definition: DllImport.h:27
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
Definition: TAttImage.h:45
Bool_t GetConstRatio() const
Definition: TAttImage.h:91
TPaletteEditor * fPaletteEditor
! GUI to edit the color palette
Definition: TAttImage.h:82
TImage attributes.
Definition: TAttImage.h:65
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:28
R__EXTERN TImagePalette * gHistImagePalette
Definition: TAttImage.h:115
virtual void CloseWindow()
Closes the window and deletes itself.
Definition: TAttImage.cxx:262
const Bool_t kTRUE
Definition: Rtypes.h:91
char name[80]
Definition: TGX11.cxx:109