ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
psview.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphics
3
/// \notebook
4
/// An example how to display PS, EPS, PDF files in canvas.
5
/// To load a PS file in a TCanvas, the ghostscript program needs to be install.
6
/// - On most unix systems it is installed by default.
7
/// - On Windows it has to be installed from http://pages.cs.wisc.edu/~ghost/
8
/// also the place where gswin32c.exe sits should be added in the PATH. One
9
/// way to do it is:
10
/// 1. Start the Control Panel
11
/// 2. Double click on System
12
/// 3, Open the "Advanced" tab
13
/// 4. Click on the "Environment Variables" button
14
/// 5. Find "Path" in "System variable list", click on it.
15
/// 6. Click on the "Edit" button.
16
/// 7. In the "Variable value" field add the path of gswin32c
17
/// (after a ";") it should be something like:
18
/// "C:\Program Files\gs\gs8.13\bin"
19
/// 8. click "OK" as much as needed.
20
///
21
/// \macro_code
22
///
23
/// \author Valeriy Onoutchin
24
25
#include "
TROOT.h
"
26
#include "
TCanvas.h
"
27
#include "
TImage.h
"
28
29
void
psview()
30
{
31
// set to batch mode -> do not display graphics
32
gROOT->SetBatch(1);
33
34
// create a PostScript file
35
TString dir = gROOT->GetTutorialDir();
36
dir.Append(
"/graphics/feynman.C"
);
37
gROOT->Macro(dir);
38
gPad->Print(
"feynman.eps"
);
39
40
// back to graphics mode
41
gROOT->SetBatch(0);
42
43
// create an image from PS file
44
TImage *ps = TImage::Open(
"feynman.eps"
);
45
46
if
(!ps) {
47
printf(
"GhostScript (gs) program must be installed\n"
);
48
return
;
49
}
50
51
new
TCanvas(
"psexam"
,
"Example how to display PS file in canvas"
, 600, 400);
52
TLatex *tex =
new
TLatex(0.06,0.9,
"The picture below has been loaded from a PS file:"
);
53
tex->Draw();
54
55
TPad *eps =
new
TPad(
"eps"
,
"eps"
, 0., 0., 1., 0.75);
56
eps->Draw();
57
eps->cd();
58
ps->Draw(
"xxx"
);
59
}
TImage.h
TCanvas.h
TROOT.h
tutorials
graphics
psview.C
Generated on Tue May 5 2020 14:03:45 for ROOT by
1.8.5