Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:31:08

0001 // Author:  Sergey Linev, GSI  10/04/2017
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_TWebPadPainter
0012 #define ROOT_TWebPadPainter
0013 
0014 #include "TPadPainterBase.h"
0015 
0016 #include <string>
0017 
0018 #include "TWebPainting.h"
0019 
0020 class TWebCanvas;
0021 
0022 class TWebPadPainter : public TPadPainterBase {
0023 
0024 friend class TWebCanvas;
0025 
0026 protected:
0027 
0028    TWebPainting *fPainting{nullptr};      ///<! object to store all painting, owned by TWebPS object
0029 
0030    enum { attrLine = 0x1, attrFill = 0x2, attrMarker = 0x4, attrText = 0x8, attrAll = 0xf };
0031 
0032    Float_t *StoreOperation(const std::string &oper, unsigned attrkind, int opersize = 0);
0033 
0034 public:
0035 
0036    TWebPadPainter() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
0037 
0038    void SetPainting(TWebPainting *p) { fPainting = p; }
0039 
0040 
0041    void     SetOpacity(Int_t percent) override;
0042 
0043    //2. "Off-screen management" part.
0044    Int_t    CreateDrawable(UInt_t, UInt_t) override { return -1; }
0045    void     ClearDrawable() override {}
0046    void     CopyDrawable(Int_t, Int_t, Int_t) override {}
0047    void     DestroyDrawable(Int_t) override {}
0048    void     SelectDrawable(Int_t) override {}
0049 
0050    //jpg, png, bmp, gif output.
0051    void     SaveImage(TVirtualPad *, const char *, Int_t) const override;
0052 
0053    //TASImage support (noop for a non-gl pad).
0054    void     DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
0055                        Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override;
0056 
0057    void     DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override;
0058    void     DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
0059 
0060    void     DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override;
0061    //TPad needs double and float versions.
0062    void     DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
0063    void     DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
0064 
0065    //TPad needs both double and float versions of DrawPolyLine.
0066    void     DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
0067    void     DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
0068    void     DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
0069 
0070    //TPad needs both versions.
0071    void     DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
0072    void     DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
0073 
0074    void     DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
0075    void     DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
0076    void     DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
0077    void     DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
0078 
0079    void     DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
0080 
0081    Bool_t   IsSupportAlpha() const override { return kTRUE; }
0082 
0083 private:
0084    //Let's make this clear:
0085    TWebPadPainter(const TWebPadPainter &rhs) = delete;
0086    TWebPadPainter(TWebPadPainter && rhs) = delete;
0087    TWebPadPainter & operator = (const TWebPadPainter &rhs) = delete;
0088    TWebPadPainter & operator = (TWebPadPainter && rhs) = delete;
0089 
0090    ClassDefOverride(TWebPadPainter, 0) //Abstract interface for painting in TPad
0091 };
0092 
0093 #endif