Logo ROOT  
Reference Guide
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 fNumPoints = 0;
276 fPoints = 0;
277 fColorRed = 0;
278 fColorGreen = 0;
279 fColorBlue = 0;
280 fColorAlpha = 0;
281}
282
283////////////////////////////////////////////////////////////////////////////////
284/// Constructor for a palette with numPoints anchor points.
285/// It allocates the memory but does not set any colors.
286
288{
289 fNumPoints = numPoints;
295}
296
297////////////////////////////////////////////////////////////////////////////////
298/// Copy constructor.
299
301{
302 fNumPoints = palette.fNumPoints;
303
305 memcpy(fPoints, palette.fPoints, fNumPoints * sizeof(Double_t));
306
311 memcpy(fColorRed, palette.fColorRed, fNumPoints * sizeof(UShort_t));
312 memcpy(fColorGreen, palette.fColorGreen, fNumPoints * sizeof(UShort_t));
313 memcpy(fColorBlue, palette.fColorBlue, fNumPoints * sizeof(UShort_t));
314 memcpy(fColorAlpha, palette.fColorAlpha, fNumPoints * sizeof(UShort_t));
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Creates palette in the same way as TStyle::SetPalette
319
321{
322 fNumPoints = 0;
323 fPoints = 0;
324 fColorRed = 0;
325 fColorGreen = 0;
326 fColorBlue = 0;
327 fColorAlpha = 0;
328
329 Int_t i;
330 static Int_t palette[50] = {19,18,17,16,15,14,13,12,11,20,
331 21,22,23,24,25,26,27,28,29,30, 8,
332 31,32,33,34,35,36,37,38,39,40, 9,
333 41,42,43,44,45,47,48,49,46,50, 2,
334 7, 6, 5, 4, 3, 112,1};
335 TColor *col = 0;
336 Float_t step = 0;
337 // set default palette (pad type)
338 if (ncolors <= 0) {
339 ncolors = 50;
340 fNumPoints = ncolors;
341 step = 1./fNumPoints;
347 for (i=0;i<ncolors;i++) {
348 col = gROOT->GetColor(palette[i]);
349 fPoints[i] = i*step;
350 if (col) {
351 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
352 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
353 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
354 }
355 fColorAlpha[i] = 65280;
356 }
357 return;
358 }
359
360 // set Pretty Palette Spectrum Violet->Red
361 if (ncolors == 1 && colors == 0) {
362 ncolors = 50;
363 fNumPoints = ncolors;
364 step = 1./fNumPoints;
370
371 // 0 point is white
372 fPoints[0] = 0;
373 fColorRed[0] = 255 << 8;
374 fColorGreen[0] = 255 << 8;
375 fColorBlue[0] = 255 << 8;
376 fColorAlpha[0] = 0;
377
378 for (i=1;i<ncolors;i++) {
379 col = gROOT->GetColor(51+i);
380 fPoints[i] = i*step;
381 if (col) {
382 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
383 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
384 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
385 }
386 fColorAlpha[i] = 65280;
387 }
388 return;
389 }
390
391 // set DeepSea palette
392 if (colors == 0 && ncolors > 50) {
393 static const Int_t nRGBs = 5;
394 static Float_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
395 static Float_t red[nRGBs] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
396 static Float_t green[nRGBs] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
397 static Float_t blue[nRGBs] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
398 fNumPoints = nRGBs;
404 for (i=0;i<(int)fNumPoints;i++) {
405 fPoints[i] = stops[i];
406 fColorRed[i] = UShort_t(red[i]*255) << 8;
407 fColorGreen[i] = UShort_t(green[i]*255) << 8;
408 fColorBlue[i] = UShort_t(blue[i]*255) << 8;
409 fColorAlpha[i] = 65280;
410 }
411 return;
412 }
413
414 // set user defined palette
415 if (colors) {
416 fNumPoints = ncolors;
417 step = 1./fNumPoints;
423 for (i=0;i<ncolors;i++) {
424 fPoints[i] = i*step;
425 col = gROOT->GetColor(colors[i]);
426 if (col) {
427 fColorRed[i] = UShort_t(col->GetRed()*255) << 8;
428 fColorGreen[i] = UShort_t(col->GetGreen()*255) << 8;
429 fColorBlue[i] = UShort_t(col->GetBlue()*255) << 8;
430 fColorAlpha[i] = 65280;
431 } else {
432 fColorRed[i] = 0;
433 fColorGreen[i] = 0;
434 fColorBlue[i] = 0;
435 fColorAlpha[i] = 0;
436 }
437 }
438 }
439}
440
441////////////////////////////////////////////////////////////////////////////////
442/// Destructor.
443
445{
446 delete [] fPoints;
447 delete [] fColorRed;
448 delete [] fColorGreen;
449 delete [] fColorBlue;
450 delete [] fColorAlpha;
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Assignment operator.
455
457{
458 if (this != &palette) {
459 fNumPoints = palette.fNumPoints;
460
461 delete [] fPoints;
463 memcpy(fPoints, palette.fPoints, fNumPoints * sizeof(Double_t));
464
465 delete [] fColorRed;
467 memcpy(fColorRed, palette.fColorRed, fNumPoints * sizeof(UShort_t));
468
469 delete [] fColorGreen;
471 memcpy(fColorGreen, palette.fColorGreen, fNumPoints * sizeof(UShort_t));
472
473 delete [] fColorBlue;
475 memcpy(fColorBlue, palette.fColorBlue, fNumPoints * sizeof(UShort_t));
476
477 delete [] fColorAlpha;
479 memcpy(fColorAlpha, palette.fColorAlpha, fNumPoints * sizeof(UShort_t));
480 }
481
482 return *this;
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Returns an index of the closest color
487
489{
490 Int_t ret = 0;
491 UInt_t d = 10000;
492 UInt_t min = 10000;
493
494 for (UInt_t i = 0; i < fNumPoints; i++) {
495 d = TMath::Abs(r - ((fColorRed[i] & 0xff00) >> 8)) +
496 TMath::Abs(g - ((fColorGreen[i] & 0xff00) >> 8)) +
497 TMath::Abs(b - ((fColorBlue[i] & 0xff00) >> 8));
498 if (d < min) {
499 min = d;
500 ret = i;
501 }
502 }
503 return ret;
504}
505
506////////////////////////////////////////////////////////////////////////////////
507/// Returns a list of ROOT colors. Could be used to set histogram palette.
508/// See also TStyle::SetPalette
509
511{
512 static std::vector<Int_t> gRootColors;
513 if (!gRootColors.empty())
514 return gRootColors.data();
515
516 gRootColors.resize(fNumPoints);
517
518 for (UInt_t i = 0; i < fNumPoints; i++)
519 gRootColors[i] = TColor::GetColor(fColorRed[i], fColorGreen[i], fColorBlue[i]);
520
521 return gRootColors.data();
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// TAttImage default constructor.
526/// Calls ResetAttImage to set the attributes to a default state.
527
529{
531 fPaletteEditor = 0;
533}
534
535////////////////////////////////////////////////////////////////////////////////
536/// TAttImage normal constructor.
537/// Image attributes are taken from the argument list
538///
539/// \param[in] lquality must be one of EImageQuality (kImgDefault is same as
540/// kImgGood in the current implementation)
541/// \param[in] lcompression defines the compression rate of the color data in the
542/// image. Speed and memory depends on this rate, but not
543/// the image display itself
544/// 0: no compression; 100: max compression
545/// \param[in] constRatio keeps the aspect ratio of the image constant on the
546/// screen (in pixel units)
547
549 Bool_t constRatio)
550{
552
553 fImageQuality = lquality;
554 fImageCompression = (lcompression > 100) ? 100 : lcompression;
555 fConstRatio = constRatio;
556 fPaletteEditor = 0;
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// TAttImage destructor.
562
564{
565 delete fPaletteEditor;
566}
567
568////////////////////////////////////////////////////////////////////////////////
569/// Copy this image attributes to a new attimage.
570
571void TAttImage::Copy(TAttImage &attimage) const
572{
573 attimage.fImageQuality = fImageQuality;
575 attimage.fConstRatio = fConstRatio;
576 attimage.fPalette = fPalette;
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Reset this image attributes to default values.
581/// Default values are:
582///
583/// - quality: kImgPoor, (no smoothing while the image is zoomed)
584/// - compression: 0 (no compression)
585/// - constRatio: kTRUE
586/// - palette: a default rainbow palette
587
589{
593
594 // set the default palette
595 delete [] fPalette.fPoints;
596 delete [] fPalette.fColorRed;
597 delete [] fPalette.fColorGreen;
598 delete [] fPalette.fColorBlue;
599 delete [] fPalette.fColorAlpha;
600
602
608
613
614 for (Int_t point = 0; point < kNUM_DEFAULT_COLORS - 2; point++)
615 fPalette.fPoints[point + 1] = (double)point / (kNUM_DEFAULT_COLORS - 3);
616 fPalette.fPoints[0] = 0;
618}
619
620////////////////////////////////////////////////////////////////////////////////
621/// Save image attributes as C++ statement(s) on output stream, but
622/// not the palette.
623
624void TAttImage::SaveImageAttributes(std::ostream &out, const char *name,
625 EImageQuality qualdef,
626 UInt_t comprdef, Bool_t constRatiodef)
627{
628 if (fImageQuality != qualdef) {
629 out<<" "<<name<<"->SetImageQuality("<<fImageQuality<<");"<<std::endl;
630 }
631 if (fImageCompression != comprdef) {
632 out<<" "<<name<<"->SetImageCompression("<<fImageCompression<<");"<<std::endl;
633 }
634 if (fConstRatio != constRatiodef) {
635 out<<" "<<name<<"->SetConstRatio("<<fConstRatio<<");"<<std::endl;
636 }
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
641/// The aspect ratio of the image on the screen is constant if the ratio
642/// flag is set. That means one image pixel is always a square on the screen
643/// independent of the pad size and of the size of the zoomed area.
644
646{
647 fConstRatio = constRatio;
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// Set a new palette for the image. If palette == 0 a default
652/// rainbow color palette is used.
653
655{
656 if (palette)
657 fPalette = *palette;
658 else {
659 // set default palette
660
661 delete [] fPalette.fPoints;
662 delete [] fPalette.fColorRed;
663 delete [] fPalette.fColorGreen;
664 delete [] fPalette.fColorBlue;
665 delete [] fPalette.fColorAlpha;
666
668
674
679
680 for (Int_t point = 0; point < kNUM_DEFAULT_COLORS - 2; point++)
681 fPalette.fPoints[point + 1] = (double)point / (kNUM_DEFAULT_COLORS - 3);
682 fPalette.fPoints[0] = 0;
684 }
685}
686
687////////////////////////////////////////////////////////////////////////////////
688/// Factory method to creates an image palette of a specific typ
689///
690/// Create a new palette
691///
692/// This creates a new TImagePalette based on the
693/// option specified in the parameter. The supported options are:
694///
695/// - "col" - color palette similar in TStyle (i.e. use for "col" option)
696/// - "web" - color palette similar to gWebImagePalette
697/// - "hist" - color palette similar to gHistImagePalette
698///
699/// \param opts the type of palette to create
700///
701/// Ownership of the returned object transfers to the caller.
702///
703/// \retval new palette
704/// \retval nullptr - option does not exist
705
707{
708 TImagePalette* pPalette = nullptr;
709
710 TString option(opts);
711 if (option.Contains("col", TString::kIgnoreCase)) {
712 // Define the new palette using the current palette in TStyle
713 pPalette = new TImagePalette(gStyle->GetNumberOfColors());
714 Double_t step = 1./(pPalette->fNumPoints-1);
715
716 for (UInt_t i=0; i<pPalette->fNumPoints; ++i) {
717 TColor* pColor = gROOT->GetColor(gStyle->GetColorPalette(i));
718 pPalette->fPoints[i] = i*step;
719 if (pColor) {
720 pPalette->fColorRed[i] = UShort_t(pColor->GetRed()*255) << 8;
721 pPalette->fColorGreen[i] = UShort_t(pColor->GetGreen()*255) << 8;
722 pPalette->fColorBlue[i] = UShort_t(pColor->GetBlue()*255) << 8;
723 }
724 pPalette->fColorAlpha[i] = 0xff00;
725 }
726 } else if (option.Contains("web", TString::kIgnoreCase)) {
727 pPalette = new TDefHistImagePalette();
728 } else if (option.Contains("hist", TString::kIgnoreCase)) {
729 pPalette = new TWebPalette();
730 }
731
732 return pPalette;
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Factory method to creates an image palette for histogram plotting.
737///
738/// Creates a "col" palette with correct number of contours
739///
740/// The behavior is similar to the TImagePalette::Create() method with
741/// the "col" option. The difference here is that the palette will only
742/// contain a specific number of colors. This method is used to create
743/// the palette used in the "col2" and "colz2" options. It handles the
744/// color selection for contours.
745///
746/// \param ncontours number of contours
747///
748/// Ownership of the returned object transfers to the caller.
749///
750/// \return new palette
751
753{
754 Int_t ncolors = gStyle->GetNumberOfColors();
755 Int_t minColor = 0;
756 Double_t scale = 1;
757 if (ncontours != 0 ) {
758 minColor = (0.99*ncolors)/ncontours;
759 scale = static_cast<Double_t>(ncolors)/ncontours;
760 ncolors = ncontours;
761 }
762
763 // Define the new palette using the current palette in TStyle
764 auto pPalette = new TImagePalette(ncolors);
765 Double_t step = 1./(pPalette->fNumPoints-1);
766
767 for (UInt_t i=0; i<pPalette->fNumPoints; ++i) {
768 TColor* pColor = gROOT->GetColor(gStyle->GetColorPalette(minColor + i*scale));
769 pPalette->fPoints[i] = i*step;
770 if (pColor) {
771 pPalette->fColorRed[i] = UShort_t(pColor->GetRed()*255) << 8;
772 pPalette->fColorGreen[i] = UShort_t(pColor->GetGreen()*255) << 8;
773 pPalette->fColorBlue[i] = UShort_t(pColor->GetBlue()*255) << 8;
774 pPalette->fColorAlpha[i] = UShort_t(pColor->GetAlpha()*255) << 8;
775 }
776 }
777
778 return pPalette;
779}
780
781////////////////////////////////////////////////////////////////////////////////
782/// Opens a GUI to edit the color palette.
783
785{
786 if (fPaletteEditor == 0) {
788
789 if ((h = gROOT->GetPluginManager()->FindHandler("TPaletteEditor"))) {
790 if (h->LoadPlugin() == -1)
791 return;
792 fPaletteEditor = (TPaletteEditor *) h->ExecPlugin(3, this, 80, 25);
793 }
794 }
795}
#define d(i)
Definition: RSha256.hxx:102
#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
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
static UShort_t gBlueDefault[kNUM_DEFAULT_COLORS]
Definition: TAttImage.cxx:119
static UShort_t gWebBase[6]
Definition: TAttImage.cxx:126
static UShort_t gGreenDefault[kNUM_DEFAULT_COLORS]
Definition: TAttImage.cxx:114
TImagePalette * gWebImagePalette
Definition: TAttImage.cxx:193
static UShort_t gDefHistG[50]
Definition: TAttImage.cxx:208
static UShort_t gDefHistA[50]
Definition: TAttImage.cxx:218
static UShort_t gDefHistR[50]
Definition: TAttImage.cxx:203
const Int_t kNUM_DEFAULT_COLORS
Definition: TAttImage.cxx:103
static Double_t gDefHistP[50]
Definition: TAttImage.cxx:197
static UShort_t gAlphaDefault[kNUM_DEFAULT_COLORS]
Definition: TAttImage.cxx:104
TImagePalette * gHistImagePalette
Definition: TAttImage.cxx:251
static UShort_t gDefHistB[50]
Definition: TAttImage.cxx:213
static Int_t gDefHistRoot[50]
Definition: TAttImage.cxx:223
static UShort_t gRedDefault[kNUM_DEFAULT_COLORS]
Definition: TAttImage.cxx:109
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 Float_t Float_t b
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 char Point_t Rectangle_t WindowAttributes_t Float_t Float_t g
char name[80]
Definition: TGX11.cxx:110
#define gROOT
Definition: TROOT.h:404
R__EXTERN TStyle * gStyle
Definition: TStyle.h:414
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.
Definition: TAttImage.cxx:588
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Definition: TAttImage.cxx:654
Bool_t fConstRatio
keep aspect ratio of image on the screen
Definition: TAttImage.h:74
virtual ~TAttImage()
TAttImage destructor.
Definition: TAttImage.cxx:563
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.
Definition: TAttImage.cxx:528
void Copy(TAttImage &attline) const
Copy this image attributes to a new attimage.
Definition: TAttImage.cxx:571
@ kImgPoor
Definition: TAttImage.h:65
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.
Definition: TAttImage.cxx:645
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
Definition: TAttImage.cxx:784
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.
Definition: TAttImage.cxx:624
The color creation and management class.
Definition: TColor.h:19
Float_t GetRed() const
Definition: TColor.h:58
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:1822
Float_t GetAlpha() const
Definition: TColor.h:64
Float_t GetBlue() const
Definition: TColor.h:60
Float_t GetGreen() const
Definition: TColor.h:59
Int_t * GetRootColors() override
Returns a list of ROOT colors.
Definition: TAttImage.cxx:248
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:33
TImagePalette & operator=(const TImagePalette &palette)
Assignment operator.
Definition: TAttImage.cxx:456
virtual Int_t * GetRootColors()
Returns a list of ROOT colors.
Definition: TAttImage.cxx:510
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition: TAttImage.h:38
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.
Definition: TAttImage.cxx:752
TImagePalette()
Default constructor, sets all pointers to 0.
Definition: TAttImage.cxx:273
virtual ~TImagePalette()
Destructor.
Definition: TAttImage.cxx:444
virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b)
Returns an index of the closest color.
Definition: TAttImage.cxx:488
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.
Definition: TAttImage.cxx:706
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition: TAttImage.h:41
Mother of all ROOT objects.
Definition: TObject.h:37
Edit the palette via a GUI.
Definition: TAttImage.h:19
virtual void CloseWindow()
Closes the window and deletes itself.
Definition: TAttImage.cxx:265
TAttImage * fAttImage
Definition: TAttImage.h:22
TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Constructor.
Definition: TAttImage.cxx:257
Basic string class.
Definition: TString.h:136
@ kIgnoreCase
Definition: TString.h:268
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Definition: TStyle.cxx:1057
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition: TStyle.cxx:1123
Int_t fCLUT[6][6][6]
Definition: TAttImage.cxx:131
Int_t FindColor(UShort_t r, UShort_t g, UShort_t b) override
Returns an index of the closest color.
Definition: TAttImage.cxx:164
Int_t * GetRootColors() override
Returns a list of ROOT colors.
Definition: TAttImage.cxx:172
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