24#include "TGLIncludes.h"
29const UInt_t PolygonStippleSet::fgBitSwap[] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};
86 for (
UInt_t i = 0; i < numOfStipples; ++i) {
89 for (
Int_t j = 15, j1 = 0; j >= 0; --j, ++j1) {
92 for (
Int_t k = 1, k1 = 0; k >= 0; --k, ++k1) {
94 const UInt_t ind = baseInd + rowShift + k1;
124 : fStipple(0), fAlpha(1.)
131 if (!ignoreStipple) {
133 const UInt_t fasi = fillStyle % 1000;
134 fStipple = (fasi >= 1 && fasi <=25) ? fasi : 2;
136 glEnable(GL_POLYGON_STIPPLE);
141 Float_t rgba[] = {0.f, 0.f, 0.f, 1.f};
146 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
156 glDisable(GL_POLYGON_STIPPLE);
167 0xf040, 0xf4f4, 0xf111, 0xf0f0,
168 0xff11, 0x3fff, 0x08ff};
180 : fSmooth(smooth), fStipple(stipple), fSetWidth(setWidth), fAlpha(0.8)
184 glEnable(GL_LINE_SMOOTH);
185 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
186 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
197 glEnable(GL_LINE_STIPPLE);
203 Float_t rgba[] = {0.f, 0.f, 0.f, 0.8f};
208 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
214 glLineWidth(lineWidth > maxWidth ? maxWidth : !lineWidth ? 1.f : lineWidth);
223 glDisable(GL_LINE_SMOOTH);
228 glDisable(GL_LINE_STIPPLE);
240 Int_t markerSize = 0;
241 std::vector<TPoint> markerShape;
251 glVertex2d(
xy[i].fX,
xy[i].fY);
256 markerShape.emplace_back(0,0);
262 markerShape.reserve(markerShape.size() + pts + 1);
264 for (
int i = 0; i < pts; ++i,
angle += delta)
266 markerShape.emplace_back(
r, 0);
271 if (changePolygonMode)
272 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
273 for (
unsigned i = 0; i <
n; ++i) {
277 glBegin(GL_LINE_LOOP);
279 glBegin(GL_TRIANGLE_FAN);
283 for (
auto &pnt : markerShape)
284 glVertex2d(
x + pnt.fX,
y - pnt.fY);
287 if (changePolygonMode)
288 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
292 for (
unsigned i = 0; i <
n; ++i) {
295 for (
auto &pnt : markerShape)
296 glVertex2d(
x + pnt.fX,
y - pnt.fY);
301 for (
unsigned i = 0; i <
n; ++i) {
304 glBegin(GL_TRIANGLES);
305 for (
auto &pnt : markerShape)
306 glVertex2d(
x + pnt.fX,
y - pnt.fY);
324#if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 && __APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
325 typedef GLvoid (*tess_t)(...);
326#elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__) || defined (__APPLE__)
327 typedef GLvoid (*tess_t)();
328#elif defined ( WIN32)
329 typedef GLvoid (
CALLBACK *tess_t)( );
331 #error "Error - need to define type tess_t for this platform/compiler"
354 std::vector<Double_t> & vs = dump->back().fPatch;
373 GLUtesselator *tess = gluNewTess();
375 throw std::runtime_error(
"tesselator creation failed");
377#if defined(__GNUC__) && __GNUC__ >= 8
378#pragma GCC diagnostic push
379#pragma GCC diagnostic ignored "-Wcast-function-type"
383 gluTessCallback(tess, (GLenum)GLU_BEGIN, (tess_t) impl_glBegin);
384 gluTessCallback(tess, (GLenum)GLU_END, (tess_t) impl_glEnd);
385 gluTessCallback(tess, (GLenum)GLU_VERTEX, (tess_t) impl_glVertex3dv);
387 gluTessCallback(tess, (GLenum)GLU_BEGIN, (tess_t)
Begin);
388 gluTessCallback(tess, (GLenum)GLU_END, (tess_t)
End);
389 gluTessCallback(tess, (GLenum)GLU_VERTEX, (tess_t)
Vertex);
392#if defined(__GNUC__) && __GNUC__ >= 8
393#pragma GCC diagnostic pop
396 gluTessProperty(tess, GLU_TESS_TOLERANCE, 1
e-10);
404 gluDeleteTess((GLUtesselator *)
fTess);
414 : fW(
w), fH(
h), fX(
x), fY(
y), fTop(top)
459 color->
GetRGB(rgba[0], rgba[1], rgba[2]);
466template<
class ValueType>
469 assert(nPoints > 0 &&
"FindBoundingRect, invalind number of points");
470 assert(xs !=
nullptr &&
"FindBoundingRect, parameter 'xs' is null");
471 assert(ys !=
nullptr &&
"FindBoundingRect, parameter 'ys' is null");
473 ValueType xMin = xs[0], xMax = xMin;
474 ValueType yMin = ys[0], yMax = yMin;
476 for (
Int_t i = 1; i < nPoints; ++i) {
487 box.fWidth = xMax - xMin;
491 box.fHeight = yMax - yMin;
const unsigned char gStipples[26][32]
short Style_t
Style number (short)
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
short Width_t
Line width (short)
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
short SCoord_t
Screen coordinates (short)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
FillAttribSet(const PolygonStippleSet &set, Bool_t ignoreStipple, const TAttFill *att=nullptr)
Polygon stipple, if required.
Double_t GetMaxLineWidth() const
Double_t GetMaxPointSize() const
LineAttribSet(Bool_t smooth, UInt_t stipple, Double_t maxWidth, Bool_t setWidth, const TAttLine *att=nullptr)
Set up line parameters.
static void DrawMarkers(UInt_t n, const TPoint *xy, const TAttMarker &attr)
Auxiliary class to draw markers in a gl-pad.
OffScreenDevice(UInt_t w, UInt_t h, UInt_t x, UInt_t y, Bool_t top)
std::vector< unsigned char > fStipples
static UInt_t SwapBits(UInt_t bits)
static const UInt_t fgBitSwap[]
Tesselator(Bool_t dump=kFALSE)
static Tesselation_t * GetDump()
static Tesselation_t * fVs
Fill Area Attributes class.
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
The color creation and management class.
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
const UShort_t gLineStipples[]
std::list< MeshPatch_t > Tesselation_t
BoundingRect< ValueType > FindBoundingRect(Int_t nPoints, const ValueType *xs, const ValueType *ys)
void Vertex(const Double_t *v)
void ExtractRGBA(Color_t colorIndex, Float_t *rgba)
const GLenum lineWidthPNAME
const GLenum pointSizePNAME
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
constexpr Double_t TwoPi()