Re: Changing canvas size

From: OKUMURA, Akira <oxon_at_ceres.phys.s.u-tokyo.ac.jp>
Date: Thu, 2 Apr 2009 10:05:52 +0900


Hello Valeri and Olivier,

I modified the macro to wait for a while, but the result is the same. Any idea? I'm using ROOT 5.23 + OS X Leopard + X11.app + default window manager.

root [9] .x c.C
Info in <TCanvas::Print>: file c1.png has been created Info in <TCanvas::Print>: file c2.png has been created 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

{

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

   gSystem->Sleep(10000);
   for(int i = 0; i < 100000000; i++){
     double a = i*i*i;
   }

   c->SaveAs("c1.png");
   c->SaveAs("c2.png");
   gSystem->Exec("file c1.png c2.png");
}

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

On 2009/04/01, at 22:59, Fine, Valeri wrote:

>
>
>
>> 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 Thu Apr 02 2009 - 03:06:12 CEST

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