Logo ROOT  
Reference Guide
img2pad.C File Reference

Detailed Description

View in nbviewer Open in SWAN Display image in canvas and pad.

void img2pad()
{
TImage *img = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
if (!img) {
printf("Could not create an image... exit\n");
return;
}
img->Draw("N");
TCanvas *c = (TCanvas *)gROOT->GetListOfCanvases()->FindObject("rose512jpg");
c->SetFixedAspectRatio();
TCanvas *c1 = new TCanvas("roses", "roses", 800, 800);
img->Draw("T100,100,#ffff00");
/*img->Draw("T100,100,#556655");*/
/*img->Draw("T100,100");*/
TImage *i1 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
i1->Flip(90);
TImage *i2 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
i2->Flip(180);
TImage *i3 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
i3->Flip(270);
TImage *i4 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
i4->Mirror(kTRUE);
float d = 0.40;
TPad *p1 = new TPad("i1", "i1", 0.05, 0.55, 0.05+d*i1->GetWidth()/i1->GetHeight(), 0.95);
TPad *p2 = new TPad("i2", "i2", 0.55, 0.55, 0.95, 0.55+d*i2->GetHeight()/i2->GetWidth());
TPad *p3 = new TPad("i3", "i3", 0.55, 0.05, 0.55+d*i3->GetWidth()/i3->GetHeight(), 0.45);
TPad *p4 = new TPad("i4", "i4", 0.05, 0.05, 0.45, 0.05+d*i4->GetHeight()/i4->GetWidth());
p1->Draw();
p1->cd();
i1->Draw();
c1->cd();
p2->Draw();
p2->cd();
i2->Draw();
c1->cd();
p3->Draw();
p3->cd();
i3->Draw();
c1->cd();
p4->Draw();
p4->cd();
i4->Draw();
c1->cd();
}
Author
Valeriy Onuchin

Definition in file img2pad.C.

c
#define c(i)
Definition: RSha256.hxx:119
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TPad
Definition: TPad.h:26
TAttImage::SetConstRatio
virtual void SetConstRatio(Bool_t constRatio=kTRUE)
Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
Definition: TAttImage.cxx:641
TImage::Flip
virtual void Flip(Int_t=180)
Definition: TImage.h:131
TImage
Definition: TImage.h:29
TImage::GetHeight
virtual UInt_t GetHeight() const
Definition: TImage.h:229
TImage::Open
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition: TImage.cxx:118
TImage::Mirror
virtual void Mirror(Bool_t=kTRUE)
Definition: TImage.h:138
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TImage::GetWidth
virtual UInt_t GetWidth() const
Definition: TImage.h:228
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
TCanvas
Definition: TCanvas.h:23
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:594
d
#define d(i)
Definition: RSha256.hxx:120
gROOT
#define gROOT
Definition: TROOT.h:406
c1
return c1
Definition: legend1.C:41
TPad::Draw
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1285