20Color_t CreateRandomGradientFill()
22 std::vector<Int_t> colors;
24 for (
int n = 0;
n < 2; ++
n)
36 gradient->SetColorAlpha(0, 0.2 +
gRandom->
Rndm() * 0.8);
37 gradient->SetColorAlpha(1, 0.2 +
gRandom->
Rndm() * 0.8);
39 ::Error(
"CreateRandomGradientFill",
"failed to find new gradient color with index %d", indx);
48 const Color_t newColor = CreateRandomGradientFill();
50 ::Error(
"add_ellipse",
"failed to find a new color index for a gradient fill");
62void radialgradients(
bool gl =
true)
68 auto cnv =
new TCanvas(
"radialgradients",
"radial gradients", 800, 800);
69 if (!cnv->UseGL() && !cnv->IsWeb())
71 "This macro requires either OpenGL or Web canvas to correctly handle gradient colors");
73 for (
unsigned i = 0; i < 100; ++i)
short Color_t
Color number (short)
double Double_t
Double 8 bytes.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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
R__EXTERN TRandom * gRandom
R__EXTERN TStyle * gStyle
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
static Int_t GetRadialGradient(Double_t r, const std::vector< Int_t > &colors, const std::vector< Double_t > &positions={})
Static function: Returns the radial gradient color number corresponding to specified parameters.
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
void SetRadialGradient(const Point ¢er, Double_t radius)
Set radial gradient.
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
Double_t Rndm() override
Machine independent random number generator.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
void SetCanvasPreferGL(Bool_t prefer=kTRUE)