108 if (px+
py < 0)
return 1;
121 fCanvas->Range(-10.5,-10.5,10.5,10.5);
157 static char info[50];
161 if (
n < 0)
return info;
163 if (!color)
return info;
167 int res =
snprintf(info,
sizeof(info),
"col %d, %s, r=%3d, g=%3d, b=%3d",
n,color->
GetName(),
r,
g,
b);
169 if ((res < 0) || (res >= (
int)
sizeof(info)))
186 if (dx*dx+dy*dy < r2)
return coffset+
i-10;
198 if (ang < 0) ang += 360;
199 if (ang < 60)
return kWhite;
200 if (ang < 120)
return kGray;
201 if (ang < 180)
return kGray+1;
202 if (ang < 240)
return kGray+2;
203 if (ang < 300)
return kGray+3;
216 if (u < fRmin || u >
fRmax)
return -1;
218 if (
v > 0)
return coffset + div+1;
219 return coffset+div-9;
247 fText->SetTextFont(72);
249 fText->SetTextAlign(11);
250 fText->SetTextSize(0.03);
251 fText->SetTextAngle(0);
252 fText->PaintText(-10.2,-10.2,
"ROOT Color Wheel");
265 fArc->SetFillColor(colorn);
266 fArc->SetLineColor(14);
268 fArc->PaintEllipse(u,
v,
r,
r,0,360,0);
269 fText->SetTextSize(0.03);
270 fText->SetTextAlign(22);
286 fText->SetTextAlign(22);
287 fText->SetTextFont(72);
288 fText->SetTextColor(1);
289 fText->SetTextSize(0.03);
291 if (
angle == 240) tangle = -30;
292 if (
angle == 300) tangle = 30;
295 fText->SetTextAngle(tangle);
314 Rotate(rmax+0.62*dr,0,u,
v,ang);
317 fText->SetTextAlign(22);
318 fText->SetTextFont(72);
319 fText->SetTextColor(1);
320 fText->SetTextSize(0.03);
322 if (
angle == 30) tangle = -60;
323 if (
angle == 90) tangle = 0;
324 if (
angle == 150) tangle = 60;
325 if (
angle == 210) tangle = -60;
326 if (
angle == 270) tangle = 0;
327 fText->SetTextAngle(tangle);
334 for (
Int_t j=0;j<2;j++) {
337 Int_t colorn = coffset +
n;
338 color =
gROOT->GetColor(colorn);
343 fGraph->SetFillColor(colorn);
345 Rotate(rmin+
i*dr+0.5*dr,0.5*dy,
x[0],
y[0],ang);
346 fText->SetTextSize(0.03);
347 fText->SetTextAlign(22);
352 if (
angle > 180) tang -=180;
353 fText->SetTextAngle(tang);
368 fLine->SetLineWidth(1);
369 Rotate(rmin+3*dr,-dy,
x[0],
y[0],ang);
370 Rotate(rmin+3*dr, dy,
x[1],
y[1],ang);
372 Rotate(rmin+6*dr,-dy,
x[0],
y[0],ang);
373 Rotate(rmin+6*dr, dy,
x[1],
y[1],ang);
375 Rotate(rmin+9*dr,-dy,
x[0],
y[0],ang);
376 Rotate(rmin+9*dr, dy,
x[1],
y[1],ang);
378 Rotate(rmin+7*dr,-dy,
x[0],
y[0],ang);
379 Rotate(rmin+7*dr, dy,
x[1],
y[1],ang);
393 fArc->PaintEllipse(0,0,
r,
r,0,60,0);
395 fArc->PaintEllipse(0,0,
r,
r,60,120,0);
397 fArc->PaintEllipse(0,0,
r,
r,120,180,0);
399 fArc->PaintEllipse(0,0,
r,
r,180,240,0);
401 fArc->PaintEllipse(0,0,
r,
r,240,300,0);
403 fArc->PaintEllipse(0,0,
r,
r,300,360,0);
405 fText->SetTextAlign(22);
406 fText->SetTextFont(62);
407 fText->SetTextColor(1);
408 fText->SetTextSize(0.02);
409 fText->SetTextAngle(40);
410 fText->PaintText(0.5*
r,0.3*
r,
"kWhite");
411 fText->SetTextAngle(0);
412 fText->PaintText(0,0.8*
r,
"kGray");
413 fText->SetTextColor(10);
414 fText->SetTextFont(72);
415 fText->SetTextSize(0.03);
416 fText->PaintText(-0.6*
r, 0.3*
r,
"+1");
417 fText->PaintText(-0.6*
r,-0.3*
r,
"+2");
418 fText->PaintText(0,-0.6*
r,
"+3");
419 fText->SetTextAngle(-40);
420 fText->SetTextSize(0.02);
421 fText->SetTextFont(62);
422 fText->PaintText(0.5*
r,-0.35*
r,
"kBlack");
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 angle
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Draw the ROOT Color Wheel.
Int_t InRectangles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const
Return the color number when the mouse point to a rectangle.
TCanvas * fCanvas
! Canvas used to draw the Color Wheel
TArc * fArc
! pointer to utility arc
TLine * fLine
! pointer to utility line
Double_t fRgray
Maximum radius of gray circle.
void PaintCircle(Int_t coffset, Int_t n, Double_t x, Double_t y, Double_t ang) const
Draw one color of type circle.
Int_t InCircles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const
Return the color number when the mouse point to a circle.
Double_t fR0
Minimum radius for circles.
Double_t fY[15]
Y coordinates of the center of circles.
Int_t InGray(Double_t x, Double_t y) const
Return the color number when the mouse point to the gray circle.
Double_t fX[15]
X coordinates of the center of circles.
virtual Int_t GetColor(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
Double_t fRmin
Minimum radius for rectangles.
TText * fText
! pointer to utility text
Double_t fRmax
Maximum radius for rectangles.
void PaintGray() const
Draw the gray colors + white + black.
char * GetObjectInfo(Int_t px, Int_t py) const override
Return the color number pointed by the mouse.
void Paint(Option_t *option="") override
Paint the color wheel.
void PaintCircles(Int_t coffset, Double_t angle) const
Draw all colors of type circle.
void Draw(Option_t *option="") override
Paint the color wheel.
Double_t fDr
Circles radius.
void PaintRectangles(Int_t coffset, Double_t angle) const
Draw all colors of type rectangle.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
always return the color wheel
void Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const
Rotate point x,y with an angle=ang.
TGraph * fGraph
! pointer to utility graph
~TColorWheel() override
destructor
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
A TGraph is an object made of two arrays X and Y with npoints each.
Use the TLine constructor to create a simple line.
const char * GetName() const override
Returns name of object.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
@ kCanDelete
if object in a list can be deleted
Base class for several text objects.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.