28 Color_t colorIndices[5] = {};
29 if (ROOT::CocoaTutorials::FindFreeCustomColorIndices(colorIndices) != 5) {
30 ::Error(
"grad",
"failed to create new custom colors");
35 TCanvas *
const cnv =
new TCanvas(
"gradient demo 1",
"gradient demo 1", 100, 100, 600, 600);
37 if (gVirtualX && !gVirtualX->InheritsFrom(
"TGCocoa")) {
38 ::Error(
"grad",
"This macro works only on MacOS X with --enable-cocoa");
43 typedef TColorGradient::Point Point;
54 const Color_t &frameGradient = colorIndices[2];
57 new TColor(colorIndices[0], 0.25, 0.25, 0.25,
"special pad color1", 0.55);
58 new TColor(colorIndices[1], 1., 1., 1.,
"special pad color2", 0.05);
60 const Double_t locations[] = {0., 0.2, 0.8, 1.};
61 const Color_t gradientIndices[4] = {colorIndices[0], colorIndices[1], colorIndices[1], colorIndices[0]};
64 TLinearGradient *
const gradFill1 =
new TLinearGradient(frameGradient, 4, locations, gradientIndices);
66 gradFill1->SetStartEnd(Point(0., 0.), Point(1., 0.));
70 const Color_t &padGradient = colorIndices[3];
73 const Double_t locations[] = {0., 1.};
74 const Color_t gradientIndices[2] = {30, 38};
77 TLinearGradient *
const gradFill2 =
new TLinearGradient(padGradient, 2, locations, gradientIndices);
79 gradFill2->SetStartEnd(Point(0., 0.), Point(0., 1.));
83 const Color_t &histGradient = colorIndices[4];
86 const Color_t gradientIndices[3] = {kYellow, kOrange, kRed};
87 const Double_t locations[3] = {0., 0.5, 1.};
90 TLinearGradient *
const gradFill3 =
new TLinearGradient(histGradient, 3, locations, gradientIndices);
92 gradFill3->SetStartEnd(Point(0., 0.), Point(0., 1.));
95 cnv->SetFillColor(padGradient);
96 cnv->SetFrameFillColor(frameGradient);
98 TH1F *
const hist =
new TH1F(
"a1",
"b1", 20, -3., 3.);
99 hist->SetFillColor(histGradient);
100 hist->FillRandom(
"gaus", 100000);