Re: some 2D geo qiestions

Rene Brun (Rene.Brun@cern.ch)
Fri, 13 Nov 1998 08:24:31 +0100


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;
> }