Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion core/base/src/TColor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2027,14 +2027,26 @@ Int_t TColor::GetColorDark(Int_t n)

////////////////////////////////////////////////////////////////////////////////
/// Static function: Returns the transparent color number corresponding to n.
/// The transparency level is given by the alpha value a.
/// The transparency level is given by the alpha value a. If a color with the same
/// RGBa values already exists it is returned.

Int_t TColor::GetColorTransparent(Int_t n, Float_t a)
{
if (n < 0) return -1;

TColor *color = gROOT->GetColor(n);
if (color) {
TObjArray *colors = (TObjArray *)gROOT->GetListOfColors();
Int_t ncolors = colors->GetSize();
TColor *col = 0;
for (Int_t i = 0; i < ncolors; i++) {
col = (TColor *)colors->At(i);
if (col) {
if (col->GetRed() == color->GetRed() && col->GetGreen() == color->GetGreen() &&
col->GetBlue() == color->GetBlue() && col->GetAlpha() == a)
return col->GetNumber();
}
}
TColor *colort = new TColor(gROOT->GetListOfColors()->GetLast()+1,
color->GetRed(), color->GetGreen(), color->GetBlue());
colort->SetAlpha(a);
Expand Down