Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
17class TAttImage;
18
20
21protected:
22 TAttImage *fAttImage{nullptr}; // image attributes to be edited
23
24public:
26 virtual ~TPaletteEditor() { }
27
28 virtual void CloseWindow();
29
30 ClassDef(TPaletteEditor, 0) // Base class for palette editor
31};
32
33class TImagePalette : public TObject {
34
35public:
36 UInt_t fNumPoints{0}; ///< number of anchor points
37 Double_t *fPoints{nullptr}; ///< [fNumPoints] value of each anchor point [0..1]
38 UShort_t *fColorRed{nullptr}; ///< [fNumPoints] red color at each anchor point
39 UShort_t *fColorGreen{nullptr}; ///< [fNumPoints] green color at each anchor point
40 UShort_t *fColorBlue{nullptr}; ///< [fNumPoints] blue color at each anchor point
41 UShort_t *fColorAlpha{nullptr}; ///< [fNumPoints] alpha at each anchor point
42
44 TImagePalette(const TImagePalette &palette);
45 TImagePalette(UInt_t numPoints);
47 ~TImagePalette() override;
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 ClassDefOverride(TImagePalette,2) // Color Palette for value -> color conversion
57};
58
59class TAttImage {
60
61public:
62 // Defines level of output quality/speed ratio
68 kImgBest = 3
69 };
70
71protected:
72 EImageQuality fImageQuality{kImgDefault}; ///< *OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}*
73 UInt_t fImageCompression{0}; ///< compression [0 .. 100] 0: no compression
74 Bool_t fConstRatio{kFALSE}; ///< keep aspect ratio of image on the screen
75 TImagePalette fPalette; ///< color palette for value -> color conversion
76 TPaletteEditor *fPaletteEditor{nullptr}; ///<! GUI to edit the color palette
77 Bool_t fPaletteEnabled{kFALSE}; ///<! kTRUE - palette is drawn on the image
78
79public:
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; }
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*
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 = nullptr; }
105
106 ClassDef(TAttImage,1) //Image attributes
107};
108
109R__EXTERN TImagePalette *gHistImagePalette; // palette used in TH2::Draw("col")
110R__EXTERN TImagePalette *gWebImagePalette; // 6x6x6 colors web palette
111
112#endif
#define R__EXTERN
Definition DllImport.h:26
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
unsigned short UShort_t
Definition RtypesCore.h:40
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:337
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
R__EXTERN TImagePalette * gHistImagePalette
Definition TAttImage.h:109
R__EXTERN TImagePalette * gWebImagePalette
Definition TAttImage.h:110
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition TGX11.cxx:110
Color * colors
Definition X3DBuffer.c:21
TImage attributes.
Definition TAttImage.h:59
TPaletteEditor * fPaletteEditor
! GUI to edit the color palette
Definition TAttImage.h:76
virtual void ResetAttImage(Option_t *option="")
Reset this image attributes to default values.
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Bool_t fConstRatio
keep aspect ratio of image on the screen
Definition TAttImage.h:74
virtual ~TAttImage()
TAttImage destructor.
EImageQuality GetImageQuality() const
Definition TAttImage.h:87
Bool_t GetConstRatio() const
Definition TAttImage.h:85
virtual const TImagePalette & GetPalette() const
Definition TAttImage.h:88
virtual void SetPaletteEnabled(Bool_t on=kTRUE)
Definition TAttImage.h:96
UInt_t fImageCompression
compression [0 .. 100] 0: no compression
Definition TAttImage.h:73
EImageQuality fImageQuality
OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",...
Definition TAttImage.h:72
Bool_t IsPaletteEnabled() const
Definition TAttImage.h:104
TAttImage()
TAttImage default constructor.
virtual void SetImageQuality(EImageQuality lquality)
Definition TAttImage.h:99
void Copy(TAttImage &attline) const
Copy this image attributes to a new attimage.
@ kImgDefault
Definition TAttImage.h:64
TImagePalette fPalette
color palette for value -> color conversion
Definition TAttImage.h:75
virtual void SetImageCompression(UInt_t lcompression)
Definition TAttImage.h:97
UInt_t GetImageCompression() const
Definition TAttImage.h:86
virtual void EditorClosed()
Definition TAttImage.h:103
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
Definition TAttImage.h:77
virtual void SetConstRatio(Bool_t constRatio=kTRUE)
Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
virtual void SaveImageAttributes(std::ostream &out, const char *name, EImageQuality qualdef=kImgDefault, UInt_t comprdef=0, Bool_t constRatiodef=kTRUE)
Save image attributes as C++ statement(s) on output stream, but not the palette.
A class to define a conversion from pixel values to pixel color.
Definition TAttImage.h:33
TImagePalette & operator=(const TImagePalette &palette)
Assignment operator.
virtual Int_t * GetRootColors()
Returns a list of ROOT colors.
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition TAttImage.h:38
~TImagePalette() override
Destructor.
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
Definition TAttImage.h:37
static TImagePalette * CreateCOLPalette(Int_t nContours)
Factory method to creates an image palette for histogram plotting.
TImagePalette()
Default constructor, sets all pointers to 0.
virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b)
Returns an index of the closest color.
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
Definition TAttImage.h:39
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
Definition TAttImage.h:40
UInt_t fNumPoints
number of anchor points
Definition TAttImage.h:36
static TImagePalette * Create(Option_t *opts)
Factory method to creates an image palette of a specific typ.
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition TAttImage.h:41
Mother of all ROOT objects.
Definition TObject.h:41
Edit the palette via a GUI.
Definition TAttImage.h:19
virtual ~TPaletteEditor()
Definition TAttImage.h:26
virtual void CloseWindow()
Closes the window and deletes itself.
TAttImage * fAttImage
Definition TAttImage.h:22