Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSVG.h
Go to the documentation of this file.
1// @(#)root/postscript:$Id$
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_TSVG
13#define ROOT_TSVG
14
15
16#include "TVirtualPS.h"
17
18class TPoints;
19
20class TSVG : public TVirtualPS {
21
22protected:
23 Float_t fXsize; ///< Page size along X
24 Float_t fYsize; ///< Page size along Y
25 Int_t fType; ///< Workstation type used to know if the SVG is open
26 Bool_t fCompact; ///< True when the SVG header is printed
27 Bool_t fBoundingBox; ///< True when the SVG header is printed
28 Bool_t fRange; ///< True when a range has been defined
29 Double_t fYsizeSVG; ///< Page's Y size in SVG units
30
31 static Int_t fgLineJoin; ///< Appearance of joining lines
32 static Int_t fgLineCap; ///< Appearance of line caps
33
35 template<class T>
36 void PrintPolyMarker(Int_t n, T *x, T* y);
37
38public:
39 TSVG();
40 TSVG(const char *filename, Int_t type=-113, Bool_t compact = kFALSE);
41 ~TSVG() override;
42
44 void CellArrayFill(Int_t r, Int_t g, Int_t b) override;
45 void CellArrayEnd() override;
46 void Close(Option_t *opt="") override;
47 Double_t CMtoSVG(Double_t u) { return 0.5 + 72*u/2.54; }
50 Int_t mode, Int_t border, Int_t dark, Int_t light) override;
51 void DrawPolyLine(Int_t, TPoints *);
53 void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override;
54 void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y) override;
55 void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override;
56 void DrawPS(Int_t n, Double_t *xw, Double_t *yw) override;
57 Bool_t IsCompact() const { return fCompact; }
58 void Initialize();
59 void MovePS(Double_t x, Double_t y);
60 void NewPage() override;
61 void Off();
62 void On();
63 void Open(const char *filename, Int_t type=-111) override;
65 void SetColorAlpha(Int_t color = 1, Bool_t fill = kTRUE, Bool_t stroke = kTRUE);
66 void SetColor(Int_t color = 1);
67 void SetColor(Float_t r, Float_t g, Float_t b) override;
68 void SetFillColor(Color_t cindex=1) override;
69 void SetLineColor(Color_t cindex=1) override;
71 void SetLineCap(Int_t linecap=0);
72 void SetLineStyle(Style_t linestyle = 1) override;
73 void SetLineWidth(Width_t linewidth = 1) override;
74 void SetLineScale(Float_t =3) { }
75 void SetMarkerColor(Color_t cindex=1) override;
76 void SetTextColor(Color_t cindex=1) override;
77 void Text(Double_t x, Double_t y, const char *string) override;
78 void Text(Double_t, Double_t, const wchar_t *) override {}
79 void TextNDC(Double_t u, Double_t v, const char *string);
80 void TextNDC(Double_t, Double_t, const wchar_t *) {}
81 void WriteReal(Float_t r, Bool_t space=kTRUE) override;
82
87
88 ClassDefOverride(TSVG, 0); //SVG driver
89};
90
91#endif
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Style number (short)
Definition RtypesCore.h:96
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
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 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 SVG.
Definition TSVG.h:20
static Int_t fgLineJoin
Appearance of joining lines.
Definition TSVG.h:31
void PrintPolyMarker(Int_t n, T *x, T *y)
Implementation of polymarker printing.
Definition TSVG.cxx:452
Double_t UtoSVG(Double_t u)
Convert U from NDC coordinate to SVG.
Definition TSVG.cxx:1478
void MovePS(Double_t x, Double_t y)
Move to a new position (ix, iy).
Definition TSVG.cxx:1013
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 TSVG.cxx:370
void DrawPolyLineNDC(Int_t, TPoints *)
Draw a PolyLine in NDC space.
Definition TSVG.cxx:443
Double_t fYsizeSVG
Page's Y size in SVG units.
Definition TSVG.h:29
void Close(Option_t *opt="") override
Close a SVG file.
Definition TSVG.cxx:174
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TSVG.cxx:214
Bool_t fRange
True when a range has been defined.
Definition TSVG.h:28
void Text(Double_t x, Double_t y, const char *string) override
Draw text.
Definition TSVG.cxx:1237
Double_t YtoSVG(Double_t y)
Convert Y from world coordinate to SVG.
Definition TSVG.cxx:1505
void Initialize()
Initialize the SVG file.
Definition TSVG.cxx:952
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Not needed in SVG case.
Definition TSVG.cxx:1539
void CellArrayEnd() override
End the Cell Array painting.
Definition TSVG.cxx:1531
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TSVG.cxx:1523
void NewPage() override
Start the SVG page.
Definition TSVG.cxx:1034
void SetColor(Int_t color=1)
Set RGB (without alpha channel) color with its color index.
Definition TSVG.cxx:1189
Int_t fType
Workstation type used to know if the SVG is open.
Definition TSVG.h:25
void SetLineCap(Int_t linecap=0)
Set the value of the global parameter TSVG::fgLineCap.
Definition TSVG.cxx:1130
void DrawPolyLine(Int_t, TPoints *)
Draw a PolyLine.
Definition TSVG.cxx:428
void Off()
Deactivate an already open SVG file.
Definition TSVG.cxx:206
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TSVG.cxx:1066
void SetLineScale(Float_t=3)
Definition TSVG.h:74
Bool_t IsCompact() const
Definition TSVG.h:57
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 TSVG.cxx:1514
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TSVG.cxx:1145
void On()
Activate an already open SVG file.
Definition TSVG.cxx:190
TSVG()
Default SVG constructor.
Definition TSVG.cxx:82
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TSVG.cxx:1225
Double_t CMtoSVG(Double_t u)
Definition TSVG.h:47
Double_t XtoSVG(Double_t x)
Convert X from world coordinate to SVG.
Definition TSVG.cxx:1496
Bool_t fCompact
True when the SVG header is printed.
Definition TSVG.h:26
Bool_t fBoundingBox
True when the SVG header is printed.
Definition TSVG.h:27
Float_t fXsize
Page size along X.
Definition TSVG.h:23
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TSVG.cxx:1161
Float_t fYsize
Page size along Y.
Definition TSVG.h:24
void Text(Double_t, Double_t, const wchar_t *) override
Definition TSVG.h:78
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition TSVG.cxx:1468
~TSVG() override
Default SVG destructor.
Definition TSVG.cxx:166
void TextNDC(Double_t, Double_t, const wchar_t *)
Definition TSVG.h:80
void SetColorAlpha(Int_t color=1, Bool_t fill=kTRUE, Bool_t stroke=kTRUE)
Set RGBa color with its color index.
Definition TSVG.cxx:1169
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TSVG::fgLineJoin.
Definition TSVG.cxx:1106
void PrintPath(Bool_t convert, Int_t n, Double_t *xs, Double_t *ys, Bool_t close_path=kTRUE)
Print a svg path statement for specified points.
Definition TSVG.cxx:288
void Open(const char *filename, Int_t type=-111) override
Open a SVG file.
Definition TSVG.cxx:116
void WriteReal(Float_t r, Bool_t space=kTRUE) override
Write float value into output stream In compact form try to store only first 2-3 significant digits.
Definition TSVG.cxx:988
static Int_t fgLineCap
Appearance of line caps.
Definition TSVG.h:32
Double_t VtoSVG(Double_t v)
Convert V from NDC coordinate to SVG.
Definition TSVG.cxx:1487
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)