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;
127 : fStipple(0), fAlpha(1.)
131 if (!ignoreStipple) {
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);
194 glEnable(GL_LINE_STIPPLE);
200 Float_t rgba[] = {0.f, 0.f, 0.f, 0.8f};
205 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
212 glLineWidth(w > maxWidth ? maxWidth : !w ? 1.f : w);
221 glDisable(GL_LINE_SMOOTH);
226 glDisable(GL_LINE_STIPPLE);
244 glVertex2d(
xy[i].fX,
xy[i].fY);
257 for (
UInt_t i = 0; i <
n; ++i) {
260 glVertex2d(-im +
x,
y);
261 glVertex2d(im +
x,
y);
262 glVertex2d(
x, -im +
y);
263 glVertex2d(
x, im +
y);
287 for (
UInt_t i = 0; i <
n; ++i) {
312 for (
UInt_t i = 0; i <
n; ++i) {
316 glVertex2d(-im +
x, -im +
y);
317 glVertex2d(im +
x, im +
y);
318 glVertex2d(-im +
x, im +
y);
319 glVertex2d(im +
x, -im +
y);
331 for (
UInt_t i = 0; i <
n; ++i) {
335 glVertex2d(-1. +
x,
y);
336 glVertex2d(
x + 1.,
y);
337 glVertex2d(
x, -1. +
y);
338 glVertex2d(
x, 1. +
y);
349 glRectd(
xy[i].fX - 1,
xy[i].fY - 1,
xy[i].fX + 1,
xy[i].fY + 1);
354void CalculateCircle(std::vector<TPoint> &circle,
Double_t r,
UInt_t pts);
368 for (
UInt_t i = 0; i <
n; ++i) {
392 for (
UInt_t i = 0; i <
n; ++i) {
409 glRectd(
xy[i].fX - im,
xy[i].fY - im,
xy[i].fX + im,
xy[i].fY + im);
417 for (
UInt_t i = 0; i <
n; ++i) {
421 glVertex2d(
x - im,
y - im);
422 glVertex2d(
x + im,
y - im);
423 glVertex2d(
x, im +
y);
434 for (
UInt_t i = 0; i <
n; ++i) {
438 glVertex2d(
x - im,
y + im);
439 glVertex2d(
x,
y - im);
440 glVertex2d(im +
x,
y + im);
452 for (
UInt_t i = 0; i <
n; ++i) {
457 glVertex2d(
x - imx,
y);
458 glVertex2d(
x,
y - im);
459 glVertex2d(
x + imx,
y);
460 glVertex2d(
x,
y + im);
472 for (
UInt_t i = 0; i <
n; ++i) {
477 glVertex2d(
x - imx,
y);
478 glVertex2d(
x,
y - im);
479 glVertex2d(
x + imx,
y);
480 glVertex2d(
x,
y + im);
491 for (
UInt_t i = 0; i <
n; ++i) {
495 glVertex2d(
x - im,
y + im);
496 glVertex2d(
x,
y - im);
497 glVertex2d(im +
x,
y + im);
509 for (
UInt_t i = 0; i <
n; ++i) {
514 glVertex2d(
x - im,
y - imx);
515 glVertex2d(
x - imx,
y - imx);
516 glVertex2d(
x - imx,
y - im);
517 glVertex2d(
x + imx,
y - im);
518 glVertex2d(
x + imx,
y - imx);
519 glVertex2d(
x + im,
y - imx);
520 glVertex2d(
x + im,
y + imx);
521 glVertex2d(
x + imx,
y + imx);
522 glVertex2d(
x + imx,
y + im);
523 glVertex2d(
x - imx,
y + im);
524 glVertex2d(
x - imx,
y + imx);
525 glVertex2d(
x - im,
y + imx);
537 for (
UInt_t i = 0; i <
n; ++i) {
542 glVertex2d(
x - im,
y - imx);
543 glVertex2d(
x - im,
y + imx);
544 glVertex2d(
x + im,
y + imx);
545 glVertex2d(
x + im,
y - imx);
548 glVertex2d(
x - imx,
y + imx);
549 glVertex2d(
x - imx,
y + im);
550 glVertex2d(
x + imx,
y + im);
551 glVertex2d(
x + imx,
y + imx);
555 glVertex2d(
x - imx,
y - imx);
556 glVertex2d(
x - imx,
y - im);
557 glVertex2d(
x + imx,
y - im);
558 glVertex2d(
x + imx,
y - imx);
574 for (
UInt_t i = 0; i <
n; ++i) {
579 glVertex2d(
x - im,
y - im4);
580 glVertex2d(
x - im2,
y + im1);
581 glVertex2d(
x - im4,
y - im4);
583 glVertex2d(
x - im2,
y + im1);
584 glVertex2d(
x - im3,
y + im);
585 glVertex2d(
x,
y + im2);
587 glVertex2d(
x,
y + im2);
588 glVertex2d(
x + im3,
y + im);
589 glVertex2d(
x + im2,
y + im1);
591 glVertex2d(
x + im2,
y + im1);
592 glVertex2d(
x + im,
y - im4);
593 glVertex2d(
x + im4,
y - im4);
595 glVertex2d(
x + im4,
y - im4);
596 glVertex2d(
x,
y - im);
597 glVertex2d(
x - im4,
y - im4);
599 glVertex2d(
x - im4,
y - im4);
600 glVertex2d(
x - im2,
y + im1);
601 glVertex2d(
x,
y + im2);
603 glVertex2d(
x - im4,
y - im4);
604 glVertex2d(
x,
y + im2);
605 glVertex2d(
x + im2,
y + im1);
607 glVertex2d(
x - im4,
y - im4);
608 glVertex2d(
x + im2,
y + im1);
609 glVertex2d(
x + im4,
y - im4);
627 for (
UInt_t i = 0; i <
n; ++i) {
632 glVertex2d(
x - im,
y - im4);
633 glVertex2d(
x - im2,
y + im1);
634 glVertex2d(
x - im3,
y + im);
635 glVertex2d(
x,
y + im2);
636 glVertex2d(
x + im3,
y + im);
637 glVertex2d(
x + im2,
y + im1);
638 glVertex2d(
x + im,
y - im4);
639 glVertex2d(
x + im4,
y - im4);
640 glVertex2d(
x,
y - im);
641 glVertex2d(
x - im4,
y - im4);
652 for (
unsigned i = 0; i <
n; ++i) {
657 glVertex2d(
x - im,
y - im);
658 glVertex2d(
x + im,
y - im);
659 glVertex2d(
x + im,
y + im);
660 glVertex2d(
x - im,
y + im);
661 glVertex2d(
x - im,
y - im);
662 glVertex2d(
x + im,
y + im);
663 glVertex2d(
x - im,
y + im);
664 glVertex2d(
x + im,
y - im);
675 for (
unsigned i = 0; i <
n; ++i) {
680 glVertex2d(
x - im,
y );
681 glVertex2d(
x ,
y - im);
682 glVertex2d(
x + im,
y );
683 glVertex2d(
x ,
y + im);
684 glVertex2d(
x - im,
y );
685 glVertex2d(
x + im,
y );
686 glVertex2d(
x ,
y + im);
687 glVertex2d(
x ,
y - im);
699 for (
unsigned i = 0; i <
n; ++i) {
705 glVertex2d(
x -im2,
y + im);
706 glVertex2d(
x - im,
y );
708 glVertex2d(
x -im2,
y - im);
709 glVertex2d(
x +im2,
y - im);
711 glVertex2d(
x + im,
y );
712 glVertex2d(
x +im2,
y + im);
725 for (
unsigned i = 0; i <
n; ++i) {
730 glVertex2d(
x-im,
y );
731 glVertex2d(
x-im,
y-im2);
732 glVertex2d(
x-im2,
y-im);
733 glVertex2d(
x+im2,
y-im);
734 glVertex2d(
x+im,
y-im2);
735 glVertex2d(
x+im,
y+im2);
736 glVertex2d(
x+im2,
y+im);
737 glVertex2d(
x-im2,
y+im);
738 glVertex2d(
x-im,
y+im2);
739 glVertex2d(
x-im,
y );
740 glVertex2d(
x+im,
y );
742 glVertex2d(
x ,
y-im);
743 glVertex2d(
x ,
y+im);
756 for (
unsigned i = 0; i <
n; ++i) {
762 glVertex2d(
x -im2,
y + im);
763 glVertex2d(
x - im,
y );
765 glVertex2d(
x -im2,
y - im);
766 glVertex2d(
x +im2,
y - im);
768 glVertex2d(
x + im,
y );
769 glVertex2d(
x +im2,
y + im);
782 for (
unsigned i = 0; i <
n; ++i) {
788 glVertex2d(
x+im2,
y+im);
789 glVertex2d(
x+im ,
y+im2);
791 glVertex2d(
x+im ,
y-im2);
792 glVertex2d(
x+im2,
y-im);
794 glVertex2d(
x-im2,
y-im);
795 glVertex2d(
x-im ,
y-im2);
797 glVertex2d(
x-im ,
y+im2);
798 glVertex2d(
x-im2,
y+im);
811 for (
unsigned i = 0; i <
n; ++i) {
817 glVertex2d(
x+im2,
y+im);
818 glVertex2d(
x+im ,
y+im2);
820 glVertex2d(
x+im ,
y-im2);
821 glVertex2d(
x+im2,
y-im);
823 glVertex2d(
x-im2,
y-im);
824 glVertex2d(
x-im ,
y-im2);
826 glVertex2d(
x-im ,
y+im2);
827 glVertex2d(
x-im2,
y+im);
840 for (
unsigned i = 0; i <
n; ++i) {
845 glVertex2d(
x ,
y+im );
846 glVertex2d(
x-im4,
y+im4);
847 glVertex2d(
x-im ,
y );
848 glVertex2d(
x-im4,
y-im4);
849 glVertex2d(
x ,
y-im );
850 glVertex2d(
x+im4,
y-im4);
851 glVertex2d(
x+im ,
y );
852 glVertex2d(
x+im4,
y+im4);
853 glVertex2d(
x ,
y+im );
865 for (
unsigned i = 0; i <
n; ++i) {
870 glVertex2d(
x,
y+im );
871 glVertex2d(
x-im4,
y+im4);
875 glVertex2d(
x-im4,
y+im4);
881 glVertex2d(
x-im4,
y-im4);
885 glVertex2d(
x-im4,
y-im4);
891 glVertex2d(
x+im4,
y-im4);
895 glVertex2d(
x+im4,
y-im4);
901 glVertex2d(
x+im4,
y+im4);
905 glVertex2d(
x+im4,
y+im4);
919 for (
unsigned i = 0; i <
n; ++i) {
925 glVertex2d(
x+im2,
y+im);
926 glVertex2d(
x-im2,
y+im);
927 glVertex2d(
x+im2,
y-im);
928 glVertex2d(
x-im2,
y-im);
930 glVertex2d(
x+im,
y+im2);
931 glVertex2d(
x+im,
y-im2);
932 glVertex2d(
x-im,
y+im2);
933 glVertex2d(
x-im,
y-im2);
946 for (
unsigned i = 0; i <
n; ++i) {
952 glVertex2d(
x+im2,
y+im);
953 glVertex2d(
x-im2,
y+im);
954 glVertex2d(
x+im2,
y-im);
955 glVertex2d(
x-im2,
y-im);
957 glVertex2d(
x+im,
y+im2);
958 glVertex2d(
x+im,
y-im2);
959 glVertex2d(
x-im,
y+im2);
960 glVertex2d(
x-im,
y-im2);
973 for (
unsigned i = 0; i <
n; ++i) {
978 glVertex2d(
x ,
y +im2);
979 glVertex2d(
x -im2,
y + im);
980 glVertex2d(
x - im,
y +im2);
981 glVertex2d(
x -im2,
y );
982 glVertex2d(
x - im,
y -im2);
983 glVertex2d(
x -im2,
y - im);
984 glVertex2d(
x ,
y -im2);
985 glVertex2d(
x +im2,
y - im);
986 glVertex2d(
x + im,
y -im2);
987 glVertex2d(
x +im2,
y );
988 glVertex2d(
x + im,
y +im2);
989 glVertex2d(
x +im2,
y + im);
990 glVertex2d(
x ,
y +im2);
1002 for (
unsigned i = 0; i <
n; ++i) {
1007 glVertex2d(
x ,
y +im2);
1008 glVertex2d(
x -im2,
y +im);
1009 glVertex2d(
x -im ,
y +im2);
1010 glVertex2d(
x -im2,
y );
1014 glVertex2d(
x -im2,
y);
1015 glVertex2d(
x -im,
y -im2);
1016 glVertex2d(
x -im2,
y -im);
1017 glVertex2d(
x ,
y-im2);
1021 glVertex2d(
x ,
y -im2);
1022 glVertex2d(
x +im2,
y -im);
1023 glVertex2d(
x +im ,
y -im2);
1024 glVertex2d(
x +im2,
y);
1028 glVertex2d(
x +im2,
y);
1029 glVertex2d(
x +im ,
y +im2);
1030 glVertex2d(
x +im2,
y +im);
1031 glVertex2d(
x ,
y +im2);
1043 for (
unsigned i = 0; i <
n; ++i) {
1048 glVertex2d(
x,
y+im2);
1049 glVertex2d(
x-im2 ,
y+im);
1050 glVertex2d(
x-im,
y+im2);
1051 glVertex2d(
x-im2 ,
y);
1054 glVertex2d(
x-im2,
y);
1055 glVertex2d(
x-im ,
y-im2);
1056 glVertex2d(
x-im2,
y-im);
1057 glVertex2d(
x,
y-im2);
1060 glVertex2d(
x,
y-im2);
1061 glVertex2d(
x+im2 ,
y-im);
1062 glVertex2d(
x+im,
y-im2);
1063 glVertex2d(
x+im2,
y);
1066 glVertex2d(
x+im2,
y);
1067 glVertex2d(
x+im ,
y+im2);
1068 glVertex2d(
x+im2,
y+im);
1069 glVertex2d(
x,
y+im2);
1081 for (
unsigned i = 0; i <
n; ++i) {
1086 glVertex2d(
x+im2,
y+im2);
1087 glVertex2d(
x+im2,
y+im);
1088 glVertex2d(
x-im2,
y+im);
1089 glVertex2d(
x-im2,
y+im2);
1092 glVertex2d(
x-im2,
y+im2);
1093 glVertex2d(
x-im,
y+im2);
1094 glVertex2d(
x-im,
y-im2);
1095 glVertex2d(
x-im2,
y-im2);
1098 glVertex2d(
x-im2,
y-im2);
1099 glVertex2d(
x-im2,
y-im);
1100 glVertex2d(
x+im2,
y-im);
1101 glVertex2d(
x+im2,
y-im2);
1104 glVertex2d(
x+im2,
y-im2);
1105 glVertex2d(
x+im,
y-im2);
1106 glVertex2d(
x+im,
y+im2);
1107 glVertex2d(
x+im2,
y+im2);
1120#if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 && __APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
1121 typedef GLvoid (*tess_t)(...);
1122#elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__) || defined (__APPLE__)
1123 typedef GLvoid (*tess_t)();
1124#elif defined ( WIN32)
1127 #error "Error - need to define type tess_t for this platform/compiler"
1150 std::vector<Double_t> & vs = dump->back().fPatch;
1171 throw std::runtime_error(
"tesselator creation failed");
1173#if defined(__GNUC__) && __GNUC__ >= 8
1174#pragma GCC diagnostic push
1175#pragma GCC diagnostic ignored "-Wcast-function-type"
1188#if defined(__GNUC__) && __GNUC__ >= 8
1189#pragma GCC diagnostic pop
1210 : fW(w), fH(
h), fX(
x), fY(
y), fTop(top)
1217 : fMaxLineWidth(0.),
1253 const TColor *color =
gROOT->GetColor(colorIndex);
1255 color->
GetRGB(rgba[0], rgba[1], rgba[2]);
1262template<
class ValueType>
1265 assert(nPoints > 0 &&
"FindBoundingRect, invalind number of points");
1266 assert(xs !=
nullptr &&
"FindBoundingRect, parameter 'xs' is null");
1267 assert(ys !=
nullptr &&
"FindBoundingRect, parameter 'ys' is null");
1269 ValueType xMin = xs[0], xMax = xMin;
1270 ValueType yMin = ys[0], yMax = yMin;
1272 for (
Int_t i = 1; i < nPoints; ++i) {
1283 box.fWidth = xMax - xMin;
1287 box.fHeight = yMax - yMin;
1304void CalculateCircle(std::vector<TPoint> &circle,
Double_t r,
UInt_t pts)
1309 circle.resize(circle.size() + pts + 1);
1311 for (
UInt_t i = 0; i < pts; ++i, angle += delta) {
1316 circle.back().fX = circle[
first].fX;
1317 circle.back().fY = circle[
first].fY;
GLAPI GLUtesselator *GLAPIENTRY gluNewTess(void)
#define GLU_TESS_TOLERANCE
GLAPI void GLAPIENTRY gluTessProperty(GLUtesselator *tess, GLenum which, GLdouble data)
GLAPI void GLAPIENTRY gluTessCallback(GLUtesselator *tess, GLenum which, _GLUfuncptr CallBackFunc)
GLAPI void GLAPIENTRY gluDeleteTess(GLUtesselator *tess)
const unsigned char gStipples[26][32]
FillAttribSet(const PolygonStippleSet &set, Bool_t ignoreStipple)
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)
Set up line parameters.
void DrawOpenThreeTriangles(UInt_t n, const TPoint *xy) const
void DrawFullCrossX(UInt_t n, const TPoint *xy) const
void DrawFullDotSmall(UInt_t n, const TPoint *xy) const
void DrawOpenSquareDiagonal(UInt_t n, const TPoint *xy) const
void DrawOpenDoubleDiamond(UInt_t n, const TPoint *xy) const
void DrawFullFourTrianglesX(UInt_t n, const TPoint *xy) const
void DrawFullDotLarge(UInt_t n, const TPoint *xy) const
void DrawFullThreeTriangles(UInt_t n, const TPoint *xy) const
void DrawCircle(UInt_t n, const TPoint *xy) const
void DrawFullFourTrianglesPlus(UInt_t n, const TPoint *xy) const
void DrawOpenCross(UInt_t n, const TPoint *xy) const
void DrawFullCross(UInt_t n, const TPoint *xy) const
void DrawFullTrianlgeDown(UInt_t n, const TPoint *xy) const
void DrawOpenStar(UInt_t n, const TPoint *xy) const
Full star pentagone.
void DrawX(UInt_t n, const TPoint *xy) const
void DrawPlus(UInt_t n, const TPoint *xy) const
void DrawFullTrianlgeUp(UInt_t n, const TPoint *xy) const
void DrawFullSquare(UInt_t n, const TPoint *xy) const
std::vector< TPoint > fCircle
void DrawOpenFourTrianglesPlus(UInt_t n, const TPoint *xy) const
void DrawStar(UInt_t n, const TPoint *xy) const
void DrawFullDoubleDiamond(UInt_t n, const TPoint *xy) const
void DrawOpenCrossX(UInt_t n, const TPoint *xy) const
void DrawDot(UInt_t n, const TPoint *xy) const
Simple 1-pixel dots.
void DrawOctagonCross(UInt_t n, const TPoint *xy) const
void DrawFourSquaresX(UInt_t n, const TPoint *xy) const
void DrawFourSquaresPlus(UInt_t n, const TPoint *xy) const
void DrawFullDotMedium(UInt_t n, const TPoint *xy) const
void DrawDiamond(UInt_t n, const TPoint *xy) const
void DrawFullStar(UInt_t n, const TPoint *xy) const
Full star pentagone.
void DrawOpenTrianlgeDown(UInt_t n, const TPoint *xy) const
void DrawFullDiamond(UInt_t n, const TPoint *xy) const
void DrawOpenFourTrianglesX(UInt_t n, const TPoint *xy) const
void DrawOpenDiamondCross(UInt_t n, const TPoint *xy) const
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
The color creation and management class.
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
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)
Short_t Min(Short_t a, Short_t b)
constexpr Double_t TwoPi()