28 Color_t indices[2] = {};
29 if (ROOT::CocoaTutorials::FindFreeCustomColorIndices(indices) != 2) {
30 ::Error(
"transp",
"failed to create new custom colors");
35 const Color_t redIndex = indices[0], greeIndex = indices[1];
37 new TColor(redIndex, 1., 0., 0.,
"red", 0.85);
38 new TColor(greeIndex, 0., 1., 0.,
"green", 0.5);
41 TCanvas *
const cnv =
new TCanvas(
"transparency",
"transparency demo", 600, 400);
44 if (gVirtualX && !gVirtualX->InheritsFrom(
"TGCocoa")) {
45 Warning(
"transp",
"You can see the transparency ONLY in a pdf or png output (\"File\"->\"Save As\" ->...)\n"
46 "To have transparency in a canvas graphics, you need MacOSX version with cocoa enabled");
49 TH1F *
const hist =
new TH1F(
"a5",
"b5", 10, -2., 3.);
50 TH1F *
const hist2 =
new TH1F(
"c6",
"d6", 10, -3., 3.);
51 hist->FillRandom(
"landau", 100000);
52 hist2->FillRandom(
"gaus", 100000);
54 hist->SetFillColor(redIndex);
55 hist2->SetFillColor(greeIndex);