library: libPostscript #include "TSVG.h"

# TSVG

class description - source file - inheritance tree (.pdf)

## class TSVG : public TVirtualPS

| Inheritance Chart:

`TObject`

<-

`TNamed`

`TAttLine`

`TAttFill`

`TAttMarker`

`TAttText`

<-

`TVirtualPS`

<-

`TSVG`

        public:

                          TSVG()
                          TSVG(const char* filename, Int_t type = -113)
                          TSVG(const TSVG&)
                  virtual ~TSVG()
             virtual void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
             virtual void CellArrayEnd()
             virtual void CellArrayFill(Int_t r, Int_t g, Int_t b)
           static TClass* Class()
             virtual void Close(Option_t* opt = "")
                    Int_t CMtoSVG(Double_t u)
             virtual void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
             virtual 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)
                     void DrawPolyLine(Int_t n, TPoints* xy)
                     void DrawPolyLineNDC(Int_t n, TPoints* uv)
             virtual void DrawPolyMarker(Int_t n, Float_t* x, Float_t* y)
             virtual void DrawPolyMarker(Int_t n, Double_t* x, Double_t* y)
             virtual void DrawPS(Int_t n, Float_t* xw, Float_t* yw)
             virtual void DrawPS(Int_t n, Double_t* xw, Double_t* yw)
                     void Initialize()
          virtual TClass* IsA() const
                     void MovePS(Int_t x, Int_t y)
             virtual void NewPage()
                     void Off()
                     void On()
             virtual void Open(const char* filename, Int_t type = -111)
                    TSVG& operator=(const TSVG&)
                     void Range(Float_t xrange, Float_t yrange)
                     void SetColor(Int_t color = 1)
             virtual void SetColor(Float_t r, Float_t g, Float_t b)
             virtual void SetFillColor(Color_t cindex = 1)
             virtual void SetLineColor(Color_t cindex = 1)
                     void SetLineScale(Float_t = 3)
             virtual void SetLineStyle(Style_t linestyle = 1)
             virtual void SetLineWidth(Width_t linewidth = 1)
             virtual void SetMarkerColor(Color_t cindex = 1)
             virtual void SetTextColor(Color_t cindex = 1)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
             virtual void Text(Double_t x, Double_t y, const char* string)
                     void TextNDC(Double_t u, Double_t v, const char* string)
                    Int_t UtoSVG(Double_t u)
                    Int_t VtoSVG(Double_t v)
                    Int_t XtoSVG(Double_t x)
                    Int_t YtoSVG(Double_t y)

### Data Members

        protected:

          Float_t fXsize        Page size along X
          Float_t fYsize        Page size along Y
            Int_t fType         Workstation type used to know if the SVG is open
           Bool_t fBoundingBox  True when the SVG header is printed
           Bool_t fRange        True when a range has been defined
            Int_t fYsizeSVG     Page's Y size in SVG units

## Class Description

     TSVG

     Graphics interface to SVG.

TSVG() : TVirtualPS()

     Default SVG constructor

TSVG(const char *fname, Int_t wtype) : TVirtualPS(fname, wtype)

     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 *fname, Int_t wtype)

     Open a SVG file

~TSVG()

     Default SVG destructor

void Close(Option_t *)

     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 nn, 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 nn, TPoints *xy)

     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)

void DrawPolyMarker(Int_t n, Double_t *xw, Double_t *yw)

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 ix, Int_t iy)

     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 xsize, Float_t ysize)

     Set the range for the paper in centimetres

void SetFillColor( Color_t cindex )

     Set color index for fill areas

void SetLineColor( Color_t cindex )

     Set color index for lines

void SetLineStyle(Style_t linestyle)

     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)

     Set the lines width.

void SetMarkerColor( Color_t cindex )

     Set color index for markers.

void SetColor(Int_t color)

     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 )

     Set color index for text

void Text(Double_t xx, Double_t yy, const char *chars)

     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 *chars)

     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, Int_t, Double_t, Double_t, Double_t, Double_t)

void CellArrayFill(Int_t, Int_t, Int_t)

void CellArrayEnd()

void DrawPS(Int_t, Float_t *, Float_t *)

### Inline Functions

                  Int_t CMtoSVG(Double_t u)
                   void SetLineScale(Float_t = 3)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
                   TSVG TSVG(const TSVG&)
                  TSVG& operator=(const TSVG&)

Author: Olivier Couet
Last update: root/postscript:$Name: $:$Id: TSVG.cxx,v 1.13 2005/04/26 16:36:48 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *