An example how to display PS, EPS, PDF files in canvas.
To load a PS file in a TCanvas, the ghostscript program needs to be install.
- On most unix systems it is installed by default.
- On Windows it has to be installed from http://pages.cs.wisc.edu/~ghost/ also the place where gswin32c.exe sits should be added in the PATH. One way to do it is:
- Start the Control Panel
- Double click on System 3, Open the "Advanced" tab
- Click on the "Environment Variables" button
- Find "Path" in "System variable list", click on it.
- Click on the "Edit" button.
- In the "Variable value" field add the path of gswin32c (after a ";") it should be something like: "C:\Program Files\gs\gs8.13\bin"
- click "OK" as much as needed.
void psview()
{
dir.
Append(
"/graphics/feynman.C");
gPad->Print(
"feynman.eps");
printf("GhostScript (gs) program must be installed\n");
return;
}
new TCanvas(
"psexam",
"Example how to display PS file in canvas", 600, 400);
TLatex *tex =
new TLatex(0.06,0.9,
"The picture below has been loaded from a PS file:");
TPad *eps =
new TPad(
"eps",
"eps", 0., 0., 1., 0.75);
}
An abstract interface to image processing library.
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
To draw Mathematical Formula.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
The most important graphics class in the ROOT system.
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
TString & Append(const char *cs)
static constexpr double ps
- Author
- Valeriy Onoutchin
Definition in file psview.C.