Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TAttImage.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Reiner Rohlfs 24/03/02
3
4/*************************************************************************
5 * Copyright (C) 2001-2001, 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/** \class TAttImage
13\ingroup BasicGraphics
14\ingroup GraphicsAtt
15
16TImage attributes.
17
18Image attributes are:
19
20- Image Quality (see EImageQuality for the list of qualities)
21- Compression defines the compression rate of the color data in the
22 internal image structure. Speed and memory depends
23 on this rate, but not the image display itself
24 0: no compression; 100: max compression
25- Radio Flag: kTRUE the x/y radio of the displayed image is always
26 identical to the original image kFALSE the x and y size of the displayed
27 image depends on the size of the pad
28- Palette: Defines the conversion from a pixel value to the
29 screen color
30
31This class is used (in general by secondary inheritance)
32by some other classes (image display).
33*/
34
35/** \class TImagePalette
36\ingroup BasicGraphics
37
38A class to define a conversion from pixel values to pixel color.
39
40A Palette is defined by some anchor points. Each anchor point has
41a value between 0 and 1 and a color. An image has to be normalized
42and the values between the anchor points are interpolated.
43All member variables are public and can be directly manipulated.
44In most cases the default operator will be used to create a
45TImagePalette. In this case the member arrays have to be allocated
46by an application and will be deleted in the destructor of this
47class.
48
49We provide few predefined palettes:
50
51- gHistImagePalette - palette used in TH2::Draw("col")
52- gWebImagePalette
53 The web palette is a set of 216 colors that will not dither or
54 shift on PCs or Macs. Browsers use this built-in palette when
55 they need to render colors on monitors with only 256 colors
56 (also called 8-bit color monitors).
57 The 6x6x6 web palette provides very quick color index lookup
58 and can be used for good quality conversion of images into
59 2-D histograms.
60- TImagePalette(Int_t ncolors, Int_t *colors)
61 if ncolors <= 0 a default palette (see below) of 50 colors
62 is defined.
63
64if ncolors == 1 && colors == 0, then a Rainbow Palette is created.
65
66if ncolors > 50 and colors=0, the DeepSea palette is used.
67(see TStyle::CreateGradientColorTable for more details)
68
69if ncolors > 0 and colors = 0, the default palette is used with a maximum of ncolors.
70
71The default palette defines:
72- index 0->9 : grey colors from light to dark grey
73- index 10->19 : "brown" colors
74- index 20->29 : "blueish" colors
75- index 30->39 : "redish" colors
76- index 40->49 : basic colors
77*/
78
79/** \class TPaletteEditor
80\ingroup BasicGraphics
81
82Edit the palette via a GUI.
83
84This class provides a way to edit the palette via a GUI.
85*/
86
87
88#include "TAttImage.h"
89#include "TROOT.h"
90#include "TPluginManager.h"
91#include <iostream>
92#include "TColor.h"
93#include "TMath.h"
94#include "TStyle.h"
95#include <vector>
96
97
98
99// definition of a default palette
102 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
103 0xffff, 0xffff, 0xffff, 0xffff
104};
105
107 0x0000, 0x0000, 0x7000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
108 0x7000, 0x8000, 0xffff, 0xffff
109};
110
112 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0000,
113 0x0000, 0x8000, 0xffff, 0xffff
114};
115
117 0x0000, 0x0000, 0x7000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000,
118 0x0000, 0xa000, 0xffff, 0xffff
119};
120
121
122//////////////////////////// Web Palette ///////////////////////////////////////
123static UShort_t gWebBase[6] = { 0, 51, 102, 153, 204, 255 };
124
126
127private:
128 Int_t fCLUT[6][6][6]; // Color LookUp Table
129
130public:
132 int i = 0;
133 fNumPoints = 216;
134 fPoints = new Double_t[216];
135 fColorRed = new UShort_t[216];
136 fColorBlue = new UShort_t[216];
137 fColorGreen = new UShort_t[216];
138 fColorAlpha = new UShort_t[216];
139
140 for (i = 0; i < 214; i++) {
141 fPoints[i + 1] = (double)i/213;
142 }
143 fPoints[0] = 0;
144 fPoints[215] = 1;
145
146 i = 0;
147 for (int r = 0; r < 6; r++) {
148 for (int g = 0; g < 6; g++) {
149 for (int b = 0; b < 6; b++) {
150 fColorRed[i] = gWebBase[r] << 8;
151 fColorGreen[i] = gWebBase[g] << 8;
152 fColorBlue[i] = gWebBase[b] << 8;
153 fColorAlpha[i] = 0xffff;
154 fCLUT[r][g][b] = i;
155 i++;
156 }
157 }
158 }
159 }
160
162 {
166 return fCLUT[ri][gi][bi];
167 }
168
170 {
171 static std::vector<Int_t> gRootColors;
172 if (!gRootColors.empty())
173 return gRootColors.data();
174
175 gRootColors.resize(216);
176
177 int i = 0;
178 for (int r = 0; r < 6; r++) {
179 for (int g = 0; g < 6; g++) {
180 for (int b = 0; b < 6; b++) {
182 i++;
183 }
184 }
185 }
186 return gRootColors.data();
187 }
188};
189
191
192
193////////////////////////////// Hist Palette ////////////////////////////////////
194static Double_t gDefHistP[50] = {
195 0.00,0.02,0.04,0.06,0.08,0.10,0.12,0.14,0.16,0.18,0.20,0.22,0.24,0.26,
196 0.28,0.30,0.32,0.34,0.36,0.38,0.40,0.42,0.44,0.46,0.48,0.50,0.52,0.54,
197 0.56,0.58,0.60,0.62,0.64,0.66,0.68,0.70,0.72,0.74,0.76,0.78,0.80,0.82,
198 0.84,0.86,0.88,0.90,0.92,0.94,0.96,0.98 };
199
200static UShort_t gDefHistR[50] = {
201 242,229,204,178,153,127,102,76,192,204,204,193,186,178,183,173,155,135,
202 175,132,89,137,130,173,122, 117,104,109,124,127,170,89,211,221,188,198,
203 191,170,165,147,206,211,255,0,255,255,0,0,53,0 };
204
205static UShort_t gDefHistG[50] = {
206 242,229,204,178,153,127,102,76,182,198,198,191,181,165,163,153,142,102,
207 206,193,211,168,158,188,142,137,130,122,153,127,165,84,206,186,158,153,
208 130,142,119,104,94,89,0,255,0,255,0,255,53,0 };
209
210static UShort_t gDefHistB[50] = {
211 242,229,204,178,153,127,102,76,172,170,170,168,163,150,155,140,130,86,
212 198,163,84,160,140,198,153,145,150,132,209,155,191,216,135,135,130,124,
213 119,147,122,112,96,84,0,255,255,0,255,0,53,0 };
214
215static UShort_t gDefHistA[50] = {
216 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
217 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
218 255,255,255,255,255,255,255,255,255,255,255,255,255,255 };
219
220static Int_t gDefHistRoot[50] = {
221 19,18,17,16,15,14,13,12,11,20,21,22,23,24,25,26,27,28,29,30, 8,
222 31,32,33,34,35,36,37,38,39,40, 9, 41,42,43,44,45,47,48,49,46,50, 2,
223 7, 6, 5, 4, 3, 112,1};
224
225
227
228public:
230 fNumPoints = 50;
236
237 for (int i = 0; i<50; i++) {
238 fColorRed[i] = fColorRed[i] << 8;
239 fColorGreen[i] = fColorGreen[i] << 8;
240 fColorBlue[i] = fColorBlue[i] << 8;
241 fColorAlpha[i] = fColorAlpha[i] << 8;
242 }
243 }
244
245 Int_t *GetRootColors() override { return gDefHistRoot; }
246};
247
249
250
251////////////////////////////////////////////////////////////////////////////////
252/// Constructor.
253
258
259////////////////////////////////////////////////////////////////////////////////
260/// Closes the window and deletes itself.
261
266
267////////////////////////////////////////////////////////////////////////////////
268/// Default constructor, sets all pointers to 0.
269
273
274////////////////////////////////////////////////////////////////////////////////
275/// Constructor for a palette with numPoints anchor points.
276/// It allocates the memory but does not set any colors.
277
287
288////////////////////////////////////////////////////////////////////////////////
289/// Copy constructor.
290
292{
293 fNumPoints = palette.fNumPoints;
294
296 memcpy(fPoints, palette.fPoints, fNumPoints * sizeof(Double_t));
297
302 memcpy(fColorRed, palette.fColorRed, fNumPoints * sizeof(UShort_t));
303 memcpy(fColorGreen, palette.fColorGreen, fNumPoints * sizeof(UShort_t));
304 memcpy(fColorBlue, palette.fColorBlue, fNumPoints * sizeof(UShort_t));
305 memcpy(fColorAlpha, palette.fColorAlpha, fNumPoints * sizeof(UShort_t));
306}
307
308////////////////////////////////////////////////////////////////////////////////
309/// Creates palette in the same way as TStyle::SetPalette
310
312{
313 Int_t i;
314 static Int_t palette[50] = {19,18,17,16,15,14,13,12,11,20,
315 21,22,23,24,25,26,27,28,29,30, 8,
316 31,32,33,34,35,36,37,38,39,40, 9,
317 41,42,43,44,45,47,48,49,46,50, 2,
318 7, 6, 5, 4, 3, 112,1};
319 TColor *col = nullptr;
320 Float_t step = 0;
321 // set default palette (pad type)
322 if (ncolors <= 0) {
323 ncolors = 50;
324 fNumPoints = ncolors;
325 step = 1./fNumPoints;
331 for (i=0;i<ncolors;i++) {
332 col = gROOT->GetColor(palette[i]);
333 fPoints[i] = i*step;
334 if (col) {
335 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
336 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
337 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
338 }
339 fColorAlpha[i] = 65280;
340 }
341 return;
342 }
343
344 // set Pretty Palette Spectrum Violet->Red
345 if (ncolors == 1 && !colors) {
346 ncolors = 50;
347 fNumPoints = ncolors;
348 step = 1./fNumPoints;
354
355 // 0 point is white
356 fPoints[0] = 0;
357 fColorRed[0] = 255 << 8;
358 fColorGreen[0] = 255 << 8;
359 fColorBlue[0] = 255 << 8;
360 fColorAlpha[0] = 0;
361
362 for (i=1;i<ncolors;i++) {
363 col = gROOT->GetColor(51+i);
364 fPoints[i] = i*step;
365 if (col) {
366 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
367 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
368 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
369 }
370 fColorAlpha[i] = 65280;
371 }
372 return;
373 }
374
375 // set DeepSea palette
376 if (!colors && ncolors > 50) {
377 static const Int_t nRGBs = 5;
378 static Float_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
379 static Float_t red[nRGBs] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
380 static Float_t green[nRGBs] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
381 static Float_t blue[nRGBs] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
388 for (i=0;i<(int)fNumPoints;i++) {
389 fPoints[i] = stops[i];
390 fColorRed[i] = UShort_t(red[i]*255) << 8;
391 fColorGreen[i] = UShort_t(green[i]*255) << 8;
392 fColorBlue[i] = UShort_t(blue[i]*255) << 8;
393 fColorAlpha[i] = 65280;
394 }
395 return;
396 }
397
398 // set user defined palette
399 if (colors) {
400 fNumPoints = ncolors;
401 step = 1./fNumPoints;
407 for (i=0;i<ncolors;i++) {
408 fPoints[i] = i*step;
409 col = gROOT->GetColor(colors[i]);
410 if (col) {
411 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
412 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
413 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
414 fColorAlpha[i] = 65280;
415 } else {
416 fColorRed[i] = 0;
417 fColorGreen[i] = 0;
418 fColorBlue[i] = 0;
419 fColorAlpha[i] = 0;
420 }
421 }
422 }
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Destructor.
427
429{
430 delete [] fPoints;
431 delete [] fColorRed;
432 delete [] fColorGreen;
433 delete [] fColorBlue;
434 delete [] fColorAlpha;
435}
436
437////////////////////////////////////////////////////////////////////////////////
438/// Assignment operator.
439
441{
442 if (this != &palette) {
443 fNumPoints = palette.fNumPoints;
444
445 delete [] fPoints;
447 memcpy(fPoints, palette.fPoints, fNumPoints * sizeof(Double_t));
448
449 delete [] fColorRed;
451 memcpy(fColorRed, palette.fColorRed, fNumPoints * sizeof(UShort_t));
452
453 delete [] fColorGreen;
455 memcpy(fColorGreen, palette.fColorGreen, fNumPoints * sizeof(UShort_t));
456
457 delete [] fColorBlue;
459 memcpy(fColorBlue, palette.fColorBlue, fNumPoints * sizeof(UShort_t));
460
461 delete [] fColorAlpha;
463 memcpy(fColorAlpha, palette.fColorAlpha, fNumPoints * sizeof(UShort_t));
464 }
465
466 return *this;
467}
468
469////////////////////////////////////////////////////////////////////////////////
470/// Returns an index of the closest color
471
473{
474 Int_t ret = 0;
475 UInt_t d = 10000;
476 UInt_t min = 10000;
477
478 for (UInt_t i = 0; i < fNumPoints; i++) {
479 d = TMath::Abs(r - ((fColorRed[i] & 0xff00) >> 8)) +
480 TMath::Abs(g - ((fColorGreen[i] & 0xff00) >> 8)) +
481 TMath::Abs(b - ((fColorBlue[i] & 0xff00) >> 8));
482 if (d < min) {
483 min = d;
484 ret = i;
485 }
486 }
487 return ret;
488}
489
490////////////////////////////////////////////////////////////////////////////////
491/// Returns a list of ROOT colors. Could be used to set histogram palette.
492/// See also TStyle::SetPalette
493
495{
496 static std::vector<Int_t> gRootColors;
497 if (!gRootColors.empty())
498 return gRootColors.data();
499
500 gRootColors.resize(fNumPoints);
501
502 for (UInt_t i = 0; i < fNumPoints; i++)
504
505 return gRootColors.data();
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// TAttImage default constructor.
510/// Calls ResetAttImage to set the attributes to a default state.
511
518
519////////////////////////////////////////////////////////////////////////////////
520/// TAttImage normal constructor.
521/// Image attributes are taken from the argument list
522///
523/// \param[in] lquality must be one of EImageQuality (kImgDefault is same as
524/// kImgGood in the current implementation)
525/// \param[in] lcompression defines the compression rate of the color data in the
526/// image. Speed and memory depends on this rate, but not
527/// the image display itself
528/// 0: no compression; 100: max compression
529/// \param[in] constRatio keeps the aspect ratio of the image constant on the
530/// screen (in pixel units)
531
543
544////////////////////////////////////////////////////////////////////////////////
545/// TAttImage destructor.
546
548{
549 delete fPaletteEditor;
550}
551
552////////////////////////////////////////////////////////////////////////////////
553/// Copy this image attributes to a new attimage.
554
556{
557 attimage.fImageQuality = fImageQuality;
558 attimage.fImageCompression = fImageCompression;
559 attimage.fConstRatio = fConstRatio;
560 attimage.fPalette = fPalette;
561}
562
563////////////////////////////////////////////////////////////////////////////////
564/// Reset this image attributes to default values.
565/// Default values are:
566///
567/// - quality: kImgPoor, (no smoothing while the image is zoomed)
568/// - compression: 0 (no compression)
569/// - constRatio: kTRUE
570/// - palette: a default rainbow palette
571
603
604////////////////////////////////////////////////////////////////////////////////
605/// Save image attributes as C++ statement(s) on output stream, but
606/// not the palette.
607
608void TAttImage::SaveImageAttributes(std::ostream &out, const char *name,
611{
612 if (fImageQuality != qualdef) {
613 out<<" "<<name<<"->SetImageQuality("<<fImageQuality<<");"<<std::endl;
614 }
616 out<<" "<<name<<"->SetImageCompression("<<fImageCompression<<");"<<std::endl;
617 }
618 if (fConstRatio != constRatiodef) {
619 out<<" "<<name<<"->SetConstRatio("<<fConstRatio<<");"<<std::endl;
620 }
621}
622
623////////////////////////////////////////////////////////////////////////////////
624/// Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
625/// The aspect ratio of the image on the screen is constant if the ratio
626/// flag is set. That means one image pixel is always a square on the screen
627/// independent of the pad size and of the size of the zoomed area.
628
633
634////////////////////////////////////////////////////////////////////////////////
635/// Set a new palette for the image. If palette == 0 a default
636/// rainbow color palette is used.
637
670
671////////////////////////////////////////////////////////////////////////////////
672/// Factory method to creates an image palette of a specific typ
673///
674/// Create a new palette
675///
676/// This creates a new TImagePalette based on the
677/// option specified in the parameter. The supported options are:
678///
679/// - "col" - color palette similar in TStyle (i.e. use for "col" option)
680/// - "web" - color palette similar to gWebImagePalette
681/// - "hist" - color palette similar to gHistImagePalette
682///
683/// \param opts the type of palette to create
684///
685/// Ownership of the returned object transfers to the caller.
686///
687/// \retval new palette
688/// \retval nullptr - option does not exist
689
691{
692 TImagePalette* pPalette = nullptr;
693
695 if (option.Contains("col", TString::kIgnoreCase)) {
696 // Define the new palette using the current palette in TStyle
698 Double_t step = 1./(pPalette->fNumPoints-1);
699
700 for (UInt_t i=0; i<pPalette->fNumPoints; ++i) {
701 TColor* pColor = gROOT->GetColor(gStyle->GetColorPalette(i));
702 pPalette->fPoints[i] = i*step;
703 if (pColor) {
704 pPalette->fColorRed[i] = UShort_t(pColor->GetRed()*255) << 8;
705 pPalette->fColorGreen[i] = UShort_t(pColor->GetGreen()*255) << 8;
706 pPalette->fColorBlue[i] = UShort_t(pColor->GetBlue()*255) << 8;
707 }
708 pPalette->fColorAlpha[i] = 0xff00;
709 }
710 } else if (option.Contains("web", TString::kIgnoreCase)) {
712 } else if (option.Contains("hist", TString::kIgnoreCase)) {
713 pPalette = new TWebPalette();
714 }
715
716 return pPalette;
717}
718
719////////////////////////////////////////////////////////////////////////////////
720/// Factory method to creates an image palette for histogram plotting.
721///
722/// Creates a "col" palette with correct number of contours
723///
724/// The behavior is similar to the TImagePalette::Create() method with
725/// the "col" option. The difference here is that the palette will only
726/// contain a specific number of colors. This method is used to create
727/// the palette used in the "col2" and "colz2" options. It handles the
728/// color selection for contours.
729///
730/// \param ncontours number of contours
731///
732/// Ownership of the returned object transfers to the caller.
733///
734/// \return new palette
735
737{
738 Int_t ncolors = gStyle->GetNumberOfColors();
739 Int_t minColor = 0;
740 Double_t scale = 1;
741 if (ncontours != 0 ) {
742 minColor = (0.99*ncolors)/ncontours;
743 scale = static_cast<Double_t>(ncolors)/ncontours;
744 ncolors = ncontours;
745 }
746
747 // Define the new palette using the current palette in TStyle
748 auto pPalette = new TImagePalette(ncolors);
749 Double_t step = 1./(pPalette->fNumPoints-1);
750
751 for (UInt_t i=0; i<pPalette->fNumPoints; ++i) {
753 pPalette->fPoints[i] = i*step;
754 if (pColor) {
755 pPalette->fColorRed[i] = UShort_t(pColor->GetRed()*255) << 8;
756 pPalette->fColorGreen[i] = UShort_t(pColor->GetGreen()*255) << 8;
757 pPalette->fColorBlue[i] = UShort_t(pColor->GetBlue()*255) << 8;
758 pPalette->fColorAlpha[i] = UShort_t(pColor->GetAlpha()*255) << 8;
759 }
760 }
761
762 return pPalette;
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// Opens a GUI to edit the color palette.
767
769{
770 if (!fPaletteEditor)
771 if (auto h = gROOT->GetPluginManager()->FindHandler("TPaletteEditor")) {
772 if (h->LoadPlugin() == -1)
773 return;
774 fPaletteEditor = (TPaletteEditor *) h->ExecPlugin(3, this, 80, 25);
775 }
776}
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:54
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
static UShort_t gBlueDefault[kNUM_DEFAULT_COLORS]
static UShort_t gWebBase[6]
static UShort_t gGreenDefault[kNUM_DEFAULT_COLORS]
TImagePalette * gWebImagePalette
static UShort_t gDefHistG[50]
static UShort_t gDefHistA[50]
static UShort_t gDefHistR[50]
const Int_t kNUM_DEFAULT_COLORS
static Double_t gDefHistP[50]
static UShort_t gAlphaDefault[kNUM_DEFAULT_COLORS]
TImagePalette * gHistImagePalette
static UShort_t gDefHistB[50]
static Int_t gDefHistRoot[50]
static UShort_t gRedDefault[kNUM_DEFAULT_COLORS]
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
char name[80]
Definition TGX11.cxx:110
#define gROOT
Definition TROOT.h:411
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
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.
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
TAttImage()
TAttImage default constructor.
void Copy(TAttImage &attline) const
Copy this image attributes to a new attimage.
TImagePalette fPalette
color palette for value -> color conversion
Definition TAttImage.h:75
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.
The color creation and management class.
Definition TColor.h:22
Float_t GetRed() const
Definition TColor.h:61
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
Float_t GetBlue() const
Definition TColor.h:63
Float_t GetGreen() const
Definition TColor.h:62
Int_t * GetRootColors() override
Returns a list of ROOT colors.
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 void CloseWindow()
Closes the window and deletes itself.
TAttImage * fAttImage
Definition TAttImage.h:22
TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Constructor.
Basic string class.
Definition TString.h:138
@ kIgnoreCase
Definition TString.h:285
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Definition TStyle.cxx:1102
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition TStyle.cxx:1176
Int_t fCLUT[6][6][6]
Int_t FindColor(UShort_t r, UShort_t g, UShort_t b) override
Returns an index of the closest color.
Int_t * GetRootColors() override
Returns a list of ROOT colors.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
Definition TMathBase.h:348
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124