Logo ROOT   6.12/07
Reference Guide
TASPaletteEditor.cxx
Go to the documentation of this file.
1 // @(#)root/asimage:$Id$
2 // Author: Reiner Rohlfs 24/03/2002
3 
4 /*************************************************************************
5  * Copyright (C) 1995-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 /** \class TASPaletteEditor
13 \ingroup asimage
14 
15 This is a GUI window to edit a color palette.
16 It is called by a pull down menu item of TASImage.
17 */
18 
19 #include "TASImage.h"
20 #include "TRootEmbeddedCanvas.h"
21 #include "TCanvas.h"
22 #include "TH1.h"
23 #include "TFile.h"
24 #include "TASPaletteEditor.h"
25 #include "TGXYLayout.h"
26 #include "TGButton.h"
27 #include "TGComboBox.h"
28 #include "TGFileDialog.h"
29 #include "TLine.h"
30 #include "TROOT.h"
31 #include "TClass.h"
32 #include "TMath.h"
33 #include "RConfigure.h"
34 
35 #ifdef R__HAS_COCOA
36 # define X_DISPLAY_MISSING 1
37 #endif
38 
39 #ifdef WIN32
40 #include "Windows4root.h"
41 #endif
42 
43 #ifndef WIN32
44 # include <afterbase.h>
45 #else
46 # include <win32/config.h>
47 # include <win32/afterbase.h>
48 #endif
49 # include <afterimage.h>
50 extern "C" {
51 # include <bmp.h>
52 }
53 
54 
55 static const char *gFileTypes[] = {
56  "ROOT palette file", "*.pal.root",
57  "ASCII palette file", "*.pal.txt",
58  0, 0
59 };
60 
61 static UShort_t gRedRainbow[12] = {
62  0x0000, 0x7000, 0x0000, 0x0000, 0x0000,
63  0xffff, 0xffff, 0x7000, 0x8000, 0xffff
64 };
65 static UShort_t gGreenRainbow[12] = {
66  0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
67  0xffff, 0x0000, 0x0000, 0x8000, 0xffff
68 };
69 static UShort_t gBlueRainbow[12] = {
70  0x0000, 0x7000, 0xffff, 0xffff, 0x0000,
71  0x0000, 0x0000, 0x0000, 0xa000, 0xffff
72 };
73 
74 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Palette editor constructor.
79 /// The palette editor allows the editing of the color palette of the image.
80 
82  : TPaletteEditor(attImage, w, h), TGMainFrame(0, w, h)
83 {
84  SetLayoutManager(new TGXYLayout(this));
85  fHisto = 0;
86  fLimitLine[0] = 0;
87  fLimitLine[1] = 0;
88  fRampFactor = 0;
89  fImagePad = gPad;
90 
91  fPaletteList = new TList;
93 
94  fPalette = new TImagePalette(attImage->GetPalette());
96 
97  // buttons
98  TGTextButton *button;
99 
100  button = new TGTextButton(this, "&Apply", 1);
101  button->SetToolTipText("Apply the palette to the image");
102  AddFrame(button, new TGXYLayoutHints(70, 1, 8, 1.8));
103 
104  button = new TGTextButton(this, "&Ok", 2);
105  button->SetToolTipText("Same as Apply and Cancel button");
106  AddFrame(button, new TGXYLayoutHints(70, 3, 8, 1.8));
107 
108  button = new TGTextButton(this, "&Cancel", 3);
109  button->SetToolTipText("Close this window");
110  AddFrame(button, new TGXYLayoutHints(70, 5, 8, 1.8));
111 
112  button = new TGTextButton(this, "&Save", 4);
113  button->SetToolTipText("Save the palette in a ROOT or an ASCII file");
114  AddFrame(button, new TGXYLayoutHints(70, 7.5, 8, 1.8));
115 
116  button = new TGTextButton(this, "O&pen", 5);
117  button->SetToolTipText("Read a palette from a ROOT or an ASCII file");
118  AddFrame(button, new TGXYLayoutHints(70, 9.5, 8, 1.8));
119 
120  button = new TGTextButton(this, "&New", 6);
121  button->SetToolTipText("Create a new palette (not yet implemented)");
122  button->SetState(kButtonDisabled);
123  AddFrame(button, new TGXYLayoutHints(70, 12, 8, 1.8));
124 
125  button = new TGTextButton(this, "&Edit", 7);
126  button->SetToolTipText("Edit a palette (not yet implemented)");
127  button->SetState(kButtonDisabled);
128  AddFrame(button, new TGXYLayoutHints(70, 14, 8, 1.8));
129 
130  fAutoUpdate = new TGCheckButton(this, "Auto Update", 13);
131  fAutoUpdate->SetToolTipText("Automatic update of the image (without Apply button)");
132  AddFrame(fAutoUpdate, new TGXYLayoutHints(50, 1, 20, 1.8));
133 
134  fUnDoButton = new TGTextButton(this, "&Undo", 20);
135  fUnDoButton->SetToolTipText("Undo the last modification (repeatable)");
136  AddFrame(fUnDoButton, new TGXYLayoutHints(50, 3, 8, 1.8));
137 
138  fReDoButton = new TGTextButton(this, "&Redo", 21);
139  fReDoButton->SetToolTipText("Undo the last undo operation (repeatable)");
140  AddFrame(fReDoButton, new TGXYLayoutHints(60, 3, 8, 1.8));
141 
142  button = new TGTextButton(this, "&Log", 8);
143  button->SetToolTipText("Apply a log operation to the anchor points of the palette");
144  AddFrame(button, new TGXYLayoutHints(50, 15, 8, 1.8));
145 
146  button = new TGTextButton(this, "E&xp", 9);
147  button->SetToolTipText("Apply a exp operation to the anchor points of the palette");
148  AddFrame(button, new TGXYLayoutHints(50, 17, 8, 1.8));
149 
150  button = new TGTextButton(this, "L&in", 10);
151  button->SetToolTipText("Make the distance of all anchor points constant");
152  AddFrame(button, new TGXYLayoutHints(50, 19, 8, 1.8));
153 
154  button = new TGTextButton(this, "In&vert", 11);
155  button->SetToolTipText("Invert the order of the colors");
156  AddFrame(button, new TGXYLayoutHints(60, 17, 8, 1.8));
157 
158  fStepButton = new TGCheckButton(this, "Step", 12);
159  fStepButton->SetToolTipText("Apply a step function to the palette");
160  AddFrame(fStepButton, new TGXYLayoutHints(60, 19, 8, 1.8));
161 
162  // ramp: 1, 2 or 4
163  TGGroupFrame *rampFrame = new TGGroupFrame(this, "Ramps");
164  rampFrame->SetLayoutManager(new TGXYLayout(rampFrame));
165  AddFrame(rampFrame, new TGXYLayoutHints(50, 8.5, 14, 6,
168 
169  fRamps[0] = new TGRadioButton(rampFrame, "1", 1);
170  fRamps[0]->SetToolTipText("Repeat the palette once");
171  rampFrame->AddFrame(fRamps[0], new TGXYLayoutHints(2, 1.4, 5, 1.8));
172 
173  fRamps[1] = new TGRadioButton(rampFrame, "2", 2);
174  fRamps[1]->SetToolTipText("Repeat the palette twice");
175  rampFrame->AddFrame(fRamps[1], new TGXYLayoutHints(2, 3.3, 5, 1.8));
176 
177  fRamps[2] = new TGRadioButton(rampFrame, "4", 4);
178  fRamps[2]->SetToolTipText("Repeat the palette four times");
179  rampFrame->AddFrame(fRamps[2], new TGXYLayoutHints(8, 3.3, 5, 1.8));
180 
181  fRamps[0]->Associate(this);
182  fRamps[1]->Associate(this);
183  fRamps[2]->Associate(this);
184 
185  // the histogram of the data
186  fHistCanvas = new TRootEmbeddedCanvas("data hist", this, 300, 50);
187  AddFrame(fHistCanvas, new TGXYLayoutHints(1, 1, 48, 20,
189 
190  const ASImage *image = ((TASImage*)attImage)->GetImage();
191  if (image && image->alt.vector) {
192  Int_t pixel;
193  Double_t *data = image->alt.vector;
194  Int_t numPixel = image->width * image->height;
195  Int_t numBins = numPixel / 20;
196  numBins = (numBins < 10) ? 10 : (numBins > 200) ? 200 : numBins;
197 
198  // get min and max value of image
199  fMinValue = fMaxValue = *image->alt.vector;
200  for (pixel = 1; pixel < numPixel; pixel++) {
201  if (fMinValue > *(data + pixel)) fMinValue = *(data + pixel);
202  if (fMaxValue < *(data + pixel)) fMaxValue = *(data + pixel);
203  }
204 
205  fHisto = new TH1D("Statistics", "Pixel histogram of unzoomed image ",
206  numBins, fMinValue, fMaxValue);
207  for (pixel = 0; pixel < numPixel; pixel++)
208  fHisto->Fill(*(data + pixel));
209 
210  fHisto->Draw("HIST");
211  fHisto->GetXaxis()->SetLabelFont(63);
212  fHisto->GetXaxis()->SetLabelSize(10);
213  fHisto->GetYaxis()->SetLabelFont(63);
214  fHisto->GetYaxis()->SetLabelSize(10);
215 
217  0, fHisto->GetMaximum(), this);
218  fLimitLine[0]->Draw();
220  (fMaxValue - fMinValue), 0, fHisto->GetMaximum(), this);
221  fLimitLine[1]->Draw();
222  }
223 
224  // the combobox of different palettes
225  fComboBox = new TGComboBox(this, 100);
226  AddFrame(fComboBox, new TGXYLayoutHints(50, 6, 14, 2));
227 
228  fComboBox->AddEntry("Rainbow", 0);
229  fComboBox->AddEntry("Grey", 1);
230  fComboBox->AddEntry("Hot", 2);
231  fComboBox->AddEntry("Cold", 3);
232  fComboBox->AddEntry("Bowlerhat", 4);
233  fComboBox->AddEntry("", 5);
234 
235 
236  // the palette
237  fPaletteCanvas = new TRootEmbeddedCanvas("palette", this, 300, 50);
238  AddFrame(fPaletteCanvas, new TGXYLayoutHints(1, 22, 78, 2.5,
240 
241  fPaintPalette = new PaintPalette(&fPalette, attImage);
242  fPaintPalette->Draw();
243 
244  MapSubwindows();
245  Layout();
246 
247  SetWindowName("Palette Editor");
248  SetIconName("Palette Editor");
249 
250  MapWindow();
251 
253 }
254 
255 ////////////////////////////////////////////////////////////////////////////////
256 /// Palette editor destructor. Deletes all frames and their layout hints.
257 
259 {
260  TGFrameElement *ptr;
261 
262  // delete all frames and layout hints
263  if (fList) {
264  TIter next(fList);
265  while ((ptr = (TGFrameElement *) next())) {
266  if (ptr->fLayout)
267  delete ptr->fLayout;
268  if (ptr->fFrame)
269  delete ptr->fFrame;
270  }
271  }
272 
273  delete fHisto;
274  delete fPaintPalette;
275  delete fLimitLine[0];
276  delete fLimitLine[1];
277  delete fPaletteList;
278 }
279 
280 ////////////////////////////////////////////////////////////////////////////////
281 /// Close editor.
282 
284 {
286  delete this;
287 }
288 
289 ////////////////////////////////////////////////////////////////////////////////
290 /// Process all editor mouse events
291 
293 {
294  switch (GET_MSG(msg)) {
295 
296  case kC_COMMAND:
297  switch (GET_SUBMSG(msg)) {
298 
299  case kCM_COMBOBOX:
300  NewPalette(param2);
301  break;
302 
303  case kCM_RADIOBUTTON:
304  SetRamp(param1);
305  break;
306 
307  case kCM_CHECKBUTTON:
308  if (param1 == 12)
309  SetStep();
310  break;
311 
312  case kCM_BUTTON:
313  switch (param1) {
314 
315  case 1 : // Apply
317  fImagePad->Modified();
318  fImagePad->Update();
319  break;
320 
321  case 2 : // OK
323  fImagePad->Modified();
324  fImagePad->Update();
325  CloseWindow();
326  break;
327 
328  case 3 : // Cancel
329  CloseWindow();
330  break;
331 
332  case 4 : // Save
333  Save();
334  break;
335 
336  case 5 : // Open
337  Open();
338  break;
339 
340  case 8: // log
341  LogPalette();
342  break;
343 
344  case 9: // exp
345  ExpPalette();
346  break;
347 
348  case 10: // lin
349  LinPalette();
350  break;
351 
352  case 11: // invert
353  InvertPalette();
354  break;
355 
356 
357  case 20: // undo
359  if (fAutoUpdate->GetState() == kButtonDown) {
361  fImagePad->Modified();
362  fImagePad->Update();
363  }
365  break;
366 
367  case 21: // redo
369  if (fAutoUpdate->GetState() == kButtonDown) {
371  fImagePad->Modified();
372  fImagePad->Update();
373  }
375  break;
376 
377  default: ;
378  }
379  break;
380 
381  default: ;
382  }
383  break;
384 
385  default: ;
386  }
387 
388  return kTRUE;
389 }
390 
391 ////////////////////////////////////////////////////////////////////////////////
392 /// The newPalette is inserted in the list of palettes (fPaletteList) and
393 /// fPalette is set to the newPalette. Protected method,
394 
396 {
397  // first remove all palettes in the list which are behind the
398  // current palette
399  TObject *obj;
400  while ((obj = fPaletteList->After(fPalette)) != 0)
401  delete fPaletteList->Remove(obj);
402 
403  // add new palette and make it to the current palette
404  fPaletteList->Add(newPalette);
405  fPalette = newPalette;
406 
407  // update the image
408  if (fAutoUpdate->GetState() == kButtonDown) {
410  fImagePad->Modified();
411  fImagePad->Update();
412  }
413 }
414 
415 ////////////////////////////////////////////////////////////////////////////////
416 /// Saves the current palette either into a ROOT file or in an ASCII file.
417 /// It is called by the Save - button. Protected method.
418 
420 {
421  TGFileInfo fi;
422  fi.fFileTypes = gFileTypes;
423  static Bool_t overwr = kFALSE;
424  fi.fOverwrite = overwr;
425 
426  new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
427  overwr = fi.fOverwrite;
428  if (fi.fFilename == 0)
429  return;
430 
431  if (strcmp(".pal.txt", fi.fFilename + strlen(fi.fFilename) - 8) == 0) {
432  // write into an ASCII file
433  FILE *fl = fopen(fi.fFilename, "w");
434  if (!fl) return;
435  fprintf(fl, "%u\n", fPalette->fNumPoints);
436  for (Int_t pt = 0; pt < Int_t(fPalette->fNumPoints); pt++)
437  fprintf(fl, "%10.9f %04hx %04hx %04hx %04hx\n",
438  fPalette->fPoints[pt],
442  fPalette->fColorAlpha[pt] );
443  fclose(fl);
444  } else {
445  // write into a ROOT file
446  char fn[512];
447  if (strcmp(".pal.root", fi.fFilename + strlen(fi.fFilename) - 9) != 0)
448  snprintf(fn,512, "%s%s", fi.fFilename, ".pal.root");
449  else
450  strlcpy(fn, fi.fFilename,512);
451 
452  gROOT->ProcessLine(Form("gROOT->SaveObjectAs((TASPaletteEditor*)0x%lx,\"%s\",\"%s\");",(ULong_t)this,fn,"q"));
453  }
454 }
455 
456 ////////////////////////////////////////////////////////////////////////////////
457 /// Opens either a ROOT file or an ASCII file and reads a palette.
458 /// It is called by the Open - button. Protected method.
459 
461 {
462  TGFileInfo fi;
463  fi.fFileTypes = gFileTypes;
464 
465  new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
466  if (fi.fFilename == 0)
467  return;
468 
469  TImagePalette *newPalette;
470 
471  if (strcmp(".pal.txt", fi.fFilename + strlen(fi.fFilename) - 8) == 0) {
472  FILE *fl = fopen(fi.fFilename, "r");
473  if (!fl) return;
474  UInt_t numPoints;
475  // coverity [Calling risky function : FALSE]
476  if (fscanf(fl, "%u\n", &numPoints)) {;}
477  newPalette = new TImagePalette(numPoints);
478  for (Int_t pt = 0; pt < Int_t(numPoints); pt++)
479  // coverity [Calling risky function : FALSE]
480  if (fscanf(fl, "%lf %hx %hx %hx %hx\n",
481  newPalette->fPoints + pt,
482  newPalette->fColorRed + pt,
483  newPalette->fColorGreen + pt,
484  newPalette->fColorBlue + pt,
485  newPalette->fColorAlpha + pt )) {;}
486  fclose(fl);
487  } else {
488  // read from a ROOT file
489  char fn[512];
490  if (strcmp(".pal.root", fi.fFilename + strlen(fi.fFilename) - 9) != 0)
491  snprintf(fn,512, "%s%s", fi.fFilename, ".pal.root");
492  else
493  strlcpy(fn, fi.fFilename,512);
494  TDirectory *dirsav = gDirectory;
495 
496  TFile *fsave = new TFile(fn, "READ");
497  if (!fsave->IsOpen()) {
498  delete fsave;
499  return;
500  }
501 
502  newPalette = (TImagePalette*)fsave->Get("TImagePalette");
503  delete fsave;
504  if (dirsav) dirsav->cd();
505  if (!newPalette)
506  return;
507  }
508 
509  InsertNewPalette(newPalette);
511 
512  fComboBox->Select(5); // empty entry
513 }
514 
515 ////////////////////////////////////////////////////////////////////////////////
516 /// All widgets of the screen are updated with the current palette.
517 /// Protected method.
518 
520 {
521  // update the color palette
524 
525  if (histoUpdate) {
526  // update the limit lines
528  fLimitLine[0]->SetX1(xPos);
529  fLimitLine[0]->SetX2(xPos);
530 
532  fLimitLine[1]->SetX1(xPos);
533  fLimitLine[1]->SetX2(xPos);
534 
537  }
538 
539  // update undo / redo button
542 
543  // test if it is a step palette
544  EButtonState step = kButtonDown;
545 
546  Int_t pt;
547  for (pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt += 2)
548  if (TMath::Abs(fPalette->fPoints[pt] - fPalette->fPoints[pt + 1]) > 0.0001 ||
549  fPalette->fColorRed[pt] != fPalette->fColorRed[pt-1] ||
552  step = kButtonUp;
553  fStepButton->SetState(step);
554 
555  // find the ramp factor
556  fRampFactor = 4;
557  Int_t off = (fPalette->fNumPoints - 2) / 4;
558  for (pt = 0; pt < Int_t(fPalette->fNumPoints - 2) / 4 * 3; pt++)
559  if (fPalette->fColorRed[pt + 1] != fPalette->fColorRed[pt + 1 + off] ||
560  fPalette->fColorGreen[pt + 1] != fPalette->fColorGreen[pt + 1 + off] ||
561  fPalette->fColorBlue[pt + 1] != fPalette->fColorBlue[pt + 1 + off] ||
562  fPalette->fColorAlpha[pt + 1] != fPalette->fColorAlpha[pt + 1 + off]) {
563  fRampFactor = 2;
564  break;
565  }
566 
567  off = (fPalette->fNumPoints - 2) / 2;
568  for (pt = 0; pt < Int_t(fPalette->fNumPoints - 2) / 2; pt++)
569  if (fPalette->fColorRed[pt + 1] != fPalette->fColorRed[pt + 1 + off] ||
570  fPalette->fColorGreen[pt + 1] != fPalette->fColorGreen[pt + 1 + off] ||
571  fPalette->fColorBlue[pt + 1] != fPalette->fColorBlue[pt + 1 + off] ||
572  fPalette->fColorAlpha[pt + 1] != fPalette->fColorAlpha[pt + 1 + off]) {
573  fRampFactor = 1;
574  break;
575  }
576 
578  fRamps[1]->SetState(fRampFactor == 2 ? kButtonDown : kButtonUp);
579  fRamps[2]->SetState(fRampFactor == 4 ? kButtonDown : kButtonUp);
580 }
581 
582 ////////////////////////////////////////////////////////////////////////////////
583 /// The anchor points are rescaled by a log operation.
584 /// It is called by the log - button. Protected method.
585 
587 {
588  TImagePalette *newPalette = new TImagePalette(*fPalette);
589 
591 
592  for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
593  newPalette->fPoints[pt] = fPalette->fPoints[1] +
595  TMath::Log(delta + 1) * delta;
596 
597  InsertNewPalette(newPalette);
599 }
600 
601 ////////////////////////////////////////////////////////////////////////////////
602 /// The anchor points are rescaled by a exp operation.
603 /// It is called by the exp - button. Protected method.
604 
606 {
607  TImagePalette *newPalette = new TImagePalette(*fPalette);
608 
610 
611  for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
612  newPalette->fPoints[pt] = fPalette->fPoints[1] +
614  TMath::Log(delta + 1) / delta) - 1;
615 
616  InsertNewPalette(newPalette);
618 }
619 
620 ////////////////////////////////////////////////////////////////////////////////
621 /// The anchor points are rescaled to be linar.
622 /// It is called by the lin - button. Protected method.
623 
625 {
626  TImagePalette *newPalette = new TImagePalette(*fPalette);
627 
629  if (fStepButton->GetState() == kButtonUp) {
630  for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
631  newPalette->fPoints[pt] = fPalette->fPoints[1] +
632  delta * (pt - 1) / (fPalette->fNumPoints - 3);
633  } else {
634  for (Int_t pt = 0; pt < Int_t(fPalette->fNumPoints - 4); pt += 2) {
635  newPalette->fPoints[pt + 3] = fPalette->fPoints[1] + delta * (pt + 2) /
636  (fPalette->fNumPoints - 2) ;
637  newPalette->fPoints[pt + 2] = newPalette->fPoints[pt + 3];
638  }
639  }
640 
641  InsertNewPalette(newPalette);
643 }
644 
645 ////////////////////////////////////////////////////////////////////////////////
646 /// The palette is inverted.
647 /// It is called by the invert - button. Protected method.
648 
650 {
651  TImagePalette *newPalette = new TImagePalette(*fPalette);
652 
653  Int_t pt;
654  for (pt = 0; pt < Int_t(fPalette->fNumPoints); pt++) {
655  newPalette->fColorRed[pt] = fPalette->fColorRed[fPalette->fNumPoints - 1 - pt];
656  newPalette->fColorGreen[pt] = fPalette->fColorGreen[fPalette->fNumPoints - 1 - pt];
657  newPalette->fColorBlue[pt] = fPalette->fColorBlue[fPalette->fNumPoints - 1 - pt];
658  newPalette->fColorAlpha[pt] = fPalette->fColorAlpha[fPalette->fNumPoints - 1 - pt];
659  }
660 
661  for (pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
662  newPalette->fPoints[pt] = fPalette->fPoints[1] +
664  fPalette->fPoints[fPalette->fNumPoints - 1 - pt];
665 
666  InsertNewPalette(newPalette);
668 }
669 
670 ////////////////////////////////////////////////////////////////////////////////
671 /// A new palette is created, depending on the id.
672 /// It is called by the combo box. Protected method.
673 
675 {
676  if (id == 5) // empty entry
677  return;
678 
679  TImagePalette *newPalette;
680 
682  UInt_t numPt;
683 
684  numPt = id == 0 ? 12 : 13;
685  newPalette = new TImagePalette(numPt);
686  Int_t pt;
687  for (pt = 1; pt < Int_t(numPt - 1); pt++) {
688  newPalette->fPoints[pt] = fPalette->fPoints[1] + (pt - 1) * delta / (numPt - 3);
689  newPalette->fColorAlpha[pt] = 0xffff;
690  }
691 
692  switch (id) {
693  case 0: // rainbow
694  memcpy(newPalette->fColorRed + 1, gRedRainbow, 12 * sizeof(UShort_t));
695  memcpy(newPalette->fColorGreen + 1, gGreenRainbow, 12 * sizeof(UShort_t));
696  memcpy(newPalette->fColorBlue + 1, gBlueRainbow, 12 * sizeof(UShort_t));
697  break;
698 
699  case 1: // gray
700  for (pt = 1; pt < Int_t(numPt - 1); pt++) {
701  newPalette->fColorRed[pt] = 0xffff * (pt - 1) / (numPt - 3);
702  newPalette->fColorGreen[pt] = 0xffff * (pt - 1) / (numPt - 3);
703  newPalette->fColorBlue[pt] = 0xffff * (pt - 1) / (numPt - 3);
704  }
705  break;
706 
707  case 2: // hot (red)
708  for (pt = 1; pt < Int_t(numPt - 1) / 2; pt++) {
709  newPalette->fColorRed[pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
710  newPalette->fColorGreen[pt] = 0;
711  newPalette->fColorBlue[pt] = 0;
712  }
713 
714  for (; pt < Int_t(numPt - 1); pt++) {
715  newPalette->fColorRed[pt] = 0xffff;
716  newPalette->fColorGreen[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
717  newPalette->fColorBlue[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
718  }
719  break;
720 
721  case 3: // cold (blue)
722  for (pt = 1; pt < Int_t(numPt - 1) / 2; pt++) {
723  newPalette->fColorRed[pt] = 0;
724  newPalette->fColorGreen[pt] = 0;
725  newPalette->fColorBlue[pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
726  }
727 
728  for (; pt < Int_t(numPt - 1); pt++) {
729  newPalette->fColorRed[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
730  newPalette->fColorGreen[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
731  newPalette->fColorBlue[pt] = 0xffff;
732  }
733  break;
734 
735  case 4: // bolwerhat
736  for (pt = 1; pt < Int_t(numPt + 1) / 2; pt++) {
737  newPalette->fColorRed[pt] = newPalette->fColorRed[numPt - pt - 1]
738  = 0xffff * (pt - 1) / ((numPt - 3) / 2);
739  newPalette->fColorGreen[pt] = newPalette->fColorGreen[numPt - pt - 1]
740  = 0xffff * (pt - 1) / ((numPt - 3) / 2);
741  newPalette->fColorBlue[pt] = newPalette->fColorBlue[numPt - pt - 1]
742  = 0xffff * (pt - 1) / ((numPt - 3) / 2);
743  }
744  break;
745  }
746 
747  newPalette->fPoints[0] = 0;
748  newPalette->fColorRed[0] = newPalette->fColorRed[1];
749  newPalette->fColorGreen[0] = newPalette->fColorGreen[1];
750  newPalette->fColorBlue[0] = newPalette->fColorBlue[1];
751  newPalette->fColorAlpha[0] = newPalette->fColorAlpha[1];
752 
753  newPalette->fPoints[newPalette->fNumPoints-1] = 1.0;
754  newPalette->fColorRed[newPalette->fNumPoints-1] = newPalette->fColorRed[newPalette->fNumPoints-2];
755  newPalette->fColorGreen[newPalette->fNumPoints-1] = newPalette->fColorGreen[newPalette->fNumPoints-2];
756  newPalette->fColorBlue[newPalette->fNumPoints-1] = newPalette->fColorBlue[newPalette->fNumPoints-2];
757  newPalette->fColorAlpha[newPalette->fNumPoints-1] = newPalette->fColorAlpha[newPalette->fNumPoints-2];
758 
759  InsertNewPalette(newPalette);
761 }
762 
763 ////////////////////////////////////////////////////////////////////////////////
764 /// Create a step palette. This is called by the step - check button.
765 /// Protected method.
766 
768 {
769  TImagePalette *newPalette;
770 
771  if (fStepButton->GetState() == kButtonDown) {
772  // change colors in steps
773  newPalette = new TImagePalette(fPalette->fNumPoints * 2 - 2);
774  Double_t fkt = (Double_t)(fPalette->fNumPoints - 3) / (fPalette->fNumPoints - 2);
775  for (Int_t pt = 1; pt < Int_t(fPalette->fNumPoints - 1); pt++) {
776  newPalette->fPoints[pt * 2 - 1] = fPalette->fPoints[1] + (fPalette->fPoints[pt] - fPalette->fPoints[1]) * fkt;
777  newPalette->fPoints[pt * 2] = fPalette->fPoints[1] + (fPalette->fPoints[pt + 1] - fPalette->fPoints[1]) * fkt;
778  newPalette->fColorRed[pt * 2 - 1] = newPalette->fColorRed[pt * 2] = fPalette->fColorRed[pt];
779  newPalette->fColorGreen[pt * 2 - 1] = newPalette->fColorGreen[pt * 2] = fPalette->fColorGreen[pt];
780  newPalette->fColorBlue[pt * 2 - 1] = newPalette->fColorBlue[pt * 2] = fPalette->fColorBlue[pt];
781  newPalette->fColorAlpha[pt * 2 - 1] = newPalette->fColorAlpha[pt * 2] = fPalette->fColorAlpha[pt];
782  }
783  } else {
784  // continuous change of colors
785  newPalette = new TImagePalette(fPalette->fNumPoints / 2 + 1);
788  for (Int_t pt = 1; pt < Int_t(newPalette->fNumPoints - 1); pt++) {
789  newPalette->fPoints[pt] = fPalette->fPoints[pt * 2 -1] * fkt;
790  newPalette->fColorRed[pt] = fPalette->fColorRed[pt * 2 - 1];
791  newPalette->fColorGreen[pt] = fPalette->fColorGreen[pt * 2 - 1];
792  newPalette->fColorBlue[pt] = fPalette->fColorBlue[pt * 2 - 1];
793  newPalette->fColorAlpha[pt] = fPalette->fColorAlpha[pt * 2 - 1];
794  }
795  }
796 
797  newPalette->fPoints[0] = fPalette->fPoints[0];
798  newPalette->fColorRed[0] = fPalette->fColorRed[0];
799  newPalette->fColorGreen[0] = fPalette->fColorGreen[0];
800  newPalette->fColorBlue[0] = fPalette->fColorBlue[0];
801  newPalette->fColorAlpha[0] = fPalette->fColorAlpha[0];
802 
803  newPalette->fPoints[newPalette->fNumPoints-2] = fPalette->fPoints[fPalette->fNumPoints-2];
804  newPalette->fPoints[newPalette->fNumPoints-1] = fPalette->fPoints[fPalette->fNumPoints-1];
805  newPalette->fColorRed[newPalette->fNumPoints-1] = fPalette->fColorRed[fPalette->fNumPoints-1];
806  newPalette->fColorGreen[newPalette->fNumPoints-1] = fPalette->fColorGreen[fPalette->fNumPoints-1];
807  newPalette->fColorBlue[newPalette->fNumPoints-1] = fPalette->fColorBlue[fPalette->fNumPoints-1];
808  newPalette->fColorAlpha[newPalette->fNumPoints-1] = fPalette->fColorAlpha[fPalette->fNumPoints-1];
809 
810  InsertNewPalette(newPalette);
812 }
813 
814 ////////////////////////////////////////////////////////////////////////////////
815 /// The palette is repeated up to 4 times.
816 /// This is called by one of the ramp radio buttons. Protected method.
817 
819 {
820  if (ramp == fRampFactor)
821  return;
822 
823  Int_t ptPerRamp = (fPalette->fNumPoints - 2) / fRampFactor;
824  TImagePalette *newPalette = new TImagePalette(ptPerRamp * ramp + 2);
825 
827  for (Int_t rp = 0; rp < ramp; rp++) {
828  for (Int_t pt = 0; pt < ptPerRamp; pt++) {
829  newPalette->fPoints[1 + pt + rp * ptPerRamp] = fPalette->fPoints[1] +
830  delta / ramp * rp +
831  (fPalette->fPoints[1+pt] - fPalette->fPoints[1]) * fRampFactor / ramp;
832  newPalette->fColorRed [1 + pt + rp * ptPerRamp] = fPalette->fColorRed [1 + pt];
833  newPalette->fColorGreen[1 + pt + rp * ptPerRamp] = fPalette->fColorGreen[1 + pt];
834  newPalette->fColorBlue [1 + pt + rp * ptPerRamp] = fPalette->fColorBlue [1 + pt];
835  newPalette->fColorAlpha[1 + pt + rp * ptPerRamp] = fPalette->fColorAlpha[1 + pt];
836  }
837  }
838 
839  newPalette->fPoints[0] = fPalette->fPoints[0];
840  newPalette->fColorRed[0] = fPalette->fColorRed[0];
841  newPalette->fColorGreen[0] = fPalette->fColorGreen[0];
842  newPalette->fColorBlue[0] = fPalette->fColorBlue[0];
843  newPalette->fColorAlpha[0] = fPalette->fColorAlpha[0];
844 
845  newPalette->fPoints[newPalette->fNumPoints-2] = fPalette->fPoints[fPalette->fNumPoints-2];
846  newPalette->fPoints[newPalette->fNumPoints-1] = fPalette->fPoints[fPalette->fNumPoints-1];
847  newPalette->fColorRed[newPalette->fNumPoints-1] = fPalette->fColorRed[fPalette->fNumPoints-1];
848  newPalette->fColorGreen[newPalette->fNumPoints-1] = fPalette->fColorGreen[fPalette->fNumPoints-1];
849  newPalette->fColorBlue[newPalette->fNumPoints-1] = fPalette->fColorBlue[fPalette->fNumPoints-1];
850  newPalette->fColorAlpha[newPalette->fNumPoints-1] = fPalette->fColorAlpha[fPalette->fNumPoints-1];
851 
852  InsertNewPalette(newPalette);
854 }
855 
856 ////////////////////////////////////////////////////////////////////////////////
857 /// Updates the range of the palette.
858 /// This is called after the blue limit lines were moved to define
859 /// a new range.
860 
862 {
863  if (fMaxValue == fMinValue)
864  return;
865 
866  TImagePalette *newPalette = new TImagePalette(*fPalette);
867 
868  Double_t l0 = fLimitLine[0]->GetX1();
869  Double_t l1 = fLimitLine[1]->GetX1();
870  l0 = (l0 < fMinValue) ? fMinValue : ((l0 > fMaxValue) ? fMaxValue : l0);
871  l1 = (l1 < fMinValue) ? fMinValue : ((l1 > fMaxValue) ? fMaxValue : l1);
872  if (l0 > l1) {
873  Double_t tmp = l0;
874  l0 = l1;
875  l1 = tmp;
876  }
877 
878  Double_t oldDelta = fPalette->fPoints[fPalette->fNumPoints - 2] - fPalette->fPoints[1];
879  Double_t newDelta = (l1 - l0) / (fMaxValue - fMinValue);
880  Double_t newOff = (l0 - fMinValue) / (fMaxValue - fMinValue);
881 
882  if (newDelta < 0.001 || oldDelta < 0.001)
883  return;
884 
885  for (Int_t pt = 1; pt < Int_t(fPalette->fNumPoints - 1); pt++)
886  newPalette->fPoints[pt] = newOff +
887  (fPalette->fPoints[pt] - fPalette->fPoints[1]) * newDelta / oldDelta;
888 
889  InsertNewPalette(newPalette);
891 }
892 
893 ////////////////////////////////////////////////////////////////////////////////
894 /// Actually paint the paletter.
895 
897 {
898  // get geometry of pad
899  Int_t to_w = TMath::Abs(gPad->XtoPixel(gPad->GetX2()) -
900  gPad->XtoPixel(gPad->GetX1()));
901  Int_t to_h = TMath::Abs(gPad->YtoPixel(gPad->GetY2()) -
902  gPad->YtoPixel(gPad->GetY1()));
903 
904  ASGradient grad;
905 
906  grad.npoints = (*fPalette)->fNumPoints - 2;
907  grad.type = GRADIENT_Left2Right;
908  grad.color = new ARGB32[grad.npoints];
909  grad.offset = new double[grad.npoints];
910  for (Int_t pt = 0; pt < grad.npoints; pt++) {
911  grad.offset[pt] = ((*fPalette)->fPoints[pt + 1] - (*fPalette)->fPoints[1]) /
912  ((*fPalette)->fPoints[(*fPalette)->fNumPoints - 2] - (*fPalette)->fPoints[1]);
913  grad.color[pt] = (((ARGB32)((*fPalette)->fColorBlue[pt + 1] & 0xff00)) >> 8) |
914  (((ARGB32)((*fPalette)->fColorGreen[pt + 1] & 0xff00)) ) |
915  (((ARGB32)((*fPalette)->fColorRed[pt + 1] & 0xff00)) << 8) |
916  (((ARGB32)((*fPalette)->fColorAlpha[pt + 1] & 0xff00)) << 16);
917  }
918 
919  ASImage * grad_im = make_gradient((ASVisual*)TASImage::GetVisual(), &grad , to_w, to_h,
920  SCL_DO_COLOR, ASA_ARGB32, 0,
922  delete [] grad.color;
923  delete [] grad.offset;
924 
925  Window_t wid = (Window_t)gVirtualX->GetWindowID(gPad->GetPixmapID());
926  TASImage::Image2Drawable(grad_im, wid, 0, 0);
927  destroy_asimage(&grad_im);
928 }
929 
930 ////////////////////////////////////////////////////////////////////////////////
931 /// The blue limit line in the pixel value histogram.
932 
934  TASPaletteEditor *gui)
935  : TLine(x, y1, x, y2)
936 {
937  fGui = gui;
938  SetLineColor(4);
939  SetLineWidth(2);
940 }
941 
942 ////////////////////////////////////////////////////////////////////////////////
943 /// Paint the limit lines.
944 
946 {
947  fY1 = gPad->GetUymin();
948  fY2 = gPad->GetUymax();
949 
950  TLine::Paint(option);
951 }
952 
953 ////////////////////////////////////////////////////////////////////////////////
954 
956  Int_t px, Int_t /*py*/)
957 {
958  static Int_t oldX;
959 
960  if (!gPad) return;
961 
962  switch(event) {
963  case kMouseMotion:
964  gPad->SetCursor(kMove);
965  break;
966 
967  case kButton1Down:
968  gVirtualX->SetLineColor(-1);
969  TAttLine::Modify(); //Change line attributes only if necessary
970  oldX = gPad->XtoAbsPixel(fX1);
971  break;
972 
973  case kButton1Motion:
974  gVirtualX->DrawLine(oldX, gPad->YtoPixel(fY1), oldX, gPad->YtoPixel(fY2));
975  oldX = px;
976  gVirtualX->DrawLine(oldX, gPad->YtoPixel(fY1), oldX, gPad->YtoPixel(fY2));
977  gVirtualX->Update();
978  break;
979 
980  case kButton1Up:
981  gVirtualX->SetLineColor(-1);
982  TAttLine::Modify(); //Change line attributes only if necessary
983  fX1 = fX2 = gPad->AbsPixeltoX(oldX);
984  fGui->UpdateRange();
985  gPad->Modified(kTRUE);
986  gPad->Update();
987  break;
988 
989  default:
990  break;
991  }
992 }
Double_t GetX1() const
Definition: TLine.h:49
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
Double_t fMinValue
min value of image
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
Definition: TAttImage.h:37
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3244
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition: TH1.cxx:7807
This is a GUI window to edit a color palette.
Double_t fX1
X of 1st point.
Definition: TLine.h:26
Double_t Log(Double_t x)
Definition: TMath.h:648
Bool_t fOverwrite
Definition: TGFileDialog.h:65
const char Option_t
Definition: RtypesCore.h:62
Image class.
Definition: TASImage.h:31
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
static const ASVisual * GetVisual()
Return visual.
Definition: TASImage.cxx:5166
void CloseWindow()
Close editor.
virtual void Update()=0
unsigned short UShort_t
Definition: RtypesCore.h:36
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TH1 * h
Definition: legend2.C:5
void InsertNewPalette(TImagePalette *newPalette)
The newPalette is inserted in the list of palettes (fPaletteList) and fPalette is set to the newPalet...
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:689
TImagePalette * fPalette
current palette
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
TH1D * fHisto
histogram of image pixels
#define gROOT
Definition: TROOT.h:402
EImageQuality GetImageQuality() const
Definition: TAttImage.h:87
#define gClient
Definition: TGClient.h:166
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:982
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Palette editor constructor.
PaintPalette * fPaintPalette
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
void Paint(Option_t *option)
Actually paint the paletter.
Double_t fX2
X of 2nd point.
Definition: TLine.h:28
void InvertPalette()
The palette is inverted.
TGComboBox * fComboBox
virtual void Modify()
Change current line attributes if necessary.
Definition: TAttLine.cxx:232
void UpdateScreen(Bool_t histoUpdate)
All widgets of the screen are updated with the current palette.
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
EButtonState
Definition: TGButton.h:52
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition: TAttImage.h:38
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1563
virtual void SetLabelFont(Style_t font=62)
Set labels&#39; font.
Definition: TAttAxis.cxx:183
TGLayoutHints * fLayout
Definition: TGLayout.h:121
virtual ~TASPaletteEditor()
Palette editor destructor. Deletes all frames and their layout hints.
TGRadioButton * fRamps[3]
Double_t x[n]
Definition: legend1.C:17
const char ** fFileTypes
Definition: TGFileDialog.h:63
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
virtual void Paint(Option_t *option="")
Paint this line with its current attributes.
Definition: TLine.cxx:371
virtual const TImagePalette & GetPalette() const
Definition: TAttImage.h:88
virtual EButtonState GetState() const
Definition: TGButton.h:112
Edit the palette via a GUI.
Definition: TAttImage.h:19
void Paint(Option_t *option)
Paint the limit lines.
Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2)
Process all editor mouse events.
A doubly linked list.
Definition: TList.h:44
void SetRamp(Long_t ramp)
The palette is repeated up to 4 times.
LimitLine * fLimitLine[2]
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void SetX2(Double_t x2)
Definition: TLine.h:65
static UShort_t gBlueRainbow[12]
TList * fList
Definition: TGFrame.h:351
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
TPaveText * pt
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2969
TGCheckButton * fStepButton
Int_t GET_SUBMSG(Long_t val)
void LogPalette()
The anchor points are rescaled by a log operation.
Double_t fY1
Y of 1st point.
Definition: TLine.h:27
double Coord_t
Definition: RtypesCore.h:81
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:818
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition: TList.cxx:368
TList * fPaletteList
list of palettes for undo and redo
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition: TAttImage.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
A simple line.
Definition: TLine.h:23
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Definition: TAttImage.cxx:650
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
void SetStep()
Create a step palette.
TAxis * GetYaxis()
Definition: TH1.h:316
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TList.cxx:327
UInt_t fNumPoints
number of anchor points
Definition: TAttImage.h:36
void NewPalette(Long_t id)
A new palette is created, depending on the id.
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
Definition: TAttImage.h:40
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:204
#define gVirtualX
Definition: TVirtualX.h:350
TGTextButton * fUnDoButton
Int_t GET_MSG(Long_t val)
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual void SetX1(Double_t x1)
Definition: TLine.h:64
long Long_t
Definition: RtypesCore.h:50
virtual void Modified(Bool_t flag=1)=0
Double_t Exp(Double_t x)
Definition: TMath.h:621
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
Definition: TFile.cxx:1395
LimitLine(Coord_t x, Coord_t y1, Coord_t y2, TASPaletteEditor *gui)
The blue limit line in the pixel value histogram.
#define ClassImp(name)
Definition: Rtypes.h:359
double Double_t
Definition: RtypesCore.h:55
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
TCanvas * GetCanvas() const
TGTextButton * fReDoButton
Describe directory structure in memory.
Definition: TDirectory.h:34
unsigned long ULong_t
Definition: RtypesCore.h:51
TRootEmbeddedCanvas * fPaletteCanvas
canvas to draw the current palette
char * fFilename
Definition: TGFileDialog.h:61
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:33
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
void UpdateRange()
Updates the range of the palette.
Mother of all ROOT objects.
Definition: TObject.h:37
TGCheckButton * fAutoUpdate
Handle_t Window_t
Definition: GuiTypes.h:28
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
Definition: TAttImage.h:39
void ExpPalette()
The anchor points are rescaled by a exp operation.
static const char * gFileTypes[]
TVirtualPad * fImagePad
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:497
static UShort_t gGreenRainbow[12]
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual void MapWindow()
Definition: TGFrame.h:251
TImage attributes.
Definition: TAttImage.h:59
#define snprintf
Definition: civetweb.c:822
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
Definition: THist.hxx:284
#define gPad
Definition: TVirtualPad.h:285
Double_t fY2
Y of 2nd point.
Definition: TLine.h:29
TAttImage * fAttImage
Definition: TAttImage.h:22
#define gDirectory
Definition: TDirectory.h:213
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
TRootEmbeddedCanvas * fHistCanvas
canvas to draw the histogram
virtual void Update()
Update canvas pad buffers.
Definition: TCanvas.cxx:2248
static UShort_t gRedRainbow[12]
virtual void CloseWindow()
Closes the window and deletes itself.
Definition: TAttImage.cxx:262
void Open()
Opens either a ROOT file or an ASCII file and reads a palette.
void LinPalette()
The anchor points are rescaled to be linar.
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
void Save()
Saves the current palette either into a ROOT file or in an ASCII file.
Double_t fMaxValue
max value of image
void Modified(Bool_t flag=1)
Definition: TPad.h:414
static void Image2Drawable(ASImage *im, Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="")
Draw asimage on drawable.
Definition: TASImage.cxx:1219
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:315
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185