File indexing completed on 2025-01-18 10:11:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TAttImage
0013 #define ROOT_TAttImage
0014
0015 #include "TObject.h"
0016
0017 class TAttImage;
0018
0019 class TPaletteEditor {
0020
0021 protected:
0022 TAttImage *fAttImage{nullptr};
0023
0024 public:
0025 TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
0026 virtual ~TPaletteEditor() { }
0027
0028 virtual void CloseWindow();
0029
0030 ClassDef(TPaletteEditor, 0)
0031 };
0032
0033 class TImagePalette : public TObject {
0034
0035 public:
0036 UInt_t fNumPoints{0};
0037 Double_t *fPoints{nullptr};
0038 UShort_t *fColorRed{nullptr};
0039 UShort_t *fColorGreen{nullptr};
0040 UShort_t *fColorBlue{nullptr};
0041 UShort_t *fColorAlpha{nullptr};
0042
0043 TImagePalette();
0044 TImagePalette(const TImagePalette &palette);
0045 TImagePalette(UInt_t numPoints);
0046 TImagePalette(Int_t ncolors, Int_t *colors);
0047 ~TImagePalette() override;
0048 virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b);
0049 virtual Int_t *GetRootColors();
0050
0051 TImagePalette &operator=(const TImagePalette &palette);
0052
0053 static TImagePalette* Create(Option_t* opts);
0054 static TImagePalette* CreateCOLPalette(Int_t nContours);
0055
0056 ClassDefOverride(TImagePalette,2)
0057 };
0058
0059 class TAttImage {
0060
0061 public:
0062
0063 enum EImageQuality {
0064 kImgDefault = -1,
0065 kImgPoor = 0,
0066 kImgFast = 1,
0067 kImgGood = 2,
0068 kImgBest = 3
0069 };
0070
0071 protected:
0072 EImageQuality fImageQuality{kImgDefault};
0073 UInt_t fImageCompression{0};
0074 Bool_t fConstRatio{kFALSE};
0075 TImagePalette fPalette;
0076 TPaletteEditor *fPaletteEditor{nullptr};
0077 Bool_t fPaletteEnabled{kFALSE};
0078
0079 public:
0080 TAttImage();
0081 TAttImage(EImageQuality lquality, UInt_t lcompression, Bool_t constRatio);
0082 virtual ~TAttImage();
0083
0084 void Copy(TAttImage &attline) const;
0085 Bool_t GetConstRatio() const { return fConstRatio; }
0086 UInt_t GetImageCompression() const { return fImageCompression; }
0087 EImageQuality GetImageQuality() const { return fImageQuality; }
0088 virtual const TImagePalette &GetPalette() const { return fPalette; }
0089
0090 virtual void ResetAttImage(Option_t *option="");
0091 virtual void SaveImageAttributes(std::ostream &out, const char *name,
0092 EImageQuality qualdef = kImgDefault,
0093 UInt_t comprdef = 0,
0094 Bool_t constRatiodef = kTRUE);
0095 virtual void SetConstRatio(Bool_t constRatio = kTRUE);
0096 virtual void SetPaletteEnabled(Bool_t on = kTRUE) { fPaletteEnabled = on; }
0097 virtual void SetImageCompression(UInt_t lcompression)
0098 { fImageCompression = (lcompression > 100) ? 100 : lcompression; }
0099 virtual void SetImageQuality(EImageQuality lquality)
0100 { fImageQuality = lquality;}
0101 virtual void SetPalette(const TImagePalette *palette);
0102 virtual void StartPaletteEditor();
0103 virtual void EditorClosed() { fPaletteEditor = nullptr; }
0104 Bool_t IsPaletteEnabled() const { return fPaletteEnabled; }
0105
0106 ClassDef(TAttImage,1)
0107 };
0108
0109 R__EXTERN TImagePalette *gHistImagePalette;
0110 R__EXTERN TImagePalette *gWebImagePalette;
0111
0112 #endif