Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPostScript.h
Go to the documentation of this file.
1// @(#)root/postscript:$Id$
2// Author: O.Couet 16/07/99
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_TPostScript
13#define ROOT_TPostScript
14
15
16#include "TVirtualPS.h"
17
18#include <map>
19#include <string>
20
21class TPoints;
22
23class TPostScript : public TVirtualPS {
24
25protected:
26 Float_t fX1v = 0.; ///< X bottom left corner of paper
27 Float_t fY1v = 0.; ///< Y bottom left corner of paper
28 Float_t fX2v = 0.; ///< X top right corner of paper
29 Float_t fY2v = 0.; ///< Y top right corner of paper
30 Float_t fX1w = 0.; ///<
31 Float_t fY1w = 0.; ///<
32 Float_t fX2w = 0.; ///<
33 Float_t fY2w = 0.; ///<
34 Float_t fDXC = 0.; ///<
35 Float_t fDYC = 0.; ///<
36 Float_t fXC = 0.; ///<
37 Float_t fYC = 0.; ///<
38 Float_t fFX = 0.; ///<
39 Float_t fFY = 0.; ///<
40 Float_t fXVP1 = 0.; ///<
41 Float_t fXVP2 = 0.; ///<
42 Float_t fYVP1 = 0.; ///<
43 Float_t fYVP2 = 0.; ///<
44 Float_t fXVS1 = 0.; ///<
45 Float_t fXVS2 = 0.; ///<
46 Float_t fYVS1 = 0.; ///<
47 Float_t fYVS2 = 0.; ///<
48 Float_t fXsize = 0.; ///< Page size along X
49 Float_t fYsize = 0.; ///< Page size along Y
50 Float_t fMaxsize = 0.; ///< Largest dimension of X and Y
51 Float_t fRed = 0.; ///< Per cent of red
52 Float_t fGreen = 0.; ///< Per cent of green
53 Float_t fBlue = 0.; ///< Per cent of blue
54 Float_t fWidth = 0.; ///< Current line width
55 Int_t fStyle = 1; ///< Current line style
56 Float_t fLineScale = 0.; ///< Line width scale factor
57 Int_t fSave = 0; ///< Number of gsave for restore
58 Int_t fNXzone = 0; ///< Number of zones along X
59 Int_t fNYzone = 0; ///< Number of zones along Y
60 Int_t fIXzone = 0; ///< Current zone along X
61 Int_t fIYzone = 0; ///< Current zone along Y
62 Float_t fMarkerSizeCur = 0.; ///< current transformed value of marker size
63 Int_t fNpages = 0; ///< number of pages
64 Int_t fType = 0; ///< PostScript workstation type
65 Int_t fMode = 0; ///< PostScript mode
66 Int_t fClip = 0; ///< Clipping mode
67 Bool_t fBoundingBox = kFALSE; ///< True for Encapsulated PostScript
68 Bool_t fClear = kFALSE; ///< True when page must be cleared
69 Bool_t fClipStatus = kFALSE; ///< Clipping Indicator
70 Bool_t fRange = kFALSE; ///< True when a range has been defined
71 Bool_t fZone = kFALSE; ///< Zone indicator
72 char fPatterns[32]; ///< Indicate if pattern n is defined
73 Int_t fNbinCT = 0; ///< Number of entries in the current Cell Array
74 Int_t fNbCellW = 0; ///< Number of boxes per line
75 Int_t fNbCellLine = 0; ///< Number of boxes in the current line
76 Int_t fMaxLines = 0; ///< Maximum number of lines in a PS array
77 Int_t fLastCellRed = 0; ///< Last red value
78 Int_t fLastCellGreen = 0; ///< Last green value
79 Int_t fLastCellBlue = 0; ///< Last blue value
80 Int_t fNBSameColorCell = 0; ///< Number of boxes with the same color
81 TString fFileName; ///< PS file name
82 Bool_t fFontEmbed = kFALSE; ///< True is FontEmbed has been called
83 Bool_t fMustEmbed[29]; ///< flag to embed font
84 std::map<std::string,bool> fMarkers; ///<! array of already defined markers
85
86 static Int_t fgLineJoin; ///< Appearance of joining lines
87 static Int_t fgLineCap; ///< Appearance of line caps
88
89 template<typename T>
90 void DrawPolyMarkerShape(Int_t n, T *x, T *y);
91
92public:
94 TPostScript(const char *filename, Int_t type=-111);
95 ~TPostScript() override;
96
98 Double_t y1, Double_t y2) override;
99 void CellArrayFill(Int_t r, Int_t g, Int_t b) override;
100 void CellArrayEnd() override;
101 void Close(Option_t *opt="") override;
102 Int_t CMtoPS(Double_t u) {return Int_t(0.5 + 72*u/2.54);}
103 void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override;
105 Int_t light) override;
108 void DrawPolyLine(Int_t n, TPoints *xy);
110 void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override;
111 void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y) override;
112 void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override;
113 void DrawPS(Int_t n, Double_t *xw, Double_t *yw) override;
114 bool FontEmbedType1(const char *filename);
115 bool FontEmbedType2(const char *filename);
116 bool FontEmbedType42(const char *filename);
117 void FontEmbed();
118 void FontEncode();
119 void Initialize();
120 void NewPage() override;
121 void Off();
122 void On();
123 void Open(const char *filename, Int_t type=-111) override;
124 void SaveRestore(Int_t flag);
125 void SetFillColor(Color_t cindex=1) override;
126 void SetFillPatterns(Int_t ipat, Int_t color);
127 void SetLineColor(Color_t cindex=1) override;
128 void SetLineJoin(Int_t linejoin=0);
129 void SetLineCap(Int_t linecap=0);
130 void SetLineStyle(Style_t linestyle = 1) override;
131 void SetLineWidth(Width_t linewidth = 1) override;
133 void SetMarkerColor(Color_t cindex=1) override;
134 void SetTextColor(Color_t cindex=1) override;
135 void SetWidth(Width_t linewidth = 1);
136 void SetStyle(Style_t linestyle = 1);
137 void MovePS(Int_t x, Int_t y);
139 void SetColor(Int_t color = 1);
140 void SetColor(Float_t r, Float_t g, Float_t b) override;
141 void Text(Double_t x, Double_t y, const char *string) override;
142 void TextUrl(Double_t x, Double_t y, const char *string, const char *url) override;
143 void Text(Double_t x, Double_t y, const wchar_t *string) override;
144 void TextNDC(Double_t u, Double_t v, const char *string);
145 void TextNDC(Double_t u, Double_t v, const wchar_t *string);
150 void Zone();
151
152 ClassDefOverride(TPostScript,0) //PostScript driver
153};
154
155#endif
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Style number (short)
Definition RtypesCore.h:97
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
short Width_t
Line width (short)
Definition RtypesCore.h:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
2-D graphics point (world coordinates).
Definition TPoints.h:19
Interface to PostScript.
Definition TPostScript.h:23
Float_t fXsize
Page size along X.
Definition TPostScript.h:48
Int_t fIYzone
Current zone along Y.
Definition TPostScript.h:61
Int_t fType
PostScript workstation type.
Definition TPostScript.h:64
TPostScript()
Default PostScript constructor.
Int_t VtoPS(Double_t v)
Convert V from NDC coordinate to PostScript.
void CellArrayEnd() override
End the Cell Array painting.
static Int_t fgLineCap
Appearance of line caps.
Definition TPostScript.h:87
Float_t fX2w
Definition TPostScript.h:32
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Int_t fNBSameColorCell
Number of boxes with the same color.
Definition TPostScript.h:80
void DrawPolyMarkerShape(Int_t n, T *x, T *y)
Draw markers at the n WC points x, y.
void SetColor(Int_t color=1)
Set the current color.
Int_t fMode
PostScript mode.
Definition TPostScript.h:65
Int_t fIXzone
Current zone along X.
Definition TPostScript.h:60
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
void FontEncode()
Font Re-encoding.
Float_t fXVP2
Definition TPostScript.h:41
Int_t fLastCellBlue
Last blue value.
Definition TPostScript.h:79
Float_t fY1w
Definition TPostScript.h:31
Int_t fNbCellW
Number of boxes per line.
Definition TPostScript.h:74
Float_t fX1v
X bottom left corner of paper.
Definition TPostScript.h:26
Float_t fWidth
Current line width.
Definition TPostScript.h:54
Float_t fYC
Definition TPostScript.h:37
Float_t fRed
Per cent of red.
Definition TPostScript.h:51
Float_t fXC
Definition TPostScript.h:36
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Draw a PolyLine.
Float_t fXVS1
Definition TPostScript.h:44
Bool_t fClipStatus
Clipping Indicator.
Definition TPostScript.h:69
Float_t fLineScale
Line width scale factor.
Definition TPostScript.h:56
Float_t fMarkerSizeCur
current transformed value of marker size
Definition TPostScript.h:62
Bool_t fZone
Zone indicator.
Definition TPostScript.h:71
void Open(const char *filename, Int_t type=-111) override
Open a PostScript file.
void SetFillPatterns(Int_t ipat, Int_t color)
Patterns definition.
Float_t fDXC
Definition TPostScript.h:34
Int_t fLastCellRed
Last red value.
Definition TPostScript.h:77
void Off()
Deactivate an already open PostScript file.
Int_t YtoPS(Double_t y)
Convert Y from world coordinate to PostScript.
Bool_t fRange
True when a range has been defined.
Definition TPostScript.h:70
Float_t fBlue
Per cent of blue.
Definition TPostScript.h:53
void Text(Double_t x, Double_t y, const char *string) override
Write a string of characters.
void MovePS(Int_t x, Int_t y)
Move to a new position.
void Initialize()
PostScript Initialisation.
bool FontEmbedType2(const char *filename)
Int_t fNbCellLine
Number of boxes in the current line.
Definition TPostScript.h:75
Float_t fMaxsize
Largest dimension of X and Y.
Definition TPostScript.h:50
Float_t fYVS1
Definition TPostScript.h:46
void SetStyle(Style_t linestyle=1)
Change the line style in the output file.
Int_t fClip
Clipping mode.
Definition TPostScript.h:66
TString fFileName
PS file name.
Definition TPostScript.h:81
Int_t fNYzone
Number of zones along Y.
Definition TPostScript.h:59
bool FontEmbedType1(const char *filename)
Float_t fGreen
Per cent of green.
Definition TPostScript.h:52
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
void SetLineCap(Int_t linecap=0)
Set the value of the global parameter TPostScript::fgLineCap.
Float_t fYVP2
Definition TPostScript.h:43
void NewPage() override
Move to a new PostScript page.
Float_t fDYC
Definition TPostScript.h:35
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
void DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t *x, Float_t *y)
Draw Fill area with hatch styles.
Int_t UtoPS(Double_t u)
Convert U from NDC coordinate to PostScript.
Bool_t fFontEmbed
True is FontEmbed has been called.
Definition TPostScript.h:82
void SetWidth(Width_t linewidth=1)
Change the line width in the output file.
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.
Float_t fX1w
Definition TPostScript.h:30
Float_t fYVP1
Definition TPostScript.h:42
Int_t fSave
Number of gsave for restore.
Definition TPostScript.h:57
Int_t fStyle
Current line style.
Definition TPostScript.h:55
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
void SetTextColor(Color_t cindex=1) override
Set color index for text.
void On()
Activate an already open PostScript file.
Int_t CMtoPS(Double_t u)
bool FontEmbedType42(const char *filename)
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Float_t fFX
Definition TPostScript.h:38
Float_t fXVS2
Definition TPostScript.h:45
Int_t fNXzone
Number of zones along X.
Definition TPostScript.h:58
void TextUrl(Double_t x, Double_t y, const char *string, const char *url) override
Draw text with URL.
void SetLineScale(Float_t scale=3)
Bool_t fBoundingBox
True for Encapsulated PostScript.
Definition TPostScript.h:67
Float_t fY2w
Definition TPostScript.h:33
Int_t XtoPS(Double_t x)
Convert X from world coordinate to PostScript.
~TPostScript() override
Default PostScript destructor.
char fPatterns[32]
Indicate if pattern n is defined.
Definition TPostScript.h:72
Int_t fNbinCT
Number of entries in the current Cell Array.
Definition TPostScript.h:73
static Int_t fgLineJoin
Appearance of joining lines.
Definition TPostScript.h:86
Float_t fY2v
Y top right corner of paper.
Definition TPostScript.h:29
std::map< std::string, bool > fMarkers
! array of already defined markers
Definition TPostScript.h:84
Int_t fLastCellGreen
Last green value.
Definition TPostScript.h:78
Float_t fFY
Definition TPostScript.h:39
Float_t fY1v
Y bottom left corner of paper.
Definition TPostScript.h:27
Float_t fYVS2
Definition TPostScript.h:47
void SaveRestore(Int_t flag)
Compute number of gsaves for restore This allows to write the correct number of grestore at the end o...
Bool_t fClear
True when page must be cleared.
Definition TPostScript.h:68
Int_t fMaxLines
Maximum number of lines in a PS array.
Definition TPostScript.h:76
void Zone()
Initialize the PostScript page in zones.
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TPostScript::fgLineJoin.
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimeters.
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override
Draw a Cell Array.
Float_t fX2v
X top right corner of paper.
Definition TPostScript.h:28
void FontEmbed()
Embed font in PS file.
void Close(Option_t *opt="") override
Close a PostScript file.
Bool_t fMustEmbed[29]
flag to embed font
Definition TPostScript.h:83
Float_t fXVP1
Definition TPostScript.h:40
Int_t fNpages
number of pages
Definition TPostScript.h:63
Float_t fYsize
Page size along Y.
Definition TPostScript.h:49
Basic string class.
Definition TString.h:138
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