File indexing completed on 2026-09-18 09:30:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGLPadUtils
0013 #define ROOT_TGLPadUtils
0014
0015 #include <vector>
0016 #include <list>
0017
0018 #include "RStipples.h"
0019 #include "TPoint.h"
0020 #include "RtypesCore.h"
0021
0022 class TGLPadPainter;
0023 class TAttFill;
0024 class TAttLine;
0025
0026
0027
0028
0029
0030
0031
0032
0033 namespace Rgl {
0034 namespace Pad {
0035
0036
0037
0038
0039 class PolygonStippleSet {
0040 friend class ::TGLPadPainter;
0041 friend class FillAttribSet;
0042 private:
0043 std::vector<unsigned char> fStipples;
0044
0045 static const UInt_t fgBitSwap[];
0046 static UInt_t SwapBits(UInt_t bits);
0047
0048 enum EGeometry {
0049 kRowSize = 4,
0050 kNRows = 32,
0051 kStippleSize = kNRows * kRowSize
0052 };
0053
0054 enum EBitMasks {
0055 kLow4 = 0xf,
0056 kUp4 = 0xf0,
0057 k16Bits = 0xff
0058 };
0059 public:
0060 PolygonStippleSet();
0061 };
0062
0063
0064
0065
0066 class FillAttribSet {
0067 UInt_t fStipple;
0068 Float_t fAlpha;
0069 public:
0070 FillAttribSet(const PolygonStippleSet & set, Bool_t ignoreStipple, const TAttFill *att = nullptr);
0071 ~FillAttribSet();
0072 };
0073
0074
0075
0076
0077
0078 extern const UShort_t gLineStipples[];
0079 extern const UInt_t gMaxStipple;
0080
0081
0082
0083
0084 class LineAttribSet {
0085 private:
0086 Bool_t fSmooth;
0087 UInt_t fStipple;
0088 Bool_t fSetWidth;
0089 Float_t fAlpha;
0090 public:
0091 LineAttribSet(Bool_t smooth, UInt_t stipple, Double_t maxWidth, Bool_t setWidth, const TAttLine *att = nullptr);
0092 ~LineAttribSet();
0093 };
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105 class MarkerPainter {
0106 private:
0107
0108 mutable TPoint fStar[8];
0109 mutable TPoint fCross[4];
0110
0111 mutable std::vector<TPoint> fCircle;
0112
0113 Size_t fMarkerSize;
0114 Width_t fMarkerWidth;
0115 Bool_t fSetMarker = kFALSE;
0116
0117 enum {
0118 kSmallCirclePts = 80,
0119 kLargeCirclePts = 150
0120 };
0121
0122 public:
0123 void SetMarkerSizeWidth(Size_t size, Width_t width);
0124 Size_t GetMarkerSize() const;
0125 Width_t GetMarkerWidth() const;
0126
0127
0128 void DrawDot(UInt_t n, const TPoint *xy)const;
0129 void DrawPlus(UInt_t n, const TPoint *xy)const;
0130 void DrawStar(UInt_t n, const TPoint *xy)const;
0131 void DrawX(UInt_t n, const TPoint *xy)const;
0132 void DrawFullDotSmall(UInt_t n, const TPoint *xy)const;
0133 void DrawFullDotMedium(UInt_t n, const TPoint *xy)const;
0134
0135 void DrawCircle(UInt_t n, const TPoint *xy)const;
0136 void DrawFullDotLarge(UInt_t n, const TPoint *xy)const;
0137
0138 void DrawFullSquare(UInt_t n, const TPoint *xy)const;
0139 void DrawFullTrianlgeUp(UInt_t n, const TPoint *xy)const;
0140 void DrawFullTrianlgeDown(UInt_t n, const TPoint *xy)const;
0141 void DrawDiamond(UInt_t n, const TPoint *xy)const;
0142 void DrawFullDiamond(UInt_t n, const TPoint *xy)const;
0143 void DrawOpenTrianlgeDown(UInt_t n, const TPoint *xy)const;
0144 void DrawFullCross(UInt_t n, const TPoint *xy)const;
0145 void DrawOpenCross(UInt_t n, const TPoint *xy)const;
0146 void DrawFullStar(UInt_t n, const TPoint *xy)const;
0147 void DrawOpenStar(UInt_t n, const TPoint *xy)const;
0148 void DrawOpenSquareDiagonal(UInt_t n, const TPoint *xy)const;
0149 void DrawOpenDiamondCross(UInt_t n, const TPoint *xy)const;
0150 void DrawOpenThreeTriangles(UInt_t n, const TPoint *xy)const;
0151 void DrawOctagonCross(UInt_t n, const TPoint *xy)const;
0152 void DrawFullThreeTriangles(UInt_t n, const TPoint *xy)const;
0153 void DrawOpenFourTrianglesX(UInt_t n, const TPoint *xy)const;
0154 void DrawFullFourTrianglesX(UInt_t n, const TPoint *xy)const;
0155 void DrawOpenDoubleDiamond(UInt_t n, const TPoint *xy)const;
0156 void DrawFullDoubleDiamond(UInt_t n, const TPoint *xy)const;
0157 void DrawOpenFourTrianglesPlus(UInt_t n, const TPoint *xy)const;
0158 void DrawFullFourTrianglesPlus(UInt_t n, const TPoint *xy)const;
0159 void DrawOpenCrossX(UInt_t n, const TPoint *xy)const;
0160 void DrawFullCrossX(UInt_t n, const TPoint *xy)const;
0161 void DrawFourSquaresX(UInt_t n, const TPoint *xy)const;
0162 void DrawFourSquaresPlus(UInt_t n, const TPoint *xy)const;
0163 };
0164
0165
0166
0167
0168
0169
0170
0171 struct MeshPatch_t {
0172 MeshPatch_t(Int_t type) : fPatchType(type)
0173 {}
0174
0175 Int_t fPatchType;
0176 std::vector<Double_t> fPatch;
0177 };
0178
0179 typedef std::list<MeshPatch_t> Tesselation_t;
0180
0181 class Tesselator {
0182
0183
0184 public:
0185 Tesselator(Bool_t dump = kFALSE);
0186
0187 ~Tesselator();
0188
0189 void *GetTess()const
0190 {
0191 return fTess;
0192 }
0193
0194 static void SetDump(Tesselation_t *t)
0195 {
0196 fVs = t;
0197 }
0198
0199 static Tesselation_t *GetDump()
0200 {
0201 return fVs;
0202 }
0203
0204 private:
0205
0206 void *fTess;
0207
0208 static Tesselation_t *fVs;
0209 };
0210
0211
0212
0213
0214
0215 class OffScreenDevice {
0216 friend class ::TGLPadPainter;
0217 public:
0218 OffScreenDevice(UInt_t w, UInt_t h, UInt_t x, UInt_t y, Bool_t top);
0219
0220 private:
0221 UInt_t fW;
0222 UInt_t fH;
0223 UInt_t fX;
0224 UInt_t fY;
0225 Bool_t fTop;
0226 };
0227
0228 void ExtractRGBA(Color_t colorIndex, Float_t *rgba);
0229
0230 class GLLimits {
0231 public:
0232 GLLimits();
0233
0234 Double_t GetMaxLineWidth()const;
0235 Double_t GetMaxPointSize()const;
0236 private:
0237 mutable Double_t fMaxLineWidth;
0238 mutable Double_t fMaxPointSize;
0239 };
0240
0241
0242
0243
0244 template<class ValueType>
0245 struct BoundingRect {
0246 ValueType fXMin = ValueType();
0247 ValueType fYMin = ValueType();
0248 ValueType fWidth = ValueType();
0249 ValueType fHeight = ValueType();
0250
0251 ValueType fXMax = ValueType();
0252 ValueType fYMax = ValueType();
0253 };
0254
0255
0256 template<class ValueType>
0257 BoundingRect<ValueType> FindBoundingRect(Int_t nPoints, const ValueType *xs, const ValueType *ys);
0258
0259
0260 }
0261 }
0262
0263 #endif