63 const unsigned nBasicColors =
sizeof basicColors /
sizeof basicColors[0];
66 Color_t CreateRandomGradientFill()
68 const Double_t *
const fromRGBA = basicColors[(std::rand() % (nBasicColors / 2))];
70 const Double_t *
const toRGBA = basicColors[nBasicColors / 2 + (std::rand() % (nBasicColors / 2))];
72 const Double_t locations[] = {0., 1.};
73 const Double_t rgbas[] = {fromRGBA[0], fromRGBA[1], fromRGBA[2], fromRGBA[3],
74 toRGBA[0], toRGBA[1], toRGBA[2], toRGBA[3]};
90 assert(
gPad !=
nullptr &&
"add_ellipse, no pad to add ellipse");
92 const Color_t newColor = CreateRandomGradientFill();
94 ::Error(
"add_ellipse",
"failed to find a new color index for a gradient fill");
108 void radialgradients()
114 TCanvas *
const cnv =
new TCanvas(
"radial gradients",
"radial gradients", 800, 800);
116 ::Error(
"radialgradients",
"this demo OpenGL");
121 for (
unsigned i = 0; i < 100; ++i)
unsigned FindFreeCustomColorIndices(T(&indices)[N])
R__EXTERN TStyle * gStyle
void SetRadialGradient(const Point ¢er, Double_t radius)
Set radial gradient.
Define a radial color gradient.
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
void Error(const char *location, const char *msgfmt,...)
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
virtual Double_t Rndm()
Machine independent random number generator.
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
R__EXTERN TRandom * gRandom
virtual void Update()
Update canvas pad buffers.
void Modified(Bool_t flag=1)