File indexing completed on 2026-09-28 09:29:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGLPadPainter
0013 #define ROOT_TGLPadPainter
0014
0015 #include "TPadPainterBase.h"
0016 #include "TGLFontManager.h"
0017 #include "TGLPadUtils.h"
0018 #include "TPoint.h"
0019 #include "GuiTypes.h"
0020
0021 #include <vector>
0022
0023 class TLinearGradient;
0024 class TRadialGradient;
0025
0026
0027
0028
0029 class TGLPadPainter : public TPadPainterBase {
0030 private:
0031 Rgl::Pad::PolygonStippleSet fSSet;
0032 Rgl::Pad::Tesselator fTess;
0033 Rgl::Pad::MarkerPainter fMarker;
0034 Rgl::Pad::GLLimits fLimits;
0035
0036 WinContext_t fWinContext;
0037 TAttFill fGlFillAtt;
0038
0039 std::vector<Double_t> fVs;
0040
0041 TGLFontManager fFM;
0042 TGLFont fF;
0043
0044 Int_t fVp[4];
0045
0046 std::vector<TPoint> fPoly;
0047 Bool_t fIsHollowArea;
0048
0049 Bool_t fLocked;
0050
0051 template<class Char_t>
0052 void DrawTextHelper(Double_t x, Double_t y, const Char_t *text, ETextMode mode);
0053 public:
0054 TGLPadPainter();
0055
0056 void SetOpacity(Int_t percent) override;
0057 Float_t GetTextMagnitude() const override;
0058
0059
0060 void OnPad(TVirtualPad *) override;
0061
0062
0063 void SetAttFill(const TAttFill &att) override;
0064 void SetAttLine(const TAttLine &att) override;
0065 void SetAttMarker(const TAttMarker &att) override;
0066 void SetAttText(const TAttText &att) override;
0067
0068
0069 Int_t CreateDrawable(UInt_t w, UInt_t h) override;
0070 void ClearDrawable() override;
0071 void ClearWindow(Int_t device) override;
0072 Int_t ResizeDrawable(Int_t device, UInt_t w, UInt_t h) override;
0073 void CopyDrawable(Int_t device, Int_t px, Int_t py) override;
0074 void DestroyDrawable(Int_t device) override;
0075 void SelectDrawable(Int_t device) override;
0076 void UpdateDrawable(Int_t mode) override;
0077 void SetDrawMode(Int_t device, Int_t mode) override;
0078
0079 void InitPainter() override;
0080 void InvalidateCS() override;
0081 void LockPainter() override;
0082
0083 void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override;
0084 void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
0085
0086 void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override;
0087
0088 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
0089 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
0090
0091
0092 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
0093 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
0094 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
0095
0096
0097 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
0098 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
0099
0100 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
0101 void DrawText(Double_t, Double_t, const wchar_t *, ETextMode) override;
0102 void DrawTextNDC(Double_t x, Double_t y, const char *text, ETextMode mode) override;
0103 void DrawTextNDC(Double_t, Double_t, const wchar_t *, ETextMode) override;
0104
0105
0106 void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
0107
0108
0109 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
0110 Int_t dstX, Int_t dstY, Bool_t enableBlending) override;
0111
0112 Bool_t IsNative() const override { return kTRUE; }
0113
0114 Bool_t IsCocoa() const override;
0115
0116 Bool_t IsSupportAlpha() const override { return kTRUE; }
0117
0118 private:
0119
0120
0121
0122 void SaveProjectionMatrix()const;
0123 void RestoreProjectionMatrix()const;
0124
0125
0126
0127 void SaveModelviewMatrix()const;
0128 void RestoreModelviewMatrix()const;
0129
0130 void SaveViewport();
0131 void RestoreViewport();
0132
0133 void DrawPolyMarker();
0134
0135
0136 void DrawPolygonWithGradient(Int_t n, const Double_t *x, const Double_t *y);
0137
0138 void DrawGradient(const TLinearGradient *gradient, Int_t n, const Double_t *x, const Double_t *y);
0139 void DrawGradient(const TRadialGradient *gradient, Int_t n, const Double_t *x, const Double_t *y);
0140
0141 void DrawTesselation(Int_t n, const Double_t *x, const Double_t *y);
0142
0143 TGLPadPainter(const TGLPadPainter &rhs);
0144 TGLPadPainter & operator = (const TGLPadPainter &rhs);
0145
0146 ClassDefOverride(TGLPadPainter, 0)
0147 };
0148
0149 #endif
0150