Logo ROOT   6.08/07
Reference Guide
TPDF.h
Go to the documentation of this file.
1 // @(#)root/postscript:$Id: TPDF.h,v 1.0
2 // Author: Olivier Couet
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TPDF
13 #define ROOT_TPDF
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TPDF //
19 // //
20 // PDF driver. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TVirtualPS
25 #include "TVirtualPS.h"
26 #endif
27 #include <vector>
28 
29 
30 class TPoints;
31 
32 class TPDF : public TVirtualPS {
33 
34 protected:
35  Float_t fRed; ///< Per cent of red
36  Float_t fGreen; ///< Per cent of green
37  Float_t fBlue; ///< Per cent of blue
38  Float_t fAlpha; ///< Per cent of transparency
39  std::vector<float> fAlphas; ///< List of alpha values used
40  Float_t fXsize; ///< Page size along X
41  Float_t fYsize; ///< Page size along Y
42  Int_t fType; ///< Workstation type used to know if the PDF is open
43  Int_t fPageFormat; ///< Page format (A4, Letter etc ...)
44  Int_t fPageOrientation; ///< Page orientation (Portrait, Landscape)
46  Float_t fLineScale; ///< Line width scale factor
47  Int_t *fObjPos; ///< Objets position
48  Int_t fObjPosSize; ///< Real size of fObjPos
49  Int_t fNbObj; ///< Number of objects
50  Int_t fNbPage; ///< Number of pages
51  Bool_t fPageNotEmpty; ///< True if the current page is not empty
52  Bool_t fCompress; ///< True when fBuffer must be compressed
53  Bool_t fRange; ///< True when a range has been defined
54 
55  static Int_t fgLineJoin; ///< Appearance of joining lines
56 
57 public:
58  TPDF();
59  TPDF(const char *filename, Int_t type=-111);
60  virtual ~TPDF();
61 
63  void CellArrayFill(Int_t r, Int_t g, Int_t b);
64  void CellArrayEnd();
65  void Close(Option_t *opt="");
66  Double_t CMtoPDF(Double_t u) {return Int_t(0.5 + 72*u/2.54);}
68  void DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt,
69  Int_t mode, Int_t border, Int_t dark, Int_t light);
70  void DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t *x, Float_t *y);
71  void DrawHatch(Float_t dy, Float_t angle, Int_t n, Double_t *x, Double_t *y);
72  void DrawPolyLine(Int_t n, TPoints *xy);
73  void DrawPolyLineNDC(Int_t n, TPoints *uv);
74  void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y);
75  void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y);
76  void DrawPS(Int_t n, Float_t *xw, Float_t *yw);
77  void DrawPS(Int_t n, Double_t *xw, Double_t *yw);
78  void LineTo(Double_t x, Double_t y);
79  void MoveTo(Double_t x, Double_t y);
80  void FontEncode();
81  void NewObject(Int_t n);
82  void NewPage();
83  void Off();
84  void On();
85  void Open(const char *filename, Int_t type=-111);
86  void PatternEncode();
87  void PrintFast(Int_t nch, const char *string="");
88  void PrintStr(const char *string="");
89  void Range(Float_t xrange, Float_t yrange);
90  void SetAlpha(Float_t alpha = 1.);
91  void SetColor(Int_t color = 1);
92  void SetColor(Float_t r, Float_t g, Float_t b);
93  void SetFillColor( Color_t cindex=1);
94  void SetFillPatterns(Int_t ipat, Int_t color);
95  void SetLineColor( Color_t cindex=1);
96  void SetLineJoin(Int_t linejoin=0);
97  void SetLineScale(Float_t scale=1) {fLineScale = scale;}
98  void SetLineStyle(Style_t linestyle = 1);
99  void SetLineWidth(Width_t linewidth = 1);
100  void SetMarkerColor( Color_t cindex=1);
101  void SetTextColor( Color_t cindex=1);
102  void Text(Double_t x, Double_t y, const char *string);
103  void Text(Double_t, Double_t, const wchar_t *);
104  void TextNDC(Double_t u, Double_t v, const char *string);
105  void TextNDC(Double_t, Double_t, const wchar_t *);
106  void WriteCompressedBuffer();
107  virtual void WriteReal(Float_t r, Bool_t space=kTRUE);
112 
113  ClassDef(TPDF, 0); //PDF driver
114 };
115 
116 #endif
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw a Box.
Definition: TPDF.cxx:351
void DrawPS(Int_t n, Float_t *xw, Float_t *yw)
Draw a PolyLine.
Definition: TPDF.cxx:869
void MoveTo(Double_t x, Double_t y)
Move to a new position.
Definition: TPDF.cxx:1077
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TPDF::fgLineJoin.
Definition: TPDF.cxx:2121
void On()
Activate an already open PDF file.
Definition: TPDF.cxx:1291
void WriteCompressedBuffer()
Write the buffer in a compressed way.
Definition: TPDF.cxx:2442
short Style_t
Definition: RtypesCore.h:76
TPDF()
Default PDF constructor.
Definition: TPDF.cxx:103
Float_t fXsize
Page size along X.
Definition: TPDF.h:40
float Float_t
Definition: RtypesCore.h:53
void DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t *x, Float_t *y)
Draw Fill area with hatch styles.
Definition: TPDF.cxx:457
Float_t fYsize
Page size along Y.
Definition: TPDF.h:41
const char Option_t
Definition: RtypesCore.h:62
void SetColor(Int_t color=1)
Set color with its color index.
Definition: TPDF.cxx:1980
void FontEncode()
Font encoding.
Definition: TPDF.cxx:1035
Bool_t fRange
True when a range has been defined.
Definition: TPDF.h:53
#define H(x, y, z)
Int_t fType
Workstation type used to know if the PDF is open.
Definition: TPDF.h:42
Int_t fStartStream
Definition: TPDF.h:45
void SetTextColor(Color_t cindex=1)
Set color index for text.
Definition: TPDF.cxx:2174
Int_t fObjPosSize
Real size of fObjPos.
Definition: TPDF.h:48
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Float_t fAlpha
Per cent of transparency.
Definition: TPDF.h:38
Bool_t fPageNotEmpty
True if the current page is not empty.
Definition: TPDF.h:51
Double_t CMtoPDF(Double_t u)
Definition: TPDF.h:66
Int_t fNbObj
Number of objects.
Definition: TPDF.h:49
std::vector< float > fAlphas
List of alpha values used.
Definition: TPDF.h:39
Bool_t fCompress
True when fBuffer must be compressed.
Definition: TPDF.h:52
static const double x2[5]
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
Float_t fBlue
Per cent of blue.
Definition: TPDF.h:37
Int_t fNbPage
Number of pages.
Definition: TPDF.h:50
Int_t fPageFormat
Page format (A4, Letter etc ...)
Definition: TPDF.h:43
void Text(Double_t x, Double_t y, const char *string)
Draw text.
Definition: TPDF.cxx:2186
Double_t XtoPDF(Double_t x)
Convert X from world coordinate to PDF.
Definition: TPDF.cxx:2424
void Close(Option_t *opt="")
Close a PDF file.
Definition: TPDF.cxx:199
void NewObject(Int_t n)
Create a new object in the PDF file.
Definition: TPDF.cxx:1087
void Off()
Deactivate an already open PDF file.
Definition: TPDF.cxx:1283
void SetAlpha(Float_t alpha=1.)
Set the alpha channel value.
Definition: TPDF.cxx:1960
void NewPage()
Start a new PDF page.
Definition: TPDF.cxx:1110
short Color_t
Definition: RtypesCore.h:79
void CellArrayFill(Int_t r, Int_t g, Int_t b)
Paint the Cell Array.
Definition: TPDF.cxx:183
void PrintFast(Int_t nch, const char *string="")
Fast version of Print.
Definition: TPDF.cxx:1888
void SetLineStyle(Style_t linestyle=1)
Change the line style.
Definition: TPDF.cxx:2134
Float_t fRed
Per cent of red.
Definition: TPDF.h:35
Double_t YtoPDF(Double_t y)
Convert Y from world coordinate to PDF.
Definition: TPDF.cxx:2433
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition: TPDF.cxx:1907
TRandom2 r(17)
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition: TPDF.cxx:481
SVector< double, 2 > v
Definition: Dict.h:5
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition: TPDF.cxx:2386
Double_t VtoPDF(Double_t v)
Convert V from NDC coordinate to PDF.
Definition: TPDF.cxx:2415
void SetMarkerColor(Color_t cindex=1)
Set color index for markers.
Definition: TPDF.cxx:2166
short Width_t
Definition: RtypesCore.h:78
2-D graphics point (world coordinates).
Definition: TPoints.h:21
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition: TPDF.cxx:535
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
Definition: TPDF.cxx:2487
static const double x1[5]
void SetLineWidth(Width_t linewidth=1)
Change the line width.
Definition: TPDF.cxx:2153
double Double_t
Definition: RtypesCore.h:55
static Int_t fgLineJoin
Appearance of joining lines.
Definition: TPDF.h:55
int type
Definition: TGX11.cxx:120
Double_t y[n]
Definition: legend1.C:17
Double_t UtoPDF(Double_t u)
Convert U from NDC coordinate to PDF.
Definition: TPDF.cxx:2406
Float_t fGreen
Per cent of green.
Definition: TPDF.h:36
void SetLineScale(Float_t scale=1)
Definition: TPDF.h:97
void DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt, Int_t mode, Int_t border, Int_t dark, Int_t light)
Draw a Frame around a box.
Definition: TPDF.cxx:417
void CellArrayEnd()
End the Cell Array painting.
Definition: TPDF.cxx:191
Float_t fLineScale
Line width scale factor.
Definition: TPDF.h:46
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y)
Draw markers at the n WC points xw, yw.
Definition: TPDF.cxx:581
Int_t * fObjPos
Objets position.
Definition: TPDF.h:47
void SetFillColor(Color_t cindex=1)
Set color index for fill areas.
Definition: TPDF.cxx:2053
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
Begin the Cell Array painting.
Definition: TPDF.cxx:174
Int_t fPageOrientation
Page orientation (Portrait, Landscape)
Definition: TPDF.h:44
void Open(const char *filename, Int_t type=-111)
Open a PDF file.
Definition: TPDF.cxx:1307
void PatternEncode()
Patterns encoding.
Definition: TPDF.cxx:1465
void SetLineColor(Color_t cindex=1)
Set color index for lines.
Definition: TPDF.cxx:2099
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
void LineTo(Double_t x, Double_t y)
Draw a line to a new position.
Definition: TPDF.cxx:1067
virtual ~TPDF()
Default PDF destructor.
Definition: TPDF.cxx:164
Interface to PDF.
Definition: TPDF.h:32
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition: TVirtualPS.h:40
const Bool_t kTRUE
Definition: Rtypes.h:91
const Int_t n
Definition: legend1.C:16
void SetFillPatterns(Int_t ipat, Int_t color)
Set the fill patterns (1 to 25) for fill areas.
Definition: TPDF.cxx:2062
void PrintStr(const char *string="")
Output the string str in the output buffer.
Definition: TPDF.cxx:1866