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
100
101
102// definition of a default palette
105 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
106 0xffff, 0xffff, 0xffff, 0xffff
107};
108
110 0x0000, 0x0000, 0x7000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
111 0x7000, 0x8000, 0xffff, 0xffff
112};
113
115 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0000,
116 0x0000, 0x8000, 0xffff, 0xffff
117};
118
120 0x0000, 0x0000, 0x7000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000,
121 0x0000, 0xa000, 0xffff, 0xffff
122};
123
124
125//////////////////////////// Web Palette ///////////////////////////////////////
126static UShort_t gWebBase[6] = { 0, 51, 102, 153, 204, 255 };
127
129
130private:
131 Int_t fCLUT[6][6][6]; // Color LookUp Table
132
133public:
135 int i = 0;
136 fNumPoints = 216;
137 fPoints = new Double_t[216];
138 fColorRed = new UShort_t[216];
139 fColorBlue = new UShort_t[216];
140 fColorGreen = new UShort_t[216];
141 fColorAlpha = new UShort_t[216];
142
143 for (i = 0; i < 214; i++) {
144 fPoints[i + 1] = (double)i/213;
145 }
146 fPoints[0] = 0;
147 fPoints[215] = 1;
148
149 i = 0;
150 for (int r = 0; r < 6; r++) {
151 for (int g = 0; g < 6; g++) {
152 for (int b = 0; b < 6; b++) {
153 fColorRed[i] = gWebBase[r] << 8;
154 fColorGreen[i] = gWebBase[g] << 8;
155 fColorBlue[i] = gWebBase[b] << 8;
156 fColorAlpha[i] = 0xffff;
157 fCLUT[r][g][b] = i;
158 i++;
159 }
160 }
161 }
162 }
163
165 {
169 return fCLUT[ri][gi][bi];
170 }
171
173 {
174 static std::vector<Int_t> gRootColors;
175 if (!gRootColors.empty())
176 return gRootColors.data();
177
178 gRootColors.resize(216);
179
180 int i = 0;
181 for (int r = 0; r < 6; r++) {
182 for (int g = 0; g < 6; g++) {
183 for (int b = 0; b < 6; b++) {
184 gRootColors[i] = TColor::GetColor(gWebBase[r], gWebBase[g], gWebBase[b]);
185 i++;
186 }
187 }
188 }
189 return gRootColors.data();
190 }
191};
192
194
195
196////////////////////////////// Hist Palette ////////////////////////////////////
197static Double_t gDefHistP[50] = {
198 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,
199 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,
200 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,
201 0.84,0.86,0.88,0.90,0.92,0.94,0.96,0.98 };
202
203static UShort_t gDefHistR[50] = {
204 242,229,204,178,153,127,102,76,192,204,204,193,186,178,183,173,155,135,
205 175,132,89,137,130,173,122, 117,104,109,124,127,170,89,211,221,188,198,
206 191,170,165,147,206,211,255,0,255,255,0,0,53,0 };
207
208static UShort_t gDefHistG[50] = {
209 242,229,204,178,153,127,102,76,182,198,198,191,181,165,163,153,142,102,
210 206,193,211,168,158,188,142,137,130,122,153,127,165,84,206,186,158,153,
211 130,142,119,104,94,89,0,255,0,255,0,255,53,0 };
212
213static UShort_t gDefHistB[50] = {
214 242,229,204,178,153,127,102,76,172,170,170,168,163,150,155,140,130,86,
215 198,163,84,160,140,198,153,145,150,132,209,155,191,216,135,135,130,124,
216 119,147,122,112,96,84,0,255,255,0,255,0,53,0 };
217
218static UShort_t gDefHistA[50] = {
219 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
220 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
221 255,255,255,255,255,255,255,255,255,255,255,255,255,255 };
222
223static Int_t gDefHistRoot[50] = {
224 19,18,17,16,15,14,13,12,11,20,21,22,23,24,25,26,27,28,29,30, 8,
225 31,32,33,34,35,36,37,38,39,40, 9, 41,42,43,44,45,47,48,49,46,50, 2,
226 7, 6, 5, 4, 3, 112,1};
227
228
230
231public:
233 fNumPoints = 50;
239
240 for (int i = 0; i<50; i++) {
241 fColorRed[i] = fColorRed[i] << 8;
242 fColorGreen[i] = fColorGreen[i] << 8;
243 fColorBlue[i] = fColorBlue[i] << 8;
244 fColorAlpha[i] = fColorAlpha[i] << 8;
245 }
246 }
247
248 Int_t *GetRootColors() override { return gDefHistRoot; }
249};
250
252
253
254////////////////////////////////////////////////////////////////////////////////
255/// Constructor.
256
258{
259 fAttImage = attImage;
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Closes the window and deletes itself.
264
266{
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// Default constructor, sets all pointers to 0.
272
274{
275}
276
277////////////////////////////////////////////////////////////////////////////////
278/// Constructor for a palette with numPoints anchor points.
279/// It allocates the memory but does not set any colors.
280
282{
283 fNumPoints = numPoints;
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Copy constructor.
293
295{
296 fNumPoints = palette.fNumPoints;
297
299 memcpy(fPoints, palette.fPoints, fNumPoints * sizeof(Double_t));
300
305 memcpy(fColorRed, palette.fColorRed, fNumPoints * sizeof(UShort_t));
306 memcpy(fColorGreen, palette.fColorGreen, fNumPoints * sizeof(UShort_t));
307 memcpy(fColorBlue, palette.fColorBlue, fNumPoints * sizeof(UShort_t));
308 memcpy(fColorAlpha, palette.fColorAlpha, fNumPoints * sizeof(UShort_t));
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Creates palette in the same way as TStyle::SetPalette
313
315{
316 Int_t i;
317 static Int_t palette[50] = {19,18,17,16,15,14,13,12,11,20,
318 21,22,23,24,25,26,27,28,29,30, 8,
319 31,32,33,34,35,36,37,38,39,40, 9,
320 41,42,43,44,45,47,48,49,46,50, 2,
321 7, 6, 5, 4, 3, 112,1};
322 TColor *col = nullptr;
323 Float_t step = 0;
324 // set default palette (pad type)
325 if (ncolors <= 0) {
326 ncolors = 50;
327 fNumPoints = ncolors;
328 step = 1./fNumPoints;
334 for (i=0;i<ncolors;i++) {
335 col = gROOT->GetColor(palette[i]);
336 fPoints[i] = i*step;
337 if (col) {
338 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
339 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
340 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
341 }
342 fColorAlpha[i] = 65280;
343 }
344 return;
345 }
346
347 // set Pretty Palette Spectrum Violet->Red
348 if (ncolors == 1 && !colors) {
349 ncolors = 50;
350 fNumPoints = ncolors;
351 step = 1./fNumPoints;
357
358 // 0 point is white
359 fPoints[0] = 0;
360 fColorRed[0] = 255 << 8;
361 fColorGreen[0] = 255 << 8;
362 fColorBlue[0] = 255 << 8;
363 fColorAlpha[0] = 0;
364
365 for (i=1;i<ncolors;i++) {
366 col = gROOT->GetColor(51+i);
367 fPoints[i] = i*step;
368 if (col) {
369 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
370 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
371 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
372 }
373 fColorAlpha[i] = 65280;
374 }
375 return;
376 }
377
378 // set DeepSea palette
379 if (!colors && ncolors > 50) {
380 static const Int_t nRGBs = 5;
381 static Float_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
382 static Float_t red[nRGBs] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
383 static Float_t green[nRGBs] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
384 static Float_t blue[nRGBs] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
385 fNumPoints = nRGBs;
391 for (i=0;i<(int)fNumPoints;i++) {
392 fPoints[i] = stops[i];
393 fColorRed[i] = UShort_t(red[i]*255) << 8;
394 fColorGreen[i] = UShort_t(green[i]*255) << 8;
395 fColorBlue[i] = UShort_t(blue[i]*255) << 8;
396 fColorAlpha[i] = 65280;
397 }
398 return;
399 }
400
401 // set user defined palette
402 if (colors) {
403 fNumPoints = ncolors;
404 step = 1./fNumPoints;
410 for (i=0;i<ncolors;i++) {
411 fPoints[i] = i*step;
412 col = gROOT->GetColor(colors[i]);
413 if (col) {
414 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
415 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
416 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
417 fColorAlpha[i] = 65280;
418 } else {
419 fColorRed[i] = 0;
420 fColorGreen[i] = 0;
421 fColorBlue[i] = 0;
422 fColorAlpha[i] = 0;
423 }
424 }
425 }
426}
427
428////////////////////////////////////////////////////////////////////////////////
429/// Destructor.
430
432{
433 delete [] fPoints;
434 delete [] fColorRed;
435 delete [] fColorGreen;
436 delete [] fColorBlue;
437 delete [] fColorAlpha;
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Assignment operator.
442
444{
445 if (this != &palette) {
446 fNumPoints = palette.fNumPoints;
447
448 delete [] fPoints;
450 memcpy(fPoints, palette.fPoints, fNumPoints * sizeof(Double_t));
451
452 delete [] fColorRed;
454 memcpy(fColorRed, palette.fColorRed, fNumPoints * sizeof(UShort_t));
455
456 delete [] fColorGreen;
458 memcpy(fColorGreen, palette.fColorGreen, fNumPoints * sizeof(UShort_t));
459
460 delete [] fColorBlue;
462 memcpy(fColorBlue, palette.fColorBlue, fNumPoints * sizeof(UShort_t));
463
464 delete [] fColorAlpha;
466 memcpy(fColorAlpha, palette.fColorAlpha, fNumPoints * sizeof(UShort_t));
467 }
468
469 return *this;
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Returns an index of the closest color
474
476{
477 Int_t ret = 0;
478 UInt_t d = 10000;
479 UInt_t min = 10000;
480
481 for (UInt_t i = 0; i < fNumPoints; i++) {
482 d = TMath::Abs(r - ((fColorRed[i] & 0xff00) >> 8)) +
483 TMath::Abs(g - ((fColorGreen[i] & 0xff00) >> 8)) +
484 TMath::Abs(b - ((fColorBlue[i] & 0xff00) >> 8));
485 if (d < min) {
486 min = d;
487 ret = i;
488 }
489 }
490 return ret;
491}
492
493////////////////////////////////////////////////////////////////////////////////
494/// Returns a list of ROOT colors. Could be used to set histogram palette.
495/// See also TStyle::SetPalette
496
498{
499 static std::vector<Int_t> gRootColors;
500 if (!gRootColors.empty())
501 return gRootColors.data();
502
503 gRootColors.resize(fNumPoints);
504
505 for (UInt_t i = 0; i < fNumPoints; i++)
506 gRootColors[i] = TColor::GetColor(fColorRed[i], fColorGreen[i], fColorBlue[i]);
507
508 return gRootColors.data();
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// TAttImage default constructor.
513/// Calls ResetAttImage to set the attributes to a default state.
514
516{
518 fPaletteEditor = nullptr;
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// TAttImage normal constructor.
524/// Image attributes are taken from the argument list
525///
526/// \param[in] lquality must be one of EImageQuality (kImgDefault is same as
527/// kImgGood in the current implementation)
528/// \param[in] lcompression defines the compression rate of the color data in the
529/// image. Speed and memory depends on this rate, but not
530/// the image display itself
531/// 0: no compression; 100: max compression
532/// \param[in] constRatio keeps the aspect ratio of the image constant on the
533/// screen (in pixel units)
534
536 Bool_t constRatio)
537{
539
540 fImageQuality = lquality;
541 fImageCompression = (lcompression > 100) ? 100 : lcompression;
542 fConstRatio = constRatio;
543 fPaletteEditor = nullptr;
545}
546
547////////////////////////////////////////////////////////////////////////////////
548/// TAttImage destructor.
549
551{
552 delete fPaletteEditor;
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Copy this image attributes to a new attimage.
557
558void TAttImage::Copy(TAttImage &attimage) const
559{
560 attimage.fImageQuality = fImageQuality;
562 attimage.fConstRatio = fConstRatio;
563 attimage.fPalette = fPalette;
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Reset this image attributes to default values.
568/// Default values are:
569///
570/// - quality: kImgPoor, (no smoothing while the image is zoomed)
571/// - compression: 0 (no compression)
572/// - constRatio: kTRUE
573/// - palette: a default rainbow palette
574
576{
580
581 // set the default palette
582 delete [] fPalette.fPoints;
583 delete [] fPalette.fColorRed;
584 delete [] fPalette.fColorGreen;
585 delete [] fPalette.fColorBlue;
586 delete [] fPalette.fColorAlpha;
587
589
595
600
601 for (Int_t point = 0; point < kNUM_DEFAULT_COLORS - 2; point++)
602 fPalette.fPoints[point + 1] = (double)point / (kNUM_DEFAULT_COLORS - 3);
603 fPalette.fPoints[0] = 0;
605}
606
607////////////////////////////////////////////////////////////////////////////////
608/// Save image attributes as C++ statement(s) on output stream, but
609/// not the palette.
610
611void TAttImage::SaveImageAttributes(std::ostream &out, const char *name,
612 EImageQuality qualdef,
613 UInt_t comprdef, Bool_t constRatiodef)
614{
615 if (fImageQuality != qualdef) {
616 out<<" "<<name<<"->SetImageQuality("<<fImageQuality<<");"<<std::endl;
617 }
618 if (fImageCompression != comprdef) {
619 out<<" "<<name<<"->SetImageCompression("<<fImageCompression<<");"<<std::endl;
620 }
621 if (fConstRatio != constRatiodef) {
622 out<<" "<<name<<"->SetConstRatio("<<fConstRatio<<");"<<std::endl;
623 }
624}
625
626////////////////////////////////////////////////////////////////////////////////
627/// Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
628/// The aspect ratio of the image on the screen is constant if the ratio
629/// flag is set. That means one image pixel is always a square on the screen
630/// independent of the pad size and of the size of the zoomed area.
631
633{
634 fConstRatio = constRatio;
635}
636
637////////////////////////////////////////////////////////////////////////////////
638/// Set a new palette for the image. If palette == 0 a default
639/// rainbow color palette is used.
640
642{
643 if (palette)
644 fPalette = *palette;
645 else {
646 // set default palette
647
648 delete [] fPalette.fPoints;
649 delete [] fPalette.fColorRed;
650 delete [] fPalette.fColorGreen;
651 delete [] fPalette.fColorBlue;
652 delete [] fPalette.fColorAlpha;
653
655
661
666
667 for (Int_t point = 0; point < kNUM_DEFAULT_COLORS - 2; point++)
668 fPalette.fPoints[point + 1] = (double)point / (kNUM_DEFAULT_COLORS - 3);
669 fPalette.fPoints[0] = 0;
671 }
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// Factory method to creates an image palette of a specific typ
676///
677/// Create a new palette
678///
679/// This creates a new TImagePalette based on the
680/// option specified in the parameter. The supported options are:
681///
682/// - "col" - color palette similar in TStyle (i.e. use for "col" option)
683/// - "web" - color palette similar to gWebImagePalette
684/// - "hist" - color palette similar to gHistImagePalette
685///
686/// \param opts the type of palette to create
687///
688/// Ownership of the returned object transfers to the caller.
689///
690/// \retval new palette
691/// \retval nullptr - option does not exist
692
694{
695 TImagePalette* pPalette = nullptr;
696
697 TString option(opts);
698 if (option.Contains("col", TString::kIgnoreCase)) {
699 // Define the new palette using the current palette in TStyle
700 pPalette = new TImagePalette(gStyle->GetNumberOfColors());
701 Double_t step = 1./(pPalette->fNumPoints-1);
702
703 for (UInt_t i=0; i<pPalette->fNumPoints; ++i) {
705 pPalette->fPoints[i] = i*step;
706 if (pColor) {
707 pPalette->fColorRed[i] = UShort_t(pColor->GetRed()*255) << 8;
708 pPalette->fColorGreen[i] = UShort_t(pColor->GetGreen()*255) << 8;
709 pPalette->fColorBlue[i] = UShort_t(pColor->GetBlue()*255) << 8;
710 }
711 pPalette->fColorAlpha[i] = 0xff00;
712 }
713 } else if (option.Contains("web", TString::kIgnoreCase)) {
714 pPalette = new TDefHistImagePalette();
715 } else if (option.Contains("hist", TString::kIgnoreCase)) {
716 pPalette = new TWebPalette();
717 }
718
719 return pPalette;
720}
721
722////////////////////////////////////////////////////////////////////////////////
723/// Factory method to creates an image palette for histogram plotting.
724///
725/// Creates a "col" palette with correct number of contours
726///
727/// The behavior is similar to the TImagePalette::Create() method with
728/// the "col" option. The difference here is that the palette will only
729/// contain a specific number of colors. This method is used to create
730/// the palette used in the "col2" and "colz2" options. It handles the
731/// color selection for contours.
732///
733/// \param ncontours number of contours
734///
735/// Ownership of the returned object transfers to the caller.
736///
737/// \return new palette
738
740{
741 Int_t ncolors = gStyle->GetNumberOfColors();
742 Int_t minColor = 0;
743 Double_t scale = 1;
744 if (ncontours != 0 ) {
745 minColor = (0.99*ncolors)/ncontours;
746 scale = static_cast<Double_t>(ncolors)/ncontours;
747 ncolors = ncontours;
748 }
749
750 // Define the new palette using the current palette in TStyle
751 auto pPalette = new TImagePalette(ncolors);
752 Double_t step = 1./(pPalette->fNumPoints-1);
753
754 for (UInt_t i=0; i<pPalette->fNumPoints; ++i) {
755 TColor* pColor = gROOT->GetColor(gStyle->GetColorPalette(minColor + i*scale));
756 pPalette->fPoints[i] = i*step;
757 if (pColor) {
758 pPalette->fColorRed[i] = UShort_t(pColor->GetRed()*255) << 8;
759 pPalette->fColorGreen[i] = UShort_t(pColor->GetGreen()*255) << 8;
760 pPalette->fColorBlue[i] = UShort_t(pColor->GetBlue()*255) << 8;
761 pPalette->fColorAlpha[i] = UShort_t(pColor->GetAlpha()*255) << 8;
762 }
763 }
764
765 return pPalette;
766}
767
768////////////////////////////////////////////////////////////////////////////////
769/// Opens a GUI to edit the color palette.
770
772{
773 if (!fPaletteEditor)
774 if (auto h = gROOT->GetPluginManager()->FindHandler("TPaletteEditor")) {
775 if (h->LoadPlugin() == -1)
776 return;
777 fPaletteEditor = (TPaletteEditor *) h->ExecPlugin(3, this, 80, 25);
778 }
779}
#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
Definition RtypesCore.h:40
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
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]
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:406
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
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:21
Float_t GetRed() const
Definition TColor.h:60
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:1839
Float_t GetAlpha() const
Definition TColor.h:66
Float_t GetBlue() const
Definition TColor.h:62
Float_t GetGreen() const
Definition TColor.h:61
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:139
@ kIgnoreCase
Definition TString.h:277
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Definition TStyle.cxx:1097
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition TStyle.cxx:1171
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:347
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123