ROOT  6.06/09
Reference Guide
TASPaletteEditor.h
Go to the documentation of this file.
1 // @(#)root/asimage:$Id$
2 // Author: Reiner Rohlfs 24/03/2002
3 
4 /*************************************************************************
5  * Copyright (C) 1995-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_TASPaletteEditor
13 #define ROOT_TASPaletteEditor
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TASPaletteEditor //
19 // //
20 // This is a GUI window to edit a color palette. //
21 // It is called by a context menu item of TImage. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_TAttImage
26 #include "TAttImage.h"
27 #endif
28 #ifndef ROOT_TGFrame
29 #include "TGFrame.h"
30 #endif
31 #ifndef ROOT_TLine
32 #include "TLine.h"
33 #endif
34 
35 
36 class TVirtualPad;
37 class TH1D;
39 class TGTextButton;
40 class TGCheckButton;
41 class TGComboBox;
42 class TGRadioButton;
43 
44 
46 
47 protected:
48  class PaintPalette : public TObject {
49  protected :
52  public:
53  PaintPalette(TImagePalette **palette, TAttImage *attImage)
54  { fPalette = palette; fAttImage = attImage; }
55  void Paint(Option_t *option);
56  };
57 
58  class LimitLine : public TLine {
59  private:
61  protected:
62  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
63  public:
65  void Paint(Option_t *option);
66  };
67 
68  Double_t fMinValue; // min value of image
69  Double_t fMaxValue; // max value of image
70 
71  TH1D *fHisto; // hitogram of image pixels
72  TRootEmbeddedCanvas *fPaletteCanvas; // canvas to draw the current palette
73  TRootEmbeddedCanvas *fHistCanvas; // canvas to draw the histogram
74  TList *fPaletteList; // list of palettes for undo and redo
75  TImagePalette *fPalette; // current palette
79 
82 
87 
89 
90  void InsertNewPalette(TImagePalette *newPalette);
91 
92  void Save();
93  void Open();
94 
95  void LogPalette();
96  void ExpPalette();
97  void LinPalette();
98  void InvertPalette();
99  void NewPalette(Long_t id);
100  void SetStep();
101  void SetRamp(Long_t ramp);
102 
103  void UpdateScreen(Bool_t histoUpdate);
104 
105 public:
106  TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
107  virtual ~TASPaletteEditor();
108 
109  Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2);
110 
111  void UpdateRange();
112  void CloseWindow();
113 
114  ClassDef(TASPaletteEditor,0) // GUI to edit a color palette
115 };
116 
117 #endif
This is a GUI window to edit a color palette.
const char Option_t
Definition: RtypesCore.h:62
void CloseWindow()
Close editor.
TH1 * h
Definition: legend2.C:5
void InsertNewPalette(TImagePalette *newPalette)
The newPalette is inserted in the list of palettes (fPaletteList) and fPalette is set to the newPalet...
TImagePalette * fPalette
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
PaintPalette * fPaintPalette
void Paint(Option_t *option)
Actually paint the paletter.
void InvertPalette()
The palette is inverted.
TGComboBox * fComboBox
void UpdateScreen(Bool_t histoUpdate)
All widgets of the screen are updated with the current palette.
virtual ~TASPaletteEditor()
Palette editor destructor. Deletes all frames and their layout hints.
TGRadioButton * fRamps[3]
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
PaintPalette(TImagePalette **palette, TAttImage *attImage)
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
Edit the palette via a GUI.
Definition: TAttImage.h:67
void Paint(Option_t *option)
Paint the limit lines.
Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2)
Process all editor mouse events.
A doubly linked list.
Definition: TList.h:47
void SetRamp(Long_t ramp)
The palette is repeated up to 4 times.
LimitLine * fLimitLine[2]
TGCheckButton * fStepButton
void LogPalette()
The anchor points are rescaled by a log operation.
double Coord_t
Definition: RtypesCore.h:81
unsigned int UInt_t
Definition: RtypesCore.h:42
A simple line.
Definition: TLine.h:41
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
void SetStep()
Create a step palette.
void NewPalette(Long_t id)
A new palette is created, depending on the id.
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:613
TGTextButton * fUnDoButton
long Long_t
Definition: RtypesCore.h:50
LimitLine(Coord_t x, Coord_t y1, Coord_t y2, TASPaletteEditor *gui)
The blue limit line in the pixel value histogram.
double Double_t
Definition: RtypesCore.h:55
TGTextButton * fReDoButton
TRootEmbeddedCanvas * fPaletteCanvas
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:83
void UpdateRange()
Updates the range of the palette.
Mother of all ROOT objects.
Definition: TObject.h:58
TGCheckButton * fAutoUpdate
void ExpPalette()
The anchor points are rescaled by a exp operation.
TVirtualPad * fImagePad
TImage attributes.
Definition: TAttImage.h:108
TRootEmbeddedCanvas * fHistCanvas
void Open()
Opens either a ROOT file or an ASCII file and reads a palette.
void LinPalette()
The anchor points are rescaled to be linar.
void Save()
Saves the current palette either into a ROOT file or in an ASCII file.