29const Double_t basicColors[][4] = {{1., 0., 0., 1.},
56const unsigned nBasicColors =
sizeof basicColors /
sizeof basicColors[0];
59Color_t CreateRandomGradientFill()
65 const Double_t *
const fromRGBA = basicColors[(std::rand() % (nBasicColors / 2))];
67 const Double_t *
const toRGBA = basicColors[nBasicColors / 2 + (std::rand() % (nBasicColors / 2))];
69 const Double_t locations[] = {0., 1.};
70 const Double_t rgbas[] = {fromRGBA[0], fromRGBA[1], fromRGBA[2], fromRGBA[3],
71 toRGBA[0], toRGBA[1], toRGBA[2], toRGBA[3]};
82 assert(
gPad !=
nullptr &&
"add_ellipse, no pad to add ellipse");
84 const Color_t newColor = CreateRandomGradientFill();
86 ::Error(
"add_ellipse",
"failed to find a new color index for a gradient fill");
100void radialgradients()
104 TCanvas *
const cnv =
new TCanvas(
"radial gradients",
"radial gradients", 800, 800);
106 ::Error(
"radialgradients",
"this demo requires OS X and ROOT built with --enable-cocoa");
111 for (
unsigned i = 0; i < 100; ++i)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
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
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void Update() override
Update canvas pad buffers.
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
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.
unsigned FindFreeCustomColorIndices(Color_t(&indices)[N])