Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:19

0001 // @(#)root/postscript:$Id: TPDF.h,v 1.0
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_TPDF
0013 #define ROOT_TPDF
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TPDF                                                                 //
0019 //                                                                      //
0020 // PDF driver.                                                          //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TVirtualPS.h"
0025 #include <vector>
0026 
0027 
0028 class TPoints;
0029 
0030 class TPDF : public TVirtualPS {
0031 
0032 protected:
0033    Float_t            fRed;             ///< Per cent of red
0034    Float_t            fGreen;           ///< Per cent of green
0035    Float_t            fBlue;            ///< Per cent of blue
0036    Float_t            fAlpha;           ///< Per cent of transparency
0037    std::vector<float> fAlphas;          ///< List of alpha values used
0038    Float_t            fXsize;           ///< Page size along X
0039    Float_t            fYsize;           ///< Page size along Y
0040    Int_t              fType;            ///< Workstation type used to know if the PDF is open
0041    Int_t              fPageFormat;      ///< Page format (A4, Letter etc ...)
0042    Int_t              fPageOrientation; ///< Page orientation (Portrait, Landscape)
0043    Int_t              fStartStream;     ///<
0044    Float_t            fLineScale;       ///< Line width scale factor
0045    Int_t             *fObjPos{nullptr}; ///< Objects position
0046    Int_t              fObjPosSize{0};   ///< Real size of fObjPos
0047    Int_t              fNbObj{0};        ///< Number of objects
0048    Int_t              fNbPage;          ///< Number of pages
0049    Bool_t             fPageNotEmpty;    ///< True if the current page is not empty
0050    Bool_t             fCompress;        ///< True when fBuffer must be compressed
0051    Bool_t             fRange;           ///< True when a range has been defined
0052 
0053    static Int_t       fgLineJoin;       ///< Appearance of joining lines
0054    static Int_t       fgLineCap;        ///< Appearance of line caps
0055    static Bool_t      fgObjectIsOpen;   ///< Indicates if an object is open
0056 
0057 public:
0058    TPDF();
0059    TPDF(const char *filename, Int_t type=-111);
0060    ~TPDF() override;
0061 
0062    void     CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override;
0063    void     CellArrayFill(Int_t r, Int_t g, Int_t b) override;
0064    void     CellArrayEnd() override;
0065    void     Close(Option_t *opt="") override;
0066    Double_t CMtoPDF(Double_t u) { return Int_t(0.5 + 72*u/2.54); }
0067    void     DrawBox(Double_t x1, Double_t y1,Double_t x2, Double_t  y2) override;
0068    void     DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t  yt,
0069                       Int_t mode, Int_t border, Int_t dark, Int_t light) override;
0070    void     DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t *x, Float_t *y);
0071    void     DrawHatch(Float_t dy, Float_t angle, Int_t n, Double_t *x, Double_t *y);
0072    void     DrawPolyLine(Int_t n, TPoints *xy);
0073    void     DrawPolyLineNDC(Int_t n, TPoints *uv);
0074    void     DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override;
0075    void     DrawPolyMarker(Int_t n, Double_t *x, Double_t *y) override;
0076    void     DrawPS(Int_t n, Float_t *xw, Float_t *yw) override;
0077    void     DrawPS(Int_t n, Double_t *xw, Double_t *yw) override;
0078    void     LineTo(Double_t x, Double_t y);
0079    void     MoveTo(Double_t x, Double_t y);
0080    void     EndObject();
0081    void     FontEncode();
0082    void     NewObject(Int_t n);
0083    void     NewPage() override;
0084    void     Off();
0085    void     On();
0086    void     Open(const char *filename, Int_t type=-111) override;
0087    void     PatternEncode();
0088    void     PrintFast(Int_t nch, const char *string="") override;
0089    void     PrintStr(const char *string="") override;
0090    void     Range(Float_t xrange, Float_t yrange);
0091    void     SetAlpha(Float_t alpha = 1.);
0092    void     SetColor(Int_t color = 1);
0093    void     SetColor(Float_t r, Float_t g, Float_t b) override;
0094    void     SetFillColor( Color_t cindex=1) override;
0095    void     SetFillPatterns(Int_t ipat, Int_t color);
0096    void     SetLineColor( Color_t cindex=1) override;
0097    void     SetLineJoin(Int_t linejoin=0);
0098    void     SetLineCap(Int_t linecap=0);
0099    void     SetLineScale(Float_t scale=1) {fLineScale = scale;}
0100    void     SetLineStyle(Style_t linestyle = 1) override;
0101    void     SetLineWidth(Width_t linewidth = 1) override;
0102    void     SetMarkerColor(Color_t cindex=1) override;
0103    void     SetTextColor(Color_t cindex=1) override;
0104    void     Text(Double_t x, Double_t y, const char *string) override;
0105    void     Text(Double_t, Double_t, const wchar_t *) override;
0106    void     TextNDC(Double_t u, Double_t v, const char *string);
0107    void     TextNDC(Double_t, Double_t, const wchar_t *);
0108    void     WriteCompressedBuffer();
0109    void     WriteReal(Float_t r, Bool_t space=kTRUE) override;
0110    Double_t UtoPDF(Double_t u);
0111    Double_t VtoPDF(Double_t v);
0112    Double_t XtoPDF(Double_t x);
0113    Double_t YtoPDF(Double_t y);
0114 
0115    ClassDefOverride(TPDF, 0);  //PDF driver
0116 };
0117 
0118 #endif