ROOT logo
ROOT » GRAF2D » POSTSCRIPT » TSVG

class TSVG: public TVirtualPS


TSVG: Graphics interface to SVG

SVG (Scalable Vector Graphics) is a language for describing two-dimensional graphics in XML. SVG allows high quality vector graphics in HTML pages.

To print a ROOT canvas "c1" into an SVG file simply do:

   c1->Print("c1.svg");
The result is the ASCII file c1.svg.

It can be open direclty using a web browser or included in a html document the following way:

<embed width="95%" height="500" src="c1.svg" />>
It is best viewed with Internet Explorer and you need the Adobe SVG Viewer.

To zoom using the Adobe SVG Viewer, position the mouse over the area you want to zoom and click the right button.

To define the zoom area, use Control+drag to mark the boundaries of the zoom area.

To pan, use Alt+drag. By clicking with the right mouse button on the SVG graphics you will get a pop-up menu giving other ways to interact with the image.

SVG files can be used directly in compressed mode to minimize the time transfer over the network. Compressed SVG files should be created using gzip on a normal ASCII SVG file and should then be renamed using the file extension .svgz.

 

Function Members (Methods)

public:
TSVG()
TSVG(const char* filename, Int_t type = -113)
virtual~TSVG()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
virtual voidCellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
virtual voidTVirtualPS::CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
virtual voidCellArrayEnd()
virtual voidTVirtualPS::CellArrayEnd()
virtual voidCellArrayFill(Int_t r, Int_t g, Int_t b)
virtual voidTVirtualPS::CellArrayFill(Int_t r, Int_t g, Int_t b)
static TClass*Class()
static TClass*TVirtualPS::Class()
static TClass*TAttLine::Class()
static TClass*TNamed::Class()
static TClass*TObject::Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual TObject*TObject::Clone(const char* newname = "") const
virtual voidClose(Option_t* opt = "")
virtual voidTVirtualPS::Close(Option_t* opt = "")
Int_tCMtoSVG(Double_t u)
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidDrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTVirtualPS::DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidDrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt, Int_t mode, Int_t border, Int_t dark, Int_t light)
virtual voidTVirtualPS::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)
voidDrawPolyLine(Int_t n, TPoints* xy)
voidDrawPolyLineNDC(Int_t n, TPoints* uv)
virtual voidDrawPolyMarker(Int_t n, Float_t* x, Float_t* y)
virtual voidDrawPolyMarker(Int_t n, Double_t* x, Double_t* y)
virtual voidTVirtualPS::DrawPolyMarker(Int_t n, Float_t* x, Float_t* y)
virtual voidTVirtualPS::DrawPolyMarker(Int_t n, Double_t* x, Double_t* y)
virtual voidDrawPS(Int_t n, Float_t* xw, Float_t* yw)
virtual voidDrawPS(Int_t n, Double_t* xw, Double_t* yw)
virtual voidTVirtualPS::DrawPS(Int_t n, Float_t* xw, Float_t* yw)
virtual voidTVirtualPS::DrawPS(Int_t n, Double_t* xw, Double_t* yw)
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
virtual Color_tTAttMarker::GetMarkerColor() const
virtual Size_tTAttMarker::GetMarkerSize() const
virtual Style_tTAttMarker::GetMarkerStyle() const
virtual const char*TNamed::GetName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual void*TVirtualPS::GetStream() const
virtual Short_tTAttText::GetTextAlign() const
virtual Float_tTAttText::GetTextAngle() const
virtual Color_tTAttText::GetTextColor() const
virtual Font_tTAttText::GetTextFont() const
virtual Float_tTAttText::GetTextSize() const
virtual const char*TNamed::GetTitle() const
virtual const char*TObject::GetTitle() const
virtual Int_tTVirtualPS::GetType() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
voidInitialize()
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual TClass*TVirtualPS::IsA() const
virtual TClass*TAttText::IsA() const
virtual TClass*TAttMarker::IsA() const
virtual TClass*TAttFill::IsA() const
virtual TClass*TAttLine::IsA() const
virtual TClass*TNamed::IsA() const
virtual TClass*TObject::IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTObject::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttText::Modify()
virtual voidTAttMarker::Modify()
virtual voidTAttFill::Modify()
virtual voidTAttLine::Modify()
voidMovePS(Int_t x, Int_t y)
virtual voidNewPage()
virtual voidTVirtualPS::NewPage()
virtual Bool_tTObject::Notify()
voidOff()
voidOn()
virtual voidOpen(const char* filename, Int_t type = -111)
virtual voidTVirtualPS::Open(const char* filename, Int_t type = -111)
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TAttText&TAttText::operator=(const TAttText&)
TAttMarker&TAttMarker::operator=(const TAttMarker&)
TAttFill&TAttFill::operator=(const TAttFill&)
TAttLine&TAttLine::operator=(const TAttLine&)
TNamed&TNamed::operator=(const TNamed& rhs)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidTObject::Print(Option_t* option = "") const
virtual voidTVirtualPS::PrintFast(Int_t nch, const char* string = "")
virtual voidTVirtualPS::PrintStr(const char* string = "")
voidRange(Float_t xrange, Float_t yrange)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
virtual voidTAttMarker::ResetAttMarker(Option_t* toption = "")
virtual voidTAttText::ResetAttText(Option_t* toption = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidTAttMarker::SaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1)
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
virtual voidTAttText::SaveTextAttributes(ostream& out, const char* name, Int_t alidef = 12, Float_t angdef = 0, Int_t coldef = 1, Int_t fondef = 61, Float_t sizdef = 1)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetColor(Int_t color = 1)
virtual voidSetColor(Float_t r, Float_t g, Float_t b)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidSetFillColor(Color_t cindex = 1)
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidSetLineColor(Color_t cindex = 1)
virtual voidTAttLine::SetLineColor(Color_t lcolor)
voidSetLineScale(Float_t = 3)
virtual voidSetLineStyle(Style_t linestyle = 1)
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidSetLineWidth(Width_t linewidth = 1)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
virtual voidTAttMarker::SetMarkerAttributes()MENU
virtual voidSetMarkerColor(Color_t cindex = 1)
virtual voidTAttMarker::SetMarkerColor(Color_t tcolor = 1)
virtual voidTAttMarker::SetMarkerSize(Size_t msize = 1)
virtual voidTAttMarker::SetMarkerStyle(Style_t mstyle = 1)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTVirtualPS::SetStream(ofstream* os)
virtual voidTAttText::SetTextAlign(Short_t align = 11)
virtual voidTAttText::SetTextAngle(Float_t tangle = 0)MENU
virtual voidTAttText::SetTextAttributes()MENU
virtual voidSetTextColor(Color_t cindex = 1)
virtual voidTAttText::SetTextColor(Color_t tcolor = 1)
virtual voidTAttText::SetTextFont(Font_t tfont = 62)
virtual voidTAttText::SetTextSize(Float_t tsize = 1)
virtual voidTAttText::SetTextSizePixels(Int_t npixels)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTVirtualPS::SetType(Int_t = -111)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTVirtualPS::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTAttText::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTAttMarker::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTAttFill::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTAttLine::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTNamed::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTObject::ShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
virtual voidTVirtualPS::Streamer(TBuffer& b)
virtual voidTAttText::Streamer(TBuffer& b)
virtual voidTAttMarker::Streamer(TBuffer& b)
virtual voidTAttFill::Streamer(TBuffer& b)
virtual voidTAttLine::Streamer(TBuffer& b)
virtual voidTNamed::Streamer(TBuffer& b)
virtual voidTObject::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTVirtualPS::StreamerNVirtual(TBuffer& b)
voidTAttLine::StreamerNVirtual(TBuffer& b)
voidTNamed::StreamerNVirtual(TBuffer& b)
voidTObject::StreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidText(Double_t x, Double_t y, const char* string)
virtual voidTVirtualPS::Text(Double_t x, Double_t y, const char* string)
voidTextNDC(Double_t u, Double_t v, const char* string)
virtual voidTObject::UseCurrentStyle()
Int_tUtoSVG(Double_t u)
Int_tVtoSVG(Double_t v)
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidTVirtualPS::WriteInteger(Int_t i, Bool_t space = kTRUE)
virtual voidTVirtualPS::WriteReal(Float_t r)
Int_tXtoSVG(Double_t x)
Int_tYtoSVG(Double_t y)
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
Bool_tfBoundingBoxTrue when the SVG header is printed
char*TVirtualPS::fBufferFile buffer
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
Int_tTVirtualPS::fLenBufferBuffer length
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
Color_tTAttMarker::fMarkerColorMarker color index
Size_tTAttMarker::fMarkerSizeMarker size
Style_tTAttMarker::fMarkerStyleMarker style
Int_tTVirtualPS::fNByteNumber of bytes written in the file (PDF)
TStringTNamed::fNameobject identifier
Bool_tTVirtualPS::fPrintedTrue when a page must be printed
Bool_tfRangeTrue when a range has been defined
Int_tTVirtualPS::fSizBufferBuffer size
ofstream*TVirtualPS::fStreamFile stream identifier
Short_tTAttText::fTextAlignText alignment
Float_tTAttText::fTextAngleText angle
Color_tTAttText::fTextColorText color index
Font_tTAttText::fTextFontText font number
Float_tTAttText::fTextSizeText size
TStringTNamed::fTitleobject title
Int_tfTypeWorkstation type used to know if the SVG is open
Float_tfXsizePage size along X
Float_tfYsizePage size along Y
Int_tfYsizeSVGPage's Y size in SVG units

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TSVG()
 Default SVG constructor
TSVG(const char* filename, Int_t type = -113)
 Initialize the SVG interface

  fname : SVG file name
  wtype : SVG workstation type. Not used in the SVG driver. But as TSVG
          inherits from TVirtualPS it should be kept. Anyway it is not
          necessary to specify this parameter at creation time because it
          has a default value (which is ignore in the SVG case).
void Open(const char* filename, Int_t type = -111)
 Open a SVG file
~TSVG()
 Default SVG destructor
void Close(Option_t* opt = "")
 Close a SVG file
void On()
 Activate an already open SVG file
void Off()
 Deactivate an already open SVG file
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
 Draw a Box
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

 mode = -1  the box looks as it is behind the screen
 mode =  1  the box looks as it is in front of the screen
 border is the border size in already pre-computed SVG units dark is the
 color for the dark part of the frame light is the color for the light
 part of the frame
void DrawPolyLine(Int_t n, TPoints* xy)
 Draw a PolyLine

  Draw a polyline through  the points  xy.
  If NN=1 moves only to point x,y.
  If NN=0 the x,y are  written  in the SVG        file
     according to the current transformation.
  If NN>0 the line is clipped as a line.
  If NN<0 the line is clipped as a fill area.
void DrawPolyLineNDC(Int_t n, TPoints* uv)
 Draw a PolyLine in NDC space

  Draw a polyline through  the points  xy.
  If NN=1 moves only to point x,y.
  If NN=0 the x,y are  written  in the SVG        file
     according to the current transformation.
  If NN>0 the line is clipped as a line.
  If NN<0 the line is clipped as a fill area.
void DrawPolyMarker(Int_t n, Float_t *xw, Float_t *yw)
 Paint PolyMarker
void DrawPolyMarker(Int_t n, Double_t *xw, Double_t *yw)
 Paint PolyMarker
void DrawPS(Int_t nn, Double_t *xw, Double_t *yw)
 This function defines a path with xw and yw and draw it according the
 value of nn:

  If nn>0 a line is drawn.
  If nn<0 a closed polygon is drawn.
void Initialize()
 Initialize the SVG file. The main task of the function is to ouput the
 SVG header file which consist in <title>, <desc> and <defs>. The
 HeaderPS provided by the user program is written in the <defs> part.
void MovePS(Int_t x, Int_t y)
 Move to a new position (ix, iy). The move is done in relative coordinates
 which allows to have short numbers which decrease the size of the file.
 This function use the full power of the SVG's paths by using the
 horizontal and vertical move whenever it is possible.
void NewPage()
 Start the SVG page. This function initialize the pad conversion
 coefficients and ouput the <svg> directive which is close later in the
 the function Close.
void Range(Float_t xrange, Float_t yrange)
 Set the range for the paper in centimetres
void SetFillColor(Color_t cindex = 1)
 Set color index for fill areas
void SetLineColor(Color_t cindex = 1)
 Set color index for lines
void SetLineStyle(Style_t linestyle = 1)
 Change the line style

 linestyle = 2 dashed
           = 3 dotted
           = 4 dash-dotted
           = else solid (1 in is used most of the time)
void SetLineWidth(Width_t linewidth = 1)
 Set the lines width.
void SetMarkerColor(Color_t cindex = 1)
 Set color index for markers.
void SetColor(Int_t color = 1)
 Set color with its color index
void SetColor(Float_t r, Float_t g, Float_t b)
 Set color with its R G B components

  r: % of red in [0,1]
  g: % of green in [0,1]
  b: % of blue in [0,1]
void SetTextColor(Color_t cindex = 1)
 Set color index for text
void Text(Double_t x, Double_t y, const char* string)
 Draw text

 xx: x position of the text
 yy: y position of the text
 chars: text to be drawn
void TextNDC(Double_t u, Double_t v, const char* string)
 Write a string of characters in NDC
Int_t UtoSVG(Double_t u)
 Convert U from NDC coordinate to SVG
Int_t VtoSVG(Double_t v)
 Convert V from NDC coordinate to SVG
Int_t XtoSVG(Double_t x)
 Convert X from world coordinate to SVG
Int_t YtoSVG(Double_t y)
 Convert Y from world coordinate to SVG
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
void CellArrayFill(Int_t r, Int_t g, Int_t b)
 Paint the Cell Array
void CellArrayEnd()
 End the Cell Array painting
void DrawPS(Int_t, Float_t *, Float_t *)
 Not needed in SVG case
Int_t CMtoSVG(Double_t u)
{return Int_t(0.5 + 72*u/2.54);}
void SetLineScale(Float_t = 3)
{ }