File indexing completed on 2026-09-13 09:26:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TPDF
0013 #define ROOT_TPDF
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TVirtualPS.h"
0025 #include <vector>
0026 #include <string>
0027
0028
0029 class TPoints;
0030
0031 class TPDF : public TVirtualPS {
0032
0033 protected:
0034 Float_t fRed;
0035 Float_t fGreen;
0036 Float_t fBlue;
0037 Float_t fAlpha;
0038 std::vector<float> fAlphas;
0039 Float_t fXsize;
0040 Float_t fYsize;
0041 Int_t fType;
0042 Int_t fPageFormat;
0043 Int_t fPageOrientation;
0044 Int_t fStartStream;
0045 Float_t fLineScale;
0046 Int_t *fObjPos{nullptr};
0047 Int_t fObjPosSize{0};
0048 Int_t fNbObj{0};
0049 Int_t fNbPage;
0050 Int_t fCurrentPage;
0051 std::vector<int> fPageObjects;
0052 std::vector<std::string> fUrls;
0053 std::vector<float> fRectX1;
0054 std::vector<float> fRectY1;
0055 std::vector<float> fRectX2;
0056 std::vector<float> fRectY2;
0057 Bool_t fObjectIsOpen;
0058 Bool_t fPageNotEmpty;
0059 Bool_t fCompress;
0060 Bool_t fRange;
0061 Bool_t fUrl;
0062 Int_t fNbUrl;
0063 Double_t fA;
0064 Double_t fB;
0065 Double_t fC;
0066 Double_t fD;
0067 Double_t fE;
0068 Double_t fF;
0069
0070 static Int_t fgLineJoin;
0071 static Int_t fgLineCap;
0072
0073
0074 public:
0075 TPDF();
0076 TPDF(const char *filename, Int_t type=-111);
0077 ~TPDF() override;
0078
0079 void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override;
0080 void CellArrayFill(Int_t r, Int_t g, Int_t b) override;
0081 void CellArrayEnd() override;
0082 void Close(Option_t *opt = "") override;
0083 Double_t CMtoPDF(Double_t u) { return Int_t(0.5 + 72 * u / 2.54); }
0084 void ComputeRect(const char* chars, Double_t fontsize, Double_t a, Double_t b, Double_t c, Double_t d, Double_t e, Double_t f);
0085 void DrawBox(Double_t x1, Double_t y1,Double_t x2, Double_t y2) override;
0086 void DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt,
0087 Int_t mode, Int_t border, Int_t dark, Int_t light) override;
0088 void DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t *x, Float_t *y);
0089 void DrawHatch(Float_t dy, Float_t angle, Int_t n, Double_t *x, Double_t *y);
0090 void DrawPolyLine(Int_t n, TPoints *xy);
0091 void DrawPolyLineNDC(Int_t n, TPoints *uv);
0092 void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override;
0093 void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y) override;
0094 void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override;
0095 void DrawPS(Int_t n, Double_t *xw, Double_t *yw) override;
0096 void LineTo(Double_t x, Double_t y);
0097 void MoveTo(Double_t x, Double_t y);
0098 void EndObject();
0099 void FontEncode();
0100 void NewObject(Int_t n);
0101 void NewPage() override;
0102 void Off();
0103 void On();
0104 void Open(const char *filename, Int_t type = -111) override;
0105 void PatternEncode();
0106 void PrintFast(Int_t nch, const char *string = "") override;
0107 void PrintStr(const char *string = "") override;
0108 void Range(Float_t xrange, Float_t yrange);
0109 void SetAlpha(Float_t alpha = 1.);
0110 void SetColor(Int_t color = 1);
0111 void SetColor(Float_t r, Float_t g, Float_t b) override;
0112 void SetFillColor( Color_t cindex = 1) override;
0113 void SetFillPatterns(Int_t ipat, Int_t color);
0114 void SetLineColor( Color_t cindex = 1) override;
0115 void SetLineJoin(Int_t linejoin = 0);
0116 void SetLineCap(Int_t linecap = 0);
0117 void SetLineScale(Float_t scale = 1) {fLineScale = scale;}
0118 void SetLineStyle(Style_t linestyle = 1) override;
0119 void SetLineWidth(Width_t linewidth = 1) override;
0120 void SetMarkerColor(Color_t cindex = 1) override;
0121 void SetTextColor(Color_t cindex = 1) override;
0122 void Text(Double_t x, Double_t y, const char *string) override;
0123 void Text(Double_t, Double_t, const wchar_t *) override;
0124 void TextUrl(Double_t x, Double_t y, const char *string, const char *url) override;
0125 void TextNDC(Double_t u, Double_t v, const char *string);
0126 void TextNDC(Double_t, Double_t, const wchar_t *);
0127 void WriteCompressedBuffer();
0128 void WriteCM(Double_t a, Double_t b, Double_t c, Double_t d, Double_t e, Double_t f, Bool_t acc = kTRUE);
0129 void WriteReal(Float_t r, Bool_t space = kTRUE) override;
0130 void WriteUrlObjects();
0131 Double_t UtoPDF(Double_t u);
0132 Double_t VtoPDF(Double_t v);
0133 Double_t XtoPDF(Double_t x);
0134 Double_t YtoPDF(Double_t y);
0135
0136 ClassDefOverride(TPDF, 1);
0137 };
0138
0139 #endif