RE: Changing canvas size

From: Fine, Valeri <fine_at_bnl.gov>
Date: Wed, 1 Apr 2009 09:59:24 -0400

> Yes Valeri we saw that ... but why ? the two prints are just one after
> each other logically they should be the same.

SetWindowSize changes the size of the window via Window manager. It may take time and happen between the first and second SaveAs invocations. (The real outcome is defined but the CPU + Network + etc factors)

Valeri


From: Olivier Couet [mailto:Olivier.Couet_at_cern.ch] Sent: Wed 4/1/2009 9:44 AM
To: Fine, Valeri; OKUMURA, Akira; roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: RE: [ROOT] Changing canvas size

Yes Valeri we saw that ... but why ? the two prints are just one after each other logically they should be the same. BTW I just tried:

{

   Double_t w = 600;
   Double_t h = 600;
   TCanvas * c1 = new TCanvas("c", "c", w, h);    c1->Draw();
   gPad->Modified();
   gPad->Update();

   c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));
   c->SaveAs("c1.png");
   c->SaveAs("c2.png");

}

But I get the same.

-----Original Message-----
From: Fine, Valeri [mailto:fine_at_bnl.gov] Sent: Wednesday, April 01, 2009 3:42 PM
To: Olivier Couet; OKUMURA, Akira; roottalk (Mailing list discussing all aspects of the ROOT system.)
Subject: RE: [ROOT] Changing canvas size

Hello Olivier,

> I agree, that is weird. I get also two different sizes:

One size is the size of the widget including the frame decoration, another is the size of the TPad image.

Thank you, Valeri


From: owner-roottalk_at_root.cern.ch on behalf of Olivier Couet Sent: Wed 4/1/2009 9:24 AM
To: OKUMURA, Akira; roottalk (Mailing list discussing all aspects of the ROOT system.)
Subject: RE: [ROOT] Changing canvas size

I agree, that is weird. I get also two different sizes:

$ ls -l *.png
-rwxr-xr-x 1 Olivier None 2261 Apr  1 15:22 c1.png
-rwxr-xr-x 1 Olivier None 2382 Apr  1 15:22 c2.png

They should be the same.....

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of OKUMURA, Akira
Sent: Wednesday, April 01, 2009 3:07 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: [ROOT] Changing canvas size

Hello ROOTers,

How can I change the size of a canvas before printing it? The sizes of c1.png and c2.png are different in the following example.

$ cat can.C
{

   Double_t w = 600;
   Double_t h = 600;
   TCanvas * c1 = new TCanvas("c", "c", w, h);

   c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));
   c->SaveAs("c1.png");
   c->SaveAs("c2.png");

}

$ root
root [0] .x c.C
Info in <TCanvas::Print>: file c1.png has been created Info in <TCanvas::Print>: file c2.png has been created root [1] .q
$ file c1.png c2.png
c1.png: PNG image data, 596 x 572, 8-bit/color RGB, non-interlaced c2.png: PNG image data, 600 x 600, 8-bit/color RGB, non-interlaced

Regards,

OKUMURA, Akira oxon_at_ceres.phys.s.u-tokyo.ac.jp Department of Physics, The University of Tokyo 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
TEL/FAX +81 3-5841-4173/4059
Skype : okumura.akira Received on Wed Apr 01 2009 - 16:00:29 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 02 2009 - 05:50:02 CEST