33 #include "RConfigure.h" 36 # define X_DISPLAY_MISSING 1 40 #include "Windows4root.h" 44 # include <afterbase.h> 46 # include <win32/config.h> 47 # include <win32/afterbase.h> 49 # include <afterimage.h> 56 "ROOT palette file",
"*.pal.root",
57 "ASCII palette file",
"*.pal.txt",
62 0x0000, 0x7000, 0x0000, 0x0000, 0x0000,
63 0xffff, 0xffff, 0x7000, 0x8000, 0xffff
66 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
67 0xffff, 0x0000, 0x0000, 0x8000, 0xffff
70 0x0000, 0x7000, 0xffff, 0xffff, 0x0000,
71 0x0000, 0x0000, 0x0000, 0xa000, 0xffff
113 button->
SetToolTipText(
"Save the palette in a ROOT or an ASCII file");
117 button->
SetToolTipText(
"Read a palette from a ROOT or an ASCII file");
121 button->
SetToolTipText(
"Create a new palette (not yet implemented)");
143 button->
SetToolTipText(
"Apply a log operation to the anchor points of the palette");
147 button->
SetToolTipText(
"Apply a exp operation to the anchor points of the palette");
151 button->
SetToolTipText(
"Make the distance of all anchor points constant");
190 const ASImage *image = ((
TASImage*)attImage)->GetImage();
191 if (image && 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;
200 for (pixel = 1; pixel < numPixel; pixel++) {
205 fHisto =
new TH1D(
"Statistics",
"Pixel histogram of unzoomed image ",
207 for (pixel = 0; pixel < numPixel; pixel++)
437 fprintf(fl,
"%10.9f %04hx %04hx %04hx %04hx\n",
452 gROOT->ProcessLine(
Form(
"gROOT->SaveObjectAs((TASPaletteEditor*)0x%lx,\"%s\",\"%s\");",(
ULong_t)
this,fn,
"q"));
476 if (fscanf(fl,
"%u\n", &numPoints)) {;}
480 if (fscanf(fl,
"%lf %hx %hx %hx %hx\n",
504 if (dirsav) dirsav->
cd();
684 numPt =
id == 0 ? 12 : 13;
687 for (pt = 1; pt <
Int_t(numPt - 1); pt++) {
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);
708 for (pt = 1; pt <
Int_t(numPt - 1) / 2; pt++) {
709 newPalette->
fColorRed[
pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
714 for (; pt <
Int_t(numPt - 1); pt++) {
716 newPalette->
fColorGreen[
pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
717 newPalette->
fColorBlue[
pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
722 for (pt = 1; pt <
Int_t(numPt - 1) / 2; pt++) {
725 newPalette->
fColorBlue[
pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
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);
736 for (pt = 1; pt <
Int_t(numPt + 1) / 2; pt++) {
738 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
740 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
742 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
827 for (
Int_t rp = 0; rp < ramp; rp++) {
882 if (newDelta < 0.001 || oldDelta < 0.001)
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];
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);
920 SCL_DO_COLOR, ASA_ARGB32, 0,
922 delete [] grad.color;
923 delete [] grad.offset;
927 destroy_asimage(&grad_im);
935 :
TLine(x, y1, x, y2)
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Double_t fMinValue
min value of image
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
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...
This is a GUI window to edit a color palette.
Double_t fX1
X of 1st point.
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
static const ASVisual * GetVisual()
Return visual.
void CloseWindow()
Close editor.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
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...
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
TImagePalette * fPalette
current palette
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
TH1D * fHisto
histogram of image pixels
EImageQuality GetImageQuality() const
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
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.
void Paint(Option_t *option)
Actually paint the paletter.
Double_t fX2
X of 2nd point.
void InvertPalette()
The palette is inverted.
virtual void Modify()
Change current line attributes if necessary.
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.
virtual void Layout()
Layout the elements of the composite frame.
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
virtual ~TASPaletteEditor()
Palette editor destructor. Deletes all frames and their layout hints.
TGRadioButton * fRamps[3]
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...
virtual void Paint(Option_t *option="")
Paint this line with its current attributes.
virtual const TImagePalette & GetPalette() const
Edit the palette via a GUI.
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.
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.
virtual void SetX2(Double_t x2)
static UShort_t gBlueRainbow[12]
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
TGCheckButton * fStepButton
void LogPalette()
The anchor points are rescaled by a log operation.
Double_t fY1
Y of 1st point.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
TList * fPaletteList
list of palettes for undo and redo
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
char * Form(const char *fmt,...)
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
void SetStep()
Create a step palette.
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
UInt_t fNumPoints
number of anchor points
void NewPalette(Long_t id)
A new palette is created, depending on the id.
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
TGTextButton * fUnDoButton
virtual void SetX1(Double_t x1)
virtual void Modified(Bool_t flag=1)=0
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
LimitLine(Coord_t x, Coord_t y1, Coord_t y2, TASPaletteEditor *gui)
The blue limit line in the pixel value histogram.
virtual void AddEntry(TGString *s, Int_t id)
TCanvas * GetCanvas() const
TGTextButton * fReDoButton
Describe directory structure in memory.
TRootEmbeddedCanvas * fPaletteCanvas
canvas to draw the current palette
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
A class to define a conversion from pixel values to pixel color.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
void UpdateRange()
Updates the range of the palette.
Mother of all ROOT objects.
TGCheckButton * fAutoUpdate
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
void ExpPalette()
The anchor points are rescaled by a exp operation.
static const char * gFileTypes[]
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
static UShort_t gGreenRainbow[12]
virtual void Add(TObject *obj)
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
Double_t fY2
Y of 2nd point.
TRootEmbeddedCanvas * fHistCanvas
canvas to draw the histogram
virtual void Update()
Update canvas pad buffers.
static UShort_t gRedRainbow[12]
virtual void CloseWindow()
Closes the window and deletes itself.
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.
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)
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.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...