RE: Semi-Transparent polygone

From: Valeri Onoutchine <Valeri.Onoutchine_at_cern.ch>
Date: Wed, 13 Jul 2005 12:37:16 +0200

Hi Stanislav,
you can use TImage/TASImage class which suppotrs alpha-blending. Check:
http://root.cern.ch/root/htmldoc/TImage.html#TImage:FillPolygon the second parameter is a filled polygon color in format #aarrggbb where

aa - alpha, aka transparency (from 0 to 255). 255 - is non-transparent 
rr - red
gg - green
bb - blue

in hex format.

For example, to create a blue 50% transparent polygon use #880000ff color

Regards. Valeriy

-----Original Message-----

From:	owner-roottalk_at_pcroot.cern.ch on behalf of Stanislav Nesterov
Sent:	Sat 7/9/2005 10:31 AM
To:	Rene Brun
Cc:	roottalk_at_pcroot.cern.ch
Subject:	Re: [ROOT] Semi-Transparent polygone
Hi Rene,

Thank you for the hint. It is not what I am exactly wanted but it may work in my application.

I hope ROOT will incorporate someday real fill-with-colour transparancy. But I understand that it would require some rework in TVirtualX implementations.

Thank you again and

--
       Best regards,
             Stanislav.

Rene Brun wrote:


> Hi Stanislav,
>
> See this example using fill styles with patterns.
>
> Rene Brun
>
> void trans() {
> TH1F *h1 = new TH1F("h1","test1",100,-2,2);
> TF1 f1("f1","gaus",-2,2);
> f1.SetParameters(1,-0.5,1);
> h1->FillRandom("f1",10000);
> TH1F *h2 = new TH1F("h2","test2",100,-2,2);
> f1.SetParameters(1,0.5,0.3);
> h2->FillRandom("f1",3200);
> h1->SetFillStyle(3001);
> h1->SetFillColor(kRed);
> h1->Draw();
> h2->SetFillStyle(3010); //try styles between 3001 and 3025
> h2->SetFillColor(kBlue);
> h2->Draw("same");
> }
>
>
> On Fri, 8 Jul 2005, Stanislav Nesterov wrote:
>
>> Hello,
>> I would like to know is there any way to draw semi-transparent filled
>> area in ROOT? At least in version 4.x?
>>
>> AFAIK, the only one object (TPad) in ROOT can be blended with
>> underlaying layers. All other graphical objects ignore transparency
>> fill style in sense of blending colours. Maybe today this is not the
>> case?
>>
>> --
>> Best regards,
>> Stanislav.
>>
>
Received on Wed Jul 13 2005 - 12:39:49 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET