Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:30

0001 // @(#)root/asimage:$Id$
0002 // Author: Reiner Rohlfs 24/03/2002
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2002, Rene Brun, Fons Rademakers and Reiner Rohlfs *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TASPaletteEditor
0013 #define ROOT_TASPaletteEditor
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 //  TASPaletteEditor                                                    //
0019 //                                                                      //
0020 //  This is a GUI window to edit a color palette.                       //
0021 //  It is called by a context menu item of TImage.                      //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "TAttImage.h"
0026 #include "TGFrame.h"
0027 #include "TLine.h"
0028 
0029 
0030 class TVirtualPad;
0031 class TH1D;
0032 class TRootEmbeddedCanvas;
0033 class TGTextButton;
0034 class TGCheckButton;
0035 class TGComboBox;
0036 class TGRadioButton;
0037 
0038 
0039 class TASPaletteEditor : public TPaletteEditor, public TGMainFrame {
0040 
0041 protected:
0042    class PaintPalette : public TObject {
0043    protected :
0044       TImagePalette  **fPalette;
0045       TAttImage       *fAttImage;
0046    public:
0047       PaintPalette(TImagePalette **palette, TAttImage *attImage)
0048          { fPalette = palette; fAttImage = attImage; }
0049       void Paint(Option_t *option = "") override;
0050    };
0051 
0052    class LimitLine : public TLine {
0053    private:
0054       TASPaletteEditor  *fGui;
0055    protected:
0056       void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0057    public:
0058       LimitLine(Coord_t x, Coord_t y1, Coord_t y2, TASPaletteEditor *gui);
0059       void Paint(Option_t *option = "") override;
0060    };
0061 
0062    Double_t              fMinValue;           ///< min value of image
0063    Double_t              fMaxValue;           ///< max value of image
0064 
0065    TH1D                 *fHisto;              ///< histogram of image pixels
0066    TRootEmbeddedCanvas  *fPaletteCanvas;      ///< canvas to draw the current palette
0067    TRootEmbeddedCanvas  *fHistCanvas;         ///< canvas to draw the histogram
0068    TList                *fPaletteList;        ///< list of palettes for undo and redo
0069    TImagePalette        *fPalette;            ///< current palette
0070    TVirtualPad          *fImagePad;
0071    PaintPalette         *fPaintPalette;
0072    LimitLine            *fLimitLine[2];
0073 
0074    TGTextButton         *fUnDoButton;
0075    TGTextButton         *fReDoButton;
0076 
0077    TGCheckButton        *fAutoUpdate;
0078    TGCheckButton        *fStepButton;
0079    TGRadioButton        *fRamps[3];
0080    Int_t                 fRampFactor;
0081 
0082    TGComboBox           *fComboBox;
0083 
0084    void  InsertNewPalette(TImagePalette *newPalette);
0085 
0086    void  Save();
0087    void  Open();
0088 
0089    void  LogPalette();
0090    void  ExpPalette();
0091    void  LinPalette();
0092    void  InvertPalette();
0093    void  NewPalette(Long_t id);
0094    void  SetStep();
0095    void  SetRamp(Long_t ramp);
0096 
0097    void  UpdateScreen(Bool_t histoUpdate);
0098 
0099 public:
0100    TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
0101    ~TASPaletteEditor() override;
0102 
0103    Bool_t ProcessMessage(Longptr_t msg, Longptr_t param1, Longptr_t param2) override;
0104 
0105    void   UpdateRange();
0106    void   CloseWindow() override;
0107 
0108    ClassDefOverride(TASPaletteEditor,0)  // GUI to edit a color palette
0109 };
0110 
0111 #endif