Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TVirtualPS.h"
25#include <vector>
26
27
28class TPoints;
29
30class TPDF : public TVirtualPS {
31
32protected:
33 Float_t fRed; ///< Per cent of red
34 Float_t fGreen; ///< Per cent of green
35 Float_t fBlue; ///< Per cent of blue
36 Float_t fAlpha; ///< Per cent of transparency
37 std::vector<float> fAlphas; ///< List of alpha values used
38 Float_t fXsize; ///< Page size along X
39 Float_t fYsize; ///< Page size along Y
40 Int_t fType; ///< Workstation type used to know if the PDF is open
41 Int_t fPageFormat; ///< Page format (A4, Letter etc ...)
42 Int_t fPageOrientation; ///< Page orientation (Portrait, Landscape)
44 Float_t fLineScale; ///< Line width scale factor
45 Int_t *fObjPos{nullptr}; ///< Objects position
46 Int_t fObjPosSize{0}; ///< Real size of fObjPos
47 Int_t fNbObj{0}; ///< Number of objects
48 Int_t fNbPage; ///< Number of pages
49 Bool_t fPageNotEmpty; ///< True if the current page is not empty
50 Bool_t fCompress; ///< True when fBuffer must be compressed
51 Bool_t fRange; ///< True when a range has been defined
52
53 static Int_t fgLineJoin; ///< Appearance of joining lines
54 static Int_t fgLineCap; ///< Appearance of line caps
55 static Bool_t fgObjectIsOpen; ///< Indicates if an object is open
56
57public:
58 TPDF();
59 TPDF(const char *filename, Int_t type=-111);
60 ~TPDF() override;
61
63 void CellArrayFill(Int_t r, Int_t g, Int_t b) override;
64 void CellArrayEnd() override;
65 void Close(Option_t *opt="") override;
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) override;
73 void DrawPolyLineNDC(Int_t n, TPoints *uv);
74 void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override;
75 void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y) override;
76 void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override;
77 void DrawPS(Int_t n, Double_t *xw, Double_t *yw) override;
78 void LineTo(Double_t x, Double_t y);
79 void MoveTo(Double_t x, Double_t y);
80 void EndObject();
81 void FontEncode();
82 void NewObject(Int_t n);
83 void NewPage() override;
84 void Off();
85 void On();
86 void Open(const char *filename, Int_t type=-111) override;
87 void PatternEncode();
88 void PrintFast(Int_t nch, const char *string="") override;
89 void PrintStr(const char *string="") override;
90 void Range(Float_t xrange, Float_t yrange);
91 void SetAlpha(Float_t alpha = 1.);
92 void SetColor(Int_t color = 1);
93 void SetColor(Float_t r, Float_t g, Float_t b) override;
94 void SetFillColor( Color_t cindex=1) override;
95 void SetFillPatterns(Int_t ipat, Int_t color);
96 void SetLineColor( Color_t cindex=1) override;
97 void SetLineJoin(Int_t linejoin=0);
98 void SetLineCap(Int_t linecap=0);
99 void SetLineScale(Float_t scale=1) {fLineScale = scale;}
100 void SetLineStyle(Style_t linestyle = 1) override;
101 void SetLineWidth(Width_t linewidth = 1) override;
102 void SetMarkerColor(Color_t cindex=1) override;
103 void SetTextColor(Color_t cindex=1) override;
104 void Text(Double_t x, Double_t y, const char *string) override;
105 void Text(Double_t, Double_t, const wchar_t *) override;
106 void TextNDC(Double_t u, Double_t v, const char *string);
107 void TextNDC(Double_t, Double_t, const wchar_t *);
109 void WriteReal(Float_t r, Bool_t space=kTRUE) override;
114
115 ClassDefOverride(TPDF, 0); //PDF driver
116};
117
118#endif
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Definition RtypesCore.h:89
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:92
short Width_t
Definition RtypesCore.h:91
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t cindex
Option_t Option_t SetLineWidth
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint DrawPolyMarker
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char y1
Interface to PDF.
Definition TPDF.h:30
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TPDF.cxx:2100
void Off()
Deactivate an already open PDF file.
Definition TPDF.cxx:1643
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TPDF.cxx:2132
Int_t fType
Workstation type used to know if the PDF is open.
Definition TPDF.h:40
void SetColor(Int_t color=1)
Set color with its color index.
Definition TPDF.cxx:1906
Double_t YtoPDF(Double_t y)
Convert Y from world coordinate to PDF.
Definition TPDF.cxx:2399
void Open(const char *filename, Int_t type=-111) override
Open a PDF file.
Definition TPDF.cxx:1667
void Close(Option_t *opt="") override
Close a PDF file.
Definition TPDF.cxx:197
TPDF()
Default PDF constructor.
Definition TPDF.cxx:106
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TPDF.cxx:1876
void LineTo(Double_t x, Double_t y)
Draw a line to a new position.
Definition TPDF.cxx:1419
void SetLineCap(Int_t linecap=0)
Set the value of the global parameter TPDF::fgLineCap.
Definition TPDF.cxx:2085
Double_t XtoPDF(Double_t x)
Convert X from world coordinate to PDF.
Definition TPDF.cxx:2390
void WriteReal(Float_t r, Bool_t space=kTRUE) override
Write a Real number to the file.
Definition TPDF.cxx:2458
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TPDF::fgLineJoin.
Definition TPDF.cxx:2061
Double_t CMtoPDF(Double_t u)
Definition TPDF.h:66
void CellArrayEnd() override
End the Cell Array painting.
Definition TPDF.cxx:189
Int_t fObjPosSize
Real size of fObjPos.
Definition TPDF.h:46
void NewPage() override
Start a new PDF page.
Definition TPDF.cxx:1465
static Bool_t fgObjectIsOpen
Indicates if an object is open.
Definition TPDF.h:55
Float_t fAlpha
Per cent of transparency.
Definition TPDF.h:36
Float_t fLineScale
Line width scale factor.
Definition TPDF.h:44
Float_t fGreen
Per cent of green.
Definition TPDF.h:34
Int_t fPageOrientation
Page orientation (Portrait, Landscape)
Definition TPDF.h:42
void On()
Activate an already open PDF file.
Definition TPDF.cxx:1651
Int_t fStartStream
Definition TPDF.h:43
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TPDF.cxx:351
void FontEncode()
Font encoding.
Definition TPDF.cxx:1387
Bool_t fCompress
True when fBuffer must be compressed.
Definition TPDF.h:50
static Int_t fgLineCap
Appearance of line caps.
Definition TPDF.h:54
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Draw a PolyLine.
Definition TPDF.cxx:1209
Float_t fYsize
Page size along Y.
Definition TPDF.h:39
Double_t UtoPDF(Double_t u)
Convert U from NDC coordinate to PDF.
Definition TPDF.cxx:2372
void SetAlpha(Float_t alpha=1.)
Set the alpha channel value.
Definition TPDF.cxx:1886
Float_t fRed
Per cent of red.
Definition TPDF.h:33
Int_t fPageFormat
Page format (A4, Letter etc ...)
Definition TPDF.h:41
Bool_t fRange
True when a range has been defined.
Definition TPDF.h:51
Float_t fBlue
Per cent of blue.
Definition TPDF.h:35
std::vector< float > fAlphas
List of alpha values used.
Definition TPDF.h:37
void MoveTo(Double_t x, Double_t y)
Move to a new position.
Definition TPDF.cxx:1429
void SetLineScale(Float_t scale=1)
Definition TPDF.h:99
Int_t fNbObj
Number of objects.
Definition TPDF.h:47
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) override
Draw a Frame around a box.
Definition TPDF.cxx:417
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TPDF.cxx:181
~TPDF() override
Default PDF destructor.
Definition TPDF.cxx:162
void EndObject()
Close the current opened object.
Definition TPDF.cxx:1375
void PrintStr(const char *string="") override
Output the string str in the output buffer.
Definition TPDF.cxx:1835
Int_t fNbPage
Number of pages.
Definition TPDF.h:48
void SetFillPatterns(Int_t ipat, Int_t color)
Set the fill patterns (1 to 25) for fill areas.
Definition TPDF.cxx:1987
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TPDF.cxx:2140
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition TPDF.cxx:535
Float_t fXsize
Page size along X.
Definition TPDF.h:38
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override
Begin the Cell Array painting.
Definition TPDF.cxx:172
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
Double_t VtoPDF(Double_t v)
Convert V from NDC coordinate to PDF.
Definition TPDF.cxx:2381
Bool_t fPageNotEmpty
True if the current page is not empty.
Definition TPDF.h:49
void NewObject(Int_t n)
Create a new object in the PDF file.
Definition TPDF.cxx:1439
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition TPDF.cxx:481
void Text(Double_t x, Double_t y, const char *string) override
Draw text.
Definition TPDF.cxx:2152
void PatternEncode()
Patterns encoding.
Definition TPDF.cxx:2474
Int_t * fObjPos
Objects position.
Definition TPDF.h:45
void WriteCompressedBuffer()
Write the buffer in a compressed way.
Definition TPDF.cxx:2408
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition TPDF.cxx:2352
static Int_t fgLineJoin
Appearance of joining lines.
Definition TPDF.h:53
void PrintFast(Int_t nch, const char *string="") override
Fast version of Print.
Definition TPDF.cxx:1857
2-D graphics point (world coordinates).
Definition TPoints.h:19
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition TVirtualPS.h:30
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
#define H(x, y, z)