00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGLPadUtils
00013 #define ROOT_TGLPadUtils
00014
00015 #include <vector>
00016 #include <list>
00017
00018 #ifndef ROOT_RStipples
00019 #include "RStipples.h"
00020 #endif
00021 #ifndef ROOT_TPoint
00022 #include "TPoint.h"
00023 #endif
00024 #ifndef ROOT_Rtypes
00025 #include "Rtypes.h"
00026 #endif
00027
00028 class TGLPadPainter;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace Rgl {
00039 namespace Pad {
00040
00041
00042
00043
00044 class PolygonStippleSet {
00045 friend class ::TGLPadPainter;
00046 friend class FillAttribSet;
00047 private:
00048 std::vector<unsigned char> fStipples;
00049
00050 static const UInt_t fgBitSwap[];
00051 static UInt_t SwapBits(UInt_t bits);
00052
00053 enum EGeometry {
00054 kRowSize = 4,
00055 kNRows = 32,
00056 kStippleSize = kNRows * kRowSize
00057 };
00058
00059 enum EBitMasks {
00060 kLow4 = 0xf,
00061 kUp4 = 0xf0,
00062 k16Bits = 0xff
00063 };
00064 public:
00065 PolygonStippleSet();
00066 };
00067
00068
00069
00070
00071 class FillAttribSet {
00072 UInt_t fStipple;
00073 public:
00074 FillAttribSet(const PolygonStippleSet & set, Bool_t ignoreStipple);
00075 ~FillAttribSet();
00076 };
00077
00078
00079
00080
00081
00082 extern const UShort_t gLineStipples[];
00083 extern const UInt_t gMaxStipple;
00084
00085
00086
00087
00088 class LineAttribSet {
00089 private:
00090 Bool_t fSmooth;
00091 UInt_t fStipple;
00092 Bool_t fSetWidth;
00093 public:
00094 LineAttribSet(Bool_t smooth, UInt_t stipple, Double_t maxWidth, Bool_t setWidth);
00095 ~LineAttribSet();
00096 };
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 class MarkerPainter {
00109 private:
00110
00111 mutable TPoint fStar[8];
00112 mutable TPoint fCross[4];
00113
00114 mutable std::vector<TPoint> fCircle;
00115
00116 enum {
00117 kSmallCirclePts = 80,
00118 kLargeCirclePts = 150
00119 };
00120
00121 public:
00122
00123 void DrawDot(UInt_t n, const TPoint *xy)const;
00124 void DrawPlus(UInt_t n, const TPoint *xy)const;
00125 void DrawStar(UInt_t n, const TPoint *xy)const;
00126 void DrawX(UInt_t n, const TPoint *xy)const;
00127 void DrawFullDotSmall(UInt_t n, const TPoint *xy)const;
00128 void DrawFullDotMedium(UInt_t n, const TPoint *xy)const;
00129
00130 void DrawCircle(UInt_t n, const TPoint *xy)const;
00131 void DrawFullDotLarge(UInt_t n, const TPoint *xy)const;
00132
00133 void DrawFullSquare(UInt_t n, const TPoint *xy)const;
00134 void DrawFullTrianlgeUp(UInt_t n, const TPoint *xy)const;
00135 void DrawFullTrianlgeDown(UInt_t n, const TPoint *xy)const;
00136 void DrawDiamond(UInt_t n, const TPoint *xy)const;
00137 void DrawCross(UInt_t n, const TPoint *xy)const;
00138 void DrawFullStar(UInt_t n, const TPoint *xy)const;
00139 void DrawOpenStar(UInt_t n, const TPoint *xy)const;
00140
00141 };
00142
00143
00144
00145
00146
00147
00148
00149 struct MeshPatch_t {
00150 MeshPatch_t(Int_t type) : fPatchType(type)
00151 {}
00152
00153 Int_t fPatchType;
00154 std::vector<Double_t> fPatch;
00155 };
00156
00157 typedef std::list<MeshPatch_t> Tesselation_t;
00158
00159 class Tesselator {
00160
00161
00162 public:
00163 Tesselator(Bool_t dump = kFALSE);
00164
00165 ~Tesselator();
00166
00167 void *GetTess()const
00168 {
00169 return fTess;
00170 }
00171
00172 static void SetDump(Tesselation_t *t)
00173 {
00174 fVs = t;
00175 }
00176
00177 static Tesselation_t *GetDump()
00178 {
00179 return fVs;
00180 }
00181
00182 private:
00183
00184 void *fTess;
00185
00186 static Tesselation_t *fVs;
00187 };
00188
00189
00190
00191
00192
00193 class OffScreenDevice {
00194 friend class ::TGLPadPainter;
00195 public:
00196 OffScreenDevice(UInt_t w, UInt_t h, UInt_t x, UInt_t y, Bool_t top);
00197
00198 private:
00199 UInt_t fW;
00200 UInt_t fH;
00201 UInt_t fX;
00202 UInt_t fY;
00203 Bool_t fTop;
00204 };
00205
00206 void ExtractRGB(Color_t colorIndex, Float_t * rgb);
00207
00208 class GLLimits {
00209 public:
00210 GLLimits();
00211
00212 Double_t GetMaxLineWidth()const;
00213 Double_t GetMaxPointSize()const;
00214 private:
00215 mutable Double_t fMaxLineWidth;
00216 mutable Double_t fMaxPointSize;
00217 };
00218
00219 }
00220 }
00221
00222 #endif