Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
img2pad.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_image
3/// \notebook
4/// Display image in canvas and pad.
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Valeriy Onuchin
10
11void img2pad()
12{
13 TString fname = gROOT->GetTutorialDir();
14 fname.Append("/visualisation/image/rose512.jpg");
16
17 if (!img) {
18 printf("Could not create an image... exit\n");
19 return;
20 }
21
22 img->SetConstRatio(kFALSE);
23 img->Draw("N");
24
25 TCanvas *c = (TCanvas *)gROOT->GetListOfCanvases()->FindObject("rose512jpg");
26 c->SetFixedAspectRatio();
27
28 TCanvas *c1 = new TCanvas("roses", "roses", 800, 800);
29 img->Draw("T100,100,#ffff00");
30 /*img->Draw("T100,100,#556655");*/
31 /*img->Draw("T100,100");*/
32
34 i1->SetConstRatio(kFALSE);
35 i1->Flip(90);
37 i2->SetConstRatio(kFALSE);
38 i2->Flip(180);
40 i3->SetConstRatio(kFALSE);
41 i3->Flip(270);
43 i4->SetConstRatio(kFALSE);
44 i4->Mirror(kTRUE);
45
46 float d = 0.40;
47 TPad *p1 = new TPad("i1", "i1", 0.05, 0.55, 0.05 + d * i1->GetWidth() / i1->GetHeight(), 0.95);
48 TPad *p2 = new TPad("i2", "i2", 0.55, 0.55, 0.95, 0.55 + d * i2->GetHeight() / i2->GetWidth());
49 TPad *p3 = new TPad("i3", "i3", 0.55, 0.05, 0.55 + d * i3->GetWidth() / i3->GetHeight(), 0.45);
50 TPad *p4 = new TPad("i4", "i4", 0.05, 0.05, 0.45, 0.05 + d * i4->GetHeight() / i4->GetWidth());
51
52 p1->Draw();
53 p1->cd();
54 i1->Draw();
55 c1->cd();
56
57 p2->Draw();
58 p2->cd();
59 i2->Draw();
60 c1->cd();
61
62 p3->Draw();
63 p3->cd();
64 i3->Draw();
65 c1->cd();
66
67 p4->Draw();
68 p4->cd();
69 i4->Draw();
70 c1->cd();
71}
#define d(i)
Definition RSha256.hxx:102
#define c(i)
Definition RSha256.hxx:101
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gROOT
Definition TROOT.h:411
The Canvas class.
Definition TCanvas.h:23
An abstract interface to image processing library.
Definition TImage.h:29
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition TImage.cxx:117
The most important graphics class in the ROOT system.
Definition TPad.h:28
TObject * FindObject(const char *name) const override
Search if object named name is inside this pad or in pads inside this pad.
Definition TPad.cxx:2845
Basic string class.
Definition TString.h:138
return c1
Definition legend1.C:41