Re: Colors under 1.03.04

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 16 1997 - 09:22:16 MEST


Marc Mueller wrote:
> 
> Hi,
> Since there are a lot of improvements, I have changed to
> root version 1.03.04 from 1.02 (HP-UX 10.20 and Linux).
> 
> Now, the Postscript semms to work, but I lost my self-defined
> colors. To demonstrate this problem, I have listed this small
> programm.
> {
>    gROOT->Reset();
>    int colNum=48;
>    int colPoint=51;
> 
>    colorList=gROOT->GetListOfColors();
>    while(colorList.LastIndex()>0)
>           colorList.RemoveLast();
> 
>    int mypalette[colNum];
>    for ( int i=0; i<colNum; i++){
>         TColor(i+colPoint,1-(i/(colNum*1.0)),1-(i/(colNum*1.0)),
>                                           (i/(colNum*1.0))," ");
>         if((i+colPoint)<100) {
>                 colorList.RemoveLast(); //TColor *light
>                 colorList.RemoveLast(); //TColor *dark
>           }
>           mypalette[i]=i+colPoint;
>    }
>    c1 = new TCanvas("prtname","Surface Draw",200,10,700,500);
>    gStyle->SetPalette(colNum,mypalette);
> 
>    pad1=new TPad("pad1","Title",0,0,1,1,10);
>    pad1->Draw();
>    TF2 *f2 = new TF2("f2","(x^2) + (y^2) - (x^3) -9*x*(y^4)",-2,1,-3,3);
>    f2->SetContour(colNum);
>    f2->SetFillColor(0);
>    pad1->cd();
>    f2->Draw("surf2");
> }
> 
> Please, explain me how to bring up this code to version 1.03.04 .

If in your loop, you replace the statement:
       TColor(i+......
by
       TColor *color = new TColor(i+.....
your macro will work.
The macro behaves as expected. When you go out of the scope of the loop,
all objects created inside (as objects) are deleted.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET