Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-26 11:34:28

0001 // @(#)root/postscript:$Id$
0002 // Author: Olivier Couet
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TSVG
0013 #define ROOT_TSVG
0014 
0015 
0016 #include "TVirtualPS.h"
0017 
0018 class TPoints;
0019 
0020 class TSVG : public TVirtualPS {
0021 
0022 protected:
0023    Float_t      fXsize;           ///< Page size along X
0024    Float_t      fYsize;           ///< Page size along Y
0025    Int_t        fType;            ///< Workstation type used to know if the SVG is open
0026    Bool_t       fCompact;         ///< True when the SVG header is printed
0027    Bool_t       fBoundingBox;     ///< True when the SVG header is printed
0028    Bool_t       fRange;           ///< True when a range has been defined
0029    Double_t     fYsizeSVG;        ///< Page's Y size in SVG units
0030 
0031    static Int_t fgLineJoin;       ///< Appearance of joining lines
0032    static Int_t fgLineCap;        ///< Appearance of line caps
0033 
0034    void PrintPath(Bool_t convert, Int_t n, Double_t *xs, Double_t *ys, Bool_t close_path = kTRUE);
0035    template<class T>
0036    void PrintPolyMarker(Int_t n, T *x, T* y);
0037 
0038 public:
0039    TSVG();
0040    TSVG(const char *filename, Int_t type=-113, Bool_t compact = kFALSE);
0041    ~TSVG() override;
0042 
0043    void  CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override;
0044    void  CellArrayFill(Int_t r, Int_t g, Int_t b) override;
0045    void  CellArrayEnd() override;
0046    void  Close(Option_t *opt="") override;
0047    Double_t CMtoSVG(Double_t u) { return 0.5 + 72*u/2.54; }
0048    void  DrawBox(Double_t x1, Double_t y1,Double_t x2, Double_t  y2) override;
0049    void  DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t  yt,
0050                    Int_t mode, Int_t border, Int_t dark, Int_t light) override;
0051    void  DrawPolyLine(Int_t, TPoints *);
0052    void  DrawPolyLineNDC(Int_t, TPoints *);
0053    void  DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override;
0054    void  DrawPolyMarker(Int_t n, Double_t *x, Double_t *y) override;
0055    void  DrawPS(Int_t n, Float_t *xw, Float_t *yw) override;
0056    void  DrawPS(Int_t n, Double_t *xw, Double_t *yw) override;
0057    Bool_t IsCompact() const { return fCompact; }
0058    void  Initialize();
0059    void  MovePS(Double_t x, Double_t y);
0060    void  NewPage() override;
0061    void  Off();
0062    void  On();
0063    void  Open(const char *filename, Int_t type=-111) override;
0064    void  Range(Float_t xrange, Float_t yrange);
0065    void  SetColorAlpha(Int_t color = 1, Bool_t fill = kTRUE, Bool_t stroke = kTRUE);
0066    void  SetColor(Int_t color = 1);
0067    void  SetColor(Float_t r, Float_t g, Float_t b) override;
0068    void  SetFillColor(Color_t cindex=1) override;
0069    void  SetLineColor(Color_t cindex=1) override;
0070    void  SetLineJoin(Int_t linejoin=0);
0071    void  SetLineCap(Int_t linecap=0);
0072    void  SetLineStyle(Style_t linestyle = 1) override;
0073    void  SetLineWidth(Width_t linewidth = 1) override;
0074    void  SetLineScale(Float_t =3) { }
0075    void  SetMarkerColor(Color_t cindex=1) override;
0076    void  SetTextColor(Color_t cindex=1) override;
0077    void  Text(Double_t x, Double_t y, const char *string)  override;
0078    void  Text(Double_t, Double_t, const wchar_t *) override {}
0079    void  TextNDC(Double_t u, Double_t v, const char *string);
0080    void  TextNDC(Double_t, Double_t, const wchar_t *) {}
0081    void  WriteReal(Float_t r, Bool_t space=kTRUE) override;
0082 
0083    Double_t UtoSVG(Double_t u);
0084    Double_t VtoSVG(Double_t v);
0085    Double_t XtoSVG(Double_t x);
0086    Double_t YtoSVG(Double_t y);
0087 
0088    ClassDefOverride(TSVG, 0);  //SVG driver
0089 };
0090 
0091 #endif