Re: some 2D geo qiestions

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 13 1998 - 08:24:31 MET


Paul M. Eugenio wrote:
> 
> Hi Rooters,
> 
> I seem to be missing something basic in trying to
> create a simple 2D view.  For example, I'm unable
> to set the line color for a TBox (or TLine) object.
> 
> Also, are there any examples of using the 2D graphics
> classes?
> 
>                 Thanks for any help.
> 
> Below is a simple test macro that I used.
> 

Hi Paul,
In your example below, you draw the box in fill area mode
on top of the line. Simply invert the Draw statements to be:
   box->Draw();
   line->Draw();
If you set a fill area for a box, the box frame is not drawn.
To understand the mechanism, play with mouse and the SetLineAttributes,
SetFillAttributes menu item for the line and box respectively.


Rene Brun

> 
> {
> 
>   gROOT->Reset();
> 
> 
> 
>   c1 = new TCanvas("c1","An other canvas",100,10,700,700);
>   c1->SetFillColor(18);
> 
>   Int_t nboxes=0;
> 
>   TBox *box;
>   TLine *line;
>   Double_t x1=0.1,y1=0.1,x2=0.5,y2=0.5;
> 
>   box = new TBox(x1,y1,x2,y2);
>   line = new TLine(x1,y1,x2,y2);
> 
>   box->SetLineColor(7);
>   box->SetLineWidth(20);
>   box->SetFillColor(10);
>   line->SetLineColor(8);
> 
>   line->Draw();
>   box->Draw();
>   c1->Update();
>   return 0;
> }



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