SetFillColorAlpha doesn't work

Hello, I usally use, in my macro, this string

float fillcolor=0.35;
h->SetFillColorAlpha(kBlue, fillcolor);

to paint my histograms…but in this macro

simlemma.cpp (110.0 KB)

it doesn’t work (ie. I get white graphs) in no one of my graphs and I can’t understand the reason because of.

Does anyone understand the bug?
Here the Root File https://we.tl/t-NXIqIUMa0c


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/24
Platform: Windows10
Compiler: VS2019


@couet Can you help?

here one can read:

The transparency is available on all platforms when the flag OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc , or on Mac with the Cocoa backend. On the file output it is visible with PDF, PNG, Gif, JPEG, SVG, TeX… but not PostScript.

Thank you [quote=“couet, post:3, topic:40197, full:true”]
here one can read:

  • the flag OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc , or on Mac with the Cocoa backend.
    [/quote]

In other macros, I get the transparency…so my ROOTSYS/etc/system.rootrc it means that it is setted to 1

My output is pdf

Can you try the macro transparency from here and see if you get transparency in the pdf ?

I copied the macro
transparency.cpp (2.6 KB)

but I get this error

Anyway, for example, if I run this macro

calomini.cpp (4.7 KB)

I get the trasparency

Calo_EnDep[0]_LG0_HORSA.pdf (14.4 KB)

I don’t get the trasparency, just using the simlemma.cpp macro…so surely there is a but I can’t find it and unfortunately it is not reported by the compiler…

just do

root [0] .x transparency.cpp

So you surely made a mistake copying the code from calamin.cpp … Try to reduce the macro to the minimum (that’s what I would do anyway) and the error will show.

@couet it worked and I got the trasparency transparency.pdf (14.2 KB)

ok I try to reduce the macro!

Hi @couet I reduced the macro

simlemmarid.cpp (4.0 KB)

but I still can’t understand the bug. Can you test the reduced one please?
Thank you

  			htemppdgv1->SetFillStyle(1001);
   			htemppdgv1->SetFillColorAlpha(kBlue, fillcolor);
1 Like

Thank you @couet…it solved, but it’s strange…Even if I never used this code in old macro…I don’t understand the reason because of I need it in this one.

Because you need to tell that the histogram is drawn with a filled polygon. Otherwise it it drawn with a line.

Thank you @couet then…what did I do (for example in this macro calomini.cpp (4.7 KB) ) to tell that the histogram is drawn with a filled polygon ?

No sure why. is it really important ?

Don’t worry @couet it isn’t important! It was just a curiosity!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.