Adding or Drawing pictures?

Hello All,

I want to add small pictures (graphics, boxes, circles etc.) on my pad, canvas.
How can I do this?

I have a graphic containing 3 lines which are different line styles (dashed etc.) I would like to explain line types on my pad. How can I achieve?

Best wishes to you

Serkan

What are you looking for exactly ?
You have a gif file and you want to include it in a Canvas ?
Or you want to draw some bunch of graphics in a corner ?

Here is a example of a picture included in a canvas. Is that what you are looking for ?

I want to draw some bunch of graphics in a corner
and I want to add a picture as you show (rose background)

I would like to learn how I can menage
Thank you very much

serkan

For the “graphics in a corner” just create a Pad and use the basic primitives, Tline, TArrow, TEllipse. There is many examples in $ROOTSYS/tutorials.

The macro producing the image I sent before is:

#include "TImage.h"
#include "TCanvas.h"
#include "TFormula.h"
#include "TF1.h"
#include "TH1F.h"

void hist_image()
{

   TImage *img = TImage::Open("rose512.jpg");

   if (!img) {
      printf("Could not create an image... exit\n");
      return;
   }

   img->SetConstRatio(kTRUE);
   img->SetImageQuality(TAttImage::kImgBest);
   TCanvas *c1 = new TCanvas("rose512", "example of image background", img->GetWidth(), img->GetHeight());
   img->Draw("xxx");
   img->SetEditable(kFALSE);

   TPad *p = new TPad("p","p",0.01, 0.01, 0.99, 0.99);
   p->SetFillStyle(4000);
   p->SetFrameFillColor(0);
   p->SetFrameFillStyle(0);
   p->Draw();
   p->cd();

   TFormula *form1 = new TFormula("form1","abs(sin(x)/x)");
   TF1 *sqroot = new TF1("sqroot","x*gaus(0) + [3]*form1",0,10);
   sqroot->SetParameters(10,4,1,20);
   TH1F *h1f = new TH1F("h1f","Test random numbers",200,0,10);
   h1f->SetFillColor(45);
   h1f->FillRandom("sqroot",10000);
   h1f->Draw();
   p->Modified();
   p->Update();

   c1->Update();

}

Thank you very much
I accomplished with your help

Best Wishes