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 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);
166 0xf040, 0xf4f4, 0xf111, 0xf0f0,
167 0xff11, 0x3fff, 0x08ff};
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);
273 fStar[0].fX = -im; fStar[0].fY = 0;
274 fStar[1].fX = im; fStar[1].fY = 0;
275 fStar[2].fX = 0 ; fStar[2].fY = -im;
276 fStar[3].fX = 0 ; fStar[3].fY = im;
278 fStar[4].fX = -im; fStar[4].fY = -im;
279 fStar[5].fX = im; fStar[5].fY = im;
280 fStar[6].fX = -im; fStar[6].fY = im;
281 fStar[7].fX = im; fStar[7].fY = -im;
285 for (
UInt_t i = 0; i <
n; ++i) {
289 glVertex2d(fStar[0].fX + x, fStar[0].fY + y);
290 glVertex2d(fStar[1].fX + x, fStar[1].fY + y);
291 glVertex2d(fStar[2].fX + x, fStar[2].fY + y);
292 glVertex2d(fStar[3].fX + x, fStar[3].fY + y);
293 glVertex2d(fStar[4].fX + x, fStar[4].fY + y);
294 glVertex2d(fStar[5].fX + x, fStar[5].fY + y);
295 glVertex2d(fStar[6].fX + x, fStar[6].fY + y);
296 glVertex2d(fStar[7].fX + x, fStar[7].fY + y);
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);
364 CalculateCircle(fCircle, r, r < 100. ? kSmallCirclePts : kLargeCirclePts);
366 for (
UInt_t i = 0; i <
n; ++i) {
370 glBegin(GL_LINE_LOOP);
371 for (
UInt_t j = 0,
e = fCircle.size(); j <
e; ++j)
372 glVertex2d(fCircle[j].fX + x, fCircle[j].fY + y);
382 fCircle.push_back(
TPoint(0, 0));
388 CalculateCircle(fCircle, r, r < 100 ? kSmallCirclePts : kLargeCirclePts);
390 for (
UInt_t i = 0; i <
n; ++i) {
394 glBegin(GL_TRIANGLE_FAN);
395 for (
UInt_t j = 0,
e = fCircle.size(); j <
e; ++j)
396 glVertex2d(fCircle[j].fX + x, fCircle[j].fY + y);
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, 1
e-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)
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;
OffScreenDevice(UInt_t w, UInt_t h, UInt_t x, UInt_t y, Bool_t top)
void DrawCircle(UInt_t n, const TPoint *xy) const
static UInt_t SwapBits(UInt_t bits)
void DrawX(UInt_t n, const TPoint *xy) const
Short_t Min(Short_t a, Short_t b)
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
void ExtractRGBA(Color_t colorIndex, Float_t *rgba)
std::vector< unsigned char > fStipples
Tesselator(Bool_t dump=kFALSE)
LineAttribSet(Bool_t smooth, UInt_t stipple, Double_t maxWidth, Bool_t setWidth)
Set up line parameters.
const GLenum pointSizePNAME
void DrawOpenStar(UInt_t n, const TPoint *xy) const
HIGZ full star pentagone.
std::list< MeshPatch_t > Tesselation_t
void DrawDot(UInt_t n, const TPoint *xy) const
Simple 1-pixel dots.
void DrawFullDotMedium(UInt_t n, const TPoint *xy) const
const UShort_t gLineStipples[]
void DrawPlus(UInt_t n, const TPoint *xy) const
void DrawCross(UInt_t n, const TPoint *xy) const
void DrawFullStar(UInt_t n, const TPoint *xy) const
HIGZ full star pentagone.
void DrawFullDotSmall(UInt_t n, const TPoint *xy) const
static Tesselation_t * fVs
void DrawFullTrianlgeDown(UInt_t n, const TPoint *xy) const
const unsigned char gStipples[26][32]
Double_t GetMaxLineWidth() const
Double_t GetMaxPointSize() const
void DrawDiamond(UInt_t n, const TPoint *xy) const
const GLenum lineWidthPNAME
void DrawStar(UInt_t n, const TPoint *xy) const
void DrawFullDotLarge(UInt_t n, const TPoint *xy) const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
The color creation and management class.
void DrawFullSquare(UInt_t n, const TPoint *xy) const
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)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void DrawFullTrianlgeUp(UInt_t n, const TPoint *xy) const
void Vertex(const Double_t *v)