29 const UInt_t PolygonStippleSet::fgBitSwap[] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};
35 #ifndef GL_VERSION_1_2
36 const GLenum lineWidthPNAME = GLenum(0xB22);
37 const GLenum pointSizePNAME = GLenum(0xB12);
39 const GLenum lineWidthPNAME = GLenum(GL_SMOOTH_LINE_WIDTH_RANGE);
40 const GLenum pointSizePNAME = GLenum(GL_SMOOTH_POINT_SIZE_RANGE);
85 for (
UInt_t i = 0; i < numOfStipples; ++i) {
88 for (
Int_t j = 15, j1 = 0; j >= 0; --j, ++j1) {
91 for (
Int_t k = 1, k1 = 0; k >= 0; --k, ++k1) {
93 const UInt_t ind = baseInd + rowShift + k1;
126 : fStipple(0), fAlpha(1.)
130 if (!ignoreStipple) {
133 fStipple = (fasi >= 1 && fasi <=25) ? fasi : 2;
135 glEnable(GL_POLYGON_STIPPLE);
140 Float_t rgba[] = {0.f, 0.f, 0.f, 1.f};
145 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
155 glDisable(GL_POLYGON_STIPPLE);
165 const UShort_t gLineStipples[] = {0xffff, 0xffff, 0x3333, 0x5555,
166 0xf040, 0xf4f4, 0xf111, 0xf0f0,
167 0xff11, 0x3fff, 0x08ff};
169 const UInt_t gMaxStipple =
sizeof gLineStipples /
sizeof gLineStipples[0];
179 : fSmooth(smooth), fStipple(stipple), fSetWidth(setWidth), fAlpha(0.8)
183 glEnable(GL_LINE_SMOOTH);
184 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
185 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
193 glEnable(GL_LINE_STIPPLE);
199 Float_t rgba[] = {0.f, 0.f, 0.f, 0.8f};
204 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
211 glLineWidth(w > maxWidth ? maxWidth : !w ? 1.
f : w);
220 glDisable(GL_LINE_SMOOTH);
225 glDisable(GL_LINE_STIPPLE);
242 glVertex2d(xy[i].fX, xy[i].fY);
255 for (
UInt_t i = 0; i <
n; ++i) {
258 glVertex2d(-im + x, y);
259 glVertex2d(im + x, y);
260 glVertex2d(x, -im + y);
261 glVertex2d(x, im + y);
285 for (
UInt_t i = 0; i <
n; ++i) {
310 for (
UInt_t i = 0; i <
n; ++i) {
314 glVertex2d(-im + x, -im + y);
315 glVertex2d(im + x, im + y);
316 glVertex2d(-im + x, im + y);
317 glVertex2d(im + x, -im + y);
329 for (
UInt_t i = 0; i <
n; ++i) {
333 glVertex2d(-1. + x, y);
334 glVertex2d(x + 1., y);
335 glVertex2d(x, -1. + y);
336 glVertex2d(x, 1. + y);
347 glRectd(xy[i].fX - 1, xy[i].fY - 1, xy[i].fX + 1, xy[i].fY + 1);
352 void CalculateCircle(std::vector<TPoint> &circle,
Double_t r,
UInt_t pts);
366 for (
UInt_t i = 0; i <
n; ++i) {
370 glBegin(GL_LINE_LOOP);
390 for (
UInt_t i = 0; i <
n; ++i) {
394 glBegin(GL_TRIANGLE_FAN);
407 glRectd(xy[i].fX - im, xy[i].fY - im, xy[i].fX + im, xy[i].fY + im);
415 for (
UInt_t i = 0; i <
n; ++i) {
419 glVertex2d(x - im, y - im);
420 glVertex2d(x + im, y - im);
421 glVertex2d(x, im + y);
432 for (
UInt_t i = 0; i <
n; ++i) {
436 glVertex2d(x - im, y + im);
437 glVertex2d(x, y - im);
438 glVertex2d(im + x, y + im);
450 for (
UInt_t i = 0; i <
n; ++i) {
454 glBegin(GL_LINE_LOOP);
455 glVertex2d(x - imx, y);
456 glVertex2d(x, y - im);
457 glVertex2d(x + imx, y);
458 glVertex2d(x, y + im);
470 for (
UInt_t i = 0; i <
n; ++i) {
474 glBegin(GL_LINE_LOOP);
475 glVertex2d(x - im, y - imx);
476 glVertex2d(x - imx, y - imx);
477 glVertex2d(x - imx, y - im);
478 glVertex2d(x + imx, y - im);
479 glVertex2d(x + imx, y - imx);
480 glVertex2d(x + im, y - imx);
481 glVertex2d(x + im, y + imx);
482 glVertex2d(x + imx, y + imx);
483 glVertex2d(x + imx, y + im);
484 glVertex2d(x - imx, y + im);
485 glVertex2d(x - imx, y + imx);
486 glVertex2d(x - im, y + imx);
502 for (
UInt_t i = 0; i <
n; ++i) {
506 glBegin(GL_TRIANGLES);
507 glVertex2d(x - im, y - im4);
508 glVertex2d(x - im2, y + im1);
509 glVertex2d(x - im4, y - im4);
511 glVertex2d(x - im2, y + im1);
512 glVertex2d(x - im3, y + im);
513 glVertex2d(x, y + im2);
515 glVertex2d(x, y + im2);
516 glVertex2d(x + im3, y + im);
517 glVertex2d(x + im2, y + im1);
519 glVertex2d(x + im2, y + im1);
520 glVertex2d(x + im, y - im4);
521 glVertex2d(x + im4, y - im4);
523 glVertex2d(x + im4, y - im4);
524 glVertex2d(x, y - im);
525 glVertex2d(x - im4, y - im4);
527 glVertex2d(x - im4, y - im4);
528 glVertex2d(x - im2, y + im1);
529 glVertex2d(x, y + im2);
531 glVertex2d(x - im4, y - im4);
532 glVertex2d(x, y + im2);
533 glVertex2d(x + im2, y + im1);
535 glVertex2d(x - im4, y - im4);
536 glVertex2d(x + im2, y + im1);
537 glVertex2d(x + im4, y - im4);
555 for (
UInt_t i = 0; i <
n; ++i) {
559 glBegin(GL_LINE_LOOP);
560 glVertex2d(x - im, y - im4);
561 glVertex2d(x - im2, y + im1);
562 glVertex2d(x - im3, y + im);
563 glVertex2d(x, y + im2);
564 glVertex2d(x + im3, y + im);
565 glVertex2d(x + im2, y + im1);
566 glVertex2d(x + im, y - im4);
567 glVertex2d(x + im4, y - im4);
568 glVertex2d(x, y - im);
569 glVertex2d(x - im4, y - im4);
582 #if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 && __APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
583 typedef GLvoid (*tess_t)(...);
584 #elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__) || defined (__APPLE__)
585 typedef GLvoid (*tess_t)();
586 #elif defined ( WIN32)
587 typedef GLvoid (
CALLBACK *tess_t)( );
589 #error "Error - need to define type tess_t for this platform/compiler"
612 std::vector<Double_t> & vs = dump->back().fPatch;
631 GLUtesselator *tess = gluNewTess();
633 throw std::runtime_error(
"tesselator creation failed");
636 gluTessCallback(tess, (GLenum)GLU_BEGIN, (tess_t) glBegin);
637 gluTessCallback(tess, (GLenum)GLU_END, (tess_t) glEnd);
638 gluTessCallback(tess, (GLenum)GLU_VERTEX, (tess_t) glVertex3dv);
640 gluTessCallback(tess, (GLenum)GLU_BEGIN, (tess_t)
Begin);
641 gluTessCallback(tess, (GLenum)GLU_END, (tess_t)
End);
642 gluTessCallback(tess, (GLenum)GLU_VERTEX, (tess_t)
Vertex);
645 gluTessProperty(tess, GLU_TESS_TOLERANCE, 1e-10);
653 gluDeleteTess((GLUtesselator *)
fTess);
663 : fW(w), fH(h), fX(x), fY(y), fTop(top)
681 glGetDoublev(lineWidthPNAME, lp);
694 glGetDoublev(pointSizePNAME, lp);
708 color->
GetRGB(rgba[0], rgba[1], rgba[2]);
715 template<
class ValueType>
718 assert(nPoints > 0 &&
"FindBoundingRect, invalind number of points");
719 assert(xs !=
nullptr &&
"FindBoundingRect, parameter 'xs' is null");
720 assert(ys !=
nullptr &&
"FindBoundingRect, parameter 'ys' is null");
722 ValueType xMin = xs[0], xMax = xMin;
723 ValueType yMin = ys[0], yMax = yMin;
725 for (
Int_t i = 1; i < nPoints; ++i) {
757 void CalculateCircle(std::vector<TPoint> &circle,
Double_t r,
UInt_t pts)
760 const UInt_t first = circle.size();
762 circle.resize(circle.size() + pts + 1);
764 for (
UInt_t i = 0; i < pts; ++i, angle += delta) {
769 circle.back().fX = circle[first].fX;
770 circle.back().fY = circle[first].fY;
void DrawDot(UInt_t n, const TPoint *xy) const
Simple 1-pixel dots.
OffScreenDevice(UInt_t w, UInt_t h, UInt_t x, UInt_t y, Bool_t top)
static UInt_t SwapBits(UInt_t bits)
void DrawFullDotLarge(UInt_t n, const TPoint *xy) const
std::vector< TPoint > fCircle
Double_t GetMaxLineWidth() const
void DrawCircle(UInt_t n, const TPoint *xy) const
Short_t Min(Short_t a, Short_t b)
void DrawFullTrianlgeDown(UInt_t n, const TPoint *xy) const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void DrawDiamond(UInt_t n, const TPoint *xy) const
void DrawFullDotMedium(UInt_t n, const TPoint *xy) const
void ExtractRGBA(Color_t colorIndex, Float_t *rgba)
std::vector< unsigned char > fStipples
Tesselator(Bool_t dump=kFALSE)
void DrawFullSquare(UInt_t n, const TPoint *xy) const
void DrawFullDotSmall(UInt_t n, const TPoint *xy) const
LineAttribSet(Bool_t smooth, UInt_t stipple, Double_t maxWidth, Bool_t setWidth)
Set up line parameters.
void DrawFullStar(UInt_t n, const TPoint *xy) const
HIGZ full star pentagone.
void DrawPlus(UInt_t n, const TPoint *xy) const
std::list< MeshPatch_t > Tesselation_t
void DrawFullTrianlgeUp(UInt_t n, const TPoint *xy) const
void DrawCross(UInt_t n, const TPoint *xy) const
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
void DrawStar(UInt_t n, const TPoint *xy) const
const unsigned char gStipples[26][32]
Double_t GetMaxPointSize() const
The color creation and management class.
static Tesselation_t * GetDump()
static const UInt_t fgBitSwap[]
BoundingRect< ValueType > FindBoundingRect(Int_t nPoints, const ValueType *xs, const ValueType *ys)
FillAttribSet(const PolygonStippleSet &set, Bool_t ignoreStipple)
Polygon stipple, if required.
Short_t Max(Short_t a, Short_t b)
void DrawX(UInt_t n, const TPoint *xy) const
void DrawOpenStar(UInt_t n, const TPoint *xy) const
HIGZ full star pentagone.
void Vertex(const Double_t *v)