28#include "TGLIncludes.h"
39bool IsGradientFill(
Color_t fillColorIndex)
168 auto ctxt =
gVirtualX->GetWindowContext(device);
178 return gVirtualX->InheritsFrom(
"TGCocoa");
207 auto pad =
dynamic_cast<TPad *
>(
gPad);
217 Int_t px = 0, py = 0;
219 pad->XYtoAbsPixel(pad->GetX1(), pad->GetY1(), px, py);
221 py =
gPad->GetWh() - py;
226 glViewport(GLint(px * scale), GLint(py * scale),
227 GLsizei(
gPad->GetWw() * pad->GetAbsWNDC() * scale),
228 GLsizei(
gPad->GetWh() * pad->GetAbsHNDC() * scale));
230 glMatrixMode(GL_PROJECTION);
232 glOrtho(pad->GetX1(), pad->GetX2(), pad->GetY1(), pad->GetY2(), -10., 10.);
234 glMatrixMode(GL_MODELVIEW);
236 glTranslated(0., 0., -1.);
238 ::Error(
"TGLPadPainter::SelectDrawable",
239 "function was called not from TPad or TCanvas code\n");
240 throw std::runtime_error(
"");
261 ctxt =
gVirtualX->GetWindowContext(device);
278 static bool gl_init =
false;
280 int version = gladLoaderLoadGL();
282 Warning(
"TGLPadPainter::InitPainter",
"GL initalization failed.");
284 Info(
"TGLPadPainter::InitPainter",
"GL initalization successful.");
287 glDisable(GL_DEPTH_TEST);
288 glDisable(GL_CULL_FACE);
289 glDisable(GL_LIGHTING);
292 glViewport(0, 0, GLsizei(
gPad->GetWw()), GLsizei(
gPad->GetWh()));
294 glDepthMask(GL_TRUE);
295 glClearColor(1.,1.,1.,1.);
296 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
297 glDepthMask(GL_FALSE);
299 glMatrixMode(GL_PROJECTION);
302 glOrtho(
gPad->GetX1(),
gPad->GetX2(),
gPad->GetY1(),
gPad->GetY2(), -10., 10.);
304 glMatrixMode(GL_MODELVIEW);
306 glTranslated(0., 0., -1.);
319 glMatrixMode(GL_PROJECTION);
322 glOrtho(
gPad->GetX1(),
gPad->GetX2(),
gPad->GetY1(),
gPad->GetY2(), -10., 10.);
324 glMatrixMode(GL_MODELVIEW);
360 gPad->XtoAbsPixel(x1),
gPad->YtoAbsPixel(y1),
361 gPad->XtoAbsPixel(x2),
gPad->YtoAbsPixel(y2));
376 if (pointSize >
fLimits.GetMaxPointSize())
377 pointSize =
fLimits.GetMaxPointSize();
378 glPointSize((GLfloat)pointSize);
380 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
403 gPad->UtoAbsPixel(u2),
gPad->VtoAbsPixel(
v2));
413 glVertex2d(
gPad->GetX1() + u1 * xRange,
gPad->GetY1() +
v1 * yRange);
414 glVertex2d(
gPad->GetX1() + u2 * xRange,
gPad->GetY1() +
v2 * yRange);
432 gPad->XtoAbsPixel(x1),
gPad->YtoAbsPixel(y1),
433 gPad->XtoAbsPixel(x2),
gPad->YtoAbsPixel(y2),
439 if (IsGradientFill(
fGlFillAtt.GetFillColor())) {
449 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
450 glRectd(x1, y1, x2, y2);
451 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
455 glRectd(x1, y1, x2, y2);
464 assert(
x !=
nullptr &&
"DrawFillArea, parameter 'x' is null");
465 assert(
y !=
nullptr &&
"DrawFillArea, parameter 'y' is null");
471 ::Error(
"TGLPadPainter::DrawFillArea",
472 "invalid number of points in a polygon");
476 if (IsGradientFill(
fGlFillAtt.GetFillColor()))
503 for (
Int_t i = 0; i <
n; ++i) {
505 fVs[i * 3 + 1] =
y[i];
510 GLUtesselator *t = (GLUtesselator *)
fTess.GetTess();
512 gluNextContour(t, (GLenum)GLU_UNKNOWN);
514 for (
Int_t i = 0; i <
n; ++i)
515 gluTessVertex(t, &
fVs[i * 3], &
fVs[i * 3]);
530 glBegin(GL_LINE_STRIP);
532 for (
Int_t i = 0; i <
n; ++i)
533 glVertex2d(
x[i],
y[i]);
536 glVertex2d(
x[0],
y[0]);
543 if (pointSize >
fLimits.GetMaxPointSize())
544 pointSize =
fLimits.GetMaxPointSize();
545 glPointSize((GLfloat)pointSize);
547 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
550 for (
Int_t i = 0; i <
n; ++i)
551 glVertex2d(
x[i],
y[i]);
567 glBegin(GL_LINE_STRIP);
569 for (
Int_t i = 0; i <
n; ++i)
570 glVertex2f(
x[i],
y[i]);
573 glVertex2f(
x[0],
y[0]);
592 glBegin(GL_LINE_STRIP);
594 for (
Int_t i = 0; i <
n; ++i)
595 glVertex2d(x1 + u[i] * xRange, y1 +
v[i] * yRange);
603template<
class ValueType>
604void ConvertMarkerPoints(
Int_t n,
const ValueType *
x,
const ValueType *
y, std::vector<TPoint> & dst);
615 ConvertMarkerPoints(
n,
x,
y,
fPoly);
626 ConvertMarkerPoints(
n,
x,
y,
fPoly);
640 glOrtho(0,
gPad->GetAbsWNDC() *
gPad->GetWw(), 0,
gPad->GetAbsHNDC() *
gPad->GetWh(), -10., 10.);
642 glMatrixMode(GL_MODELVIEW);
648 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
653 glLineWidth(w >
fLimits.GetMaxLineWidth() ?
fLimits.GetMaxLineWidth() : !w ? 1.f : w);
660 switch (markerStyle) {
695 fMarker.DrawFullTrianlgeDown(
n, xy);
698 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
700 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
703 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
705 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
720 fMarker.DrawOpenTrianlgeDown(
n, xy);
729 fMarker.DrawOpenDiamondCross(
n, xy);
732 fMarker.DrawOpenSquareDiagonal(
n, xy);
735 fMarker.DrawOpenThreeTriangles(
n, xy);
741 fMarker.DrawFullThreeTriangles(
n, xy);
744 fMarker.DrawOpenFourTrianglesX(
n, xy);
747 fMarker.DrawFullFourTrianglesX(
n, xy);
750 fMarker.DrawOpenDoubleDiamond(
n, xy);
753 fMarker.DrawFullDoubleDiamond(
n, xy);
756 fMarker.DrawOpenFourTrianglesPlus(
n, xy);
759 fMarker.DrawFullFourTrianglesPlus(
n, xy);
776 glMatrixMode(GL_MODELVIEW);
792 fontIndex = 20 + shift * 10;
794 fontIndex += shift * 10;
813 glOrtho(0,
gPad->GetAbsWNDC() *
gPad->GetWw(), 0,
gPad->GetAbsHNDC() *
gPad->GetWh(), -10., 10.);
815 glMatrixMode(GL_MODELVIEW);
833 glMatrixMode(GL_MODELVIEW);
839template<
class Char_t>
844 Float_t llx, lly, llz, urx, ury, urz;
845 fF.BBox(
text, llx, lly, llz, urx, ury, urz);
848 w = (
UInt_t) (urx > 0. ? urx : 0.);
849 h = (
UInt_t) (ury > 0. ? ury : 0.);
857template<
class Char_t>
862 Float_t llx, lly, llz, urx, ury, urz;
863 fF.BBox(
text, llx, lly, llz, urx, ury, urz);
864 a = (
UInt_t) (ury > 0. ? ury : 0.);
865 d = (
UInt_t) (lly < 0. ? -lly : 0.);
954 auto advance =
fF.Advance(
text);
956 return (
UInt_t) (advance > 0. ? advance : 0.);
981 glMatrixMode(GL_PROJECTION);
992 glMatrixMode(GL_PROJECTION);
1003 glMatrixMode(GL_MODELVIEW);
1014 glMatrixMode(GL_MODELVIEW);
1023 glGetIntegerv(GL_VIEWPORT,
fVp);
1045 std::vector<unsigned> buff(canvas->GetWw() * canvas->GetWh());
1046 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1047 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
1050 glReadPixels(0, 0, canvas->GetWw(), canvas->GetWh(), GL_RGBA, GL_UNSIGNED_BYTE, (
char *)&buff[0]);
1054 ::Error(
"TGLPadPainter::SaveImage",
"TImage creation failed");
1058 image->DrawRectangle(0, 0, canvas->GetWw(), canvas->GetWh());
1059 UInt_t *argb = image->GetArgbArray();
1062 ::Error(
"TGLPadPainter::SaveImage",
"null argb array in TImage object");
1066 const Int_t nLines = canvas->GetWh();
1067 const Int_t nPixels = canvas->GetWw();
1069 for (
Int_t i = 0; i < nLines; ++i) {
1070 Int_t base = (nLines - 1 - i) * nPixels;
1071 for (
Int_t j = 0; j < nPixels; ++j, ++base) {
1074 const UInt_t pix = buff[base];
1075 const UInt_t bgra = ((pix & 0xff) << 16) | (pix & 0xff00) |
1076 ((pix & 0xff0000) >> 16) | (pix & 0xff000000);
1079 argb[i * nPixels + j] = bgra;
1096 ::Error(
"TGLPadPainter::DrawPixels",
"pixel data is null");
1100 if (std::numeric_limits<UInt_t>::digits >= 32) {
1109 ::Error(
"TGLPadPainter::DrawPixels",
"invalid width");
1115 ::Error(
"TGLPadPainter::DrawPixels",
"invalid height");
1124 const Double_t rasterX =
Double_t(dstX) / (pad->GetAbsWNDC() * pad->GetWw()) *
1125 (pad->GetX2() - pad->GetX1()) + pad->GetX1();
1127 const Double_t yRange = pad->GetY2() - pad->GetY1();
1128 const Double_t rasterY = yRange -
Double_t(dstY + height) / (pad->GetAbsHNDC() * pad->GetWh()) * yRange +
1131 GLdouble oldPos[4] = {};
1133 glGetDoublev(GL_CURRENT_RASTER_POSITION, oldPos);
1135 glRasterPos2d(rasterX, rasterY);
1137 std::vector<unsigned char> upsideDownImage(4 * width * height);
1138 const unsigned char *srcLine = pixelData + 4 * width * (height - 1);
1139 unsigned char *dstLine = &upsideDownImage[0];
1140 for (
UInt_t i = 0; i < height; ++i, srcLine -= 4 * width, dstLine += 4 * width)
1141 std::copy(srcLine, srcLine + 4 * width, dstLine);
1143 if (enableBlending) {
1145 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1148 glDrawPixels(width, height,
GL_BGRA, GL_UNSIGNED_BYTE, &upsideDownImage[0]);
1151 glDisable(GL_BLEND);
1154 glRasterPos2d(oldPos[0], oldPos[1]);
1156 ::Error(
"TGLPadPainter::DrawPixels",
"no pad found to draw");
1168 assert(
n > 2 &&
"DrawPolygonWithGradient, invalid number of points");
1169 assert(
x !=
nullptr &&
"DrawPolygonWithGradient, parameter 'x' is null");
1170 assert(
y !=
nullptr &&
"DrawPolygonWithGradient, parameter 'y' is null");
1173 assert(grad !=
nullptr &&
"DrawPolygonWithGradient, the current fill color is not a gradient fill");
1184 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1186 glStencilFunc(GL_NEVER, 1, 0xFF);
1187 glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
1189 glStencilMask(0xFF);
1190 glClear(GL_STENCIL_BUFFER_BIT);
1195 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
1196 glStencilMask(0x00);
1198 glStencilFunc(GL_EQUAL, 0, 0xFF);
1200 glStencilFunc(GL_EQUAL, 1, 0xFF);
1211 assert(lGrad !=
nullptr &&
"DrawPolygonWithGradient, unknown gradient type");
1221 assert(grad !=
nullptr &&
"DrawGradient, parameter 'grad' is null");
1222 assert(nPoints > 2 &&
"DrawGradient, invalid number of points");
1223 assert(xs !=
nullptr &&
"DrawGradient, parameter 'xs' is null");
1224 assert(ys !=
nullptr &&
"DrawGradient, parameter 'ys' is null");
1227 ::Warning(
"TGLPadPainter::DrawGradient",
1228 "extended radial gradient is not supported");
1239 radius *=
TMath::Max(bbox.fWidth, bbox.fHeight);
1240 center.fX = bbox.fWidth * center.fX + bbox.fXMin;
1241 center.fY = bbox.fHeight * center.fY + bbox.fYMin;
1243 const auto w =
gPad->GetX2() -
gPad->GetX1();
1244 const auto h =
gPad->GetY2() -
gPad->GetY1();
1251 const auto pixelW =
gPad->GetAbsWNDC() *
gPad->GetWw();
1252 const auto pixelH =
gPad->GetAbsHNDC() *
gPad->GetWh();
1257 glMatrixMode(GL_PROJECTION);
1260 glOrtho(0., pixelW, 0., pixelH, -10., 10.);
1263 center.fX =
gPad->XtoPixel(center.fX);
1264 center.fY = pixelH -
gPad->YtoPixel(center.fY);
1270 const Double_t yMin = pixelH -
gPad->YtoPixel(bbox.fYMin);
1271 const Double_t yMax = pixelH -
gPad->YtoPixel(bbox.fYMax);
1278 maxR =
TMath::Sqrt(maxDistX * maxDistX + maxDistY * maxDistY);
1283 const Bool_t solidFillAfter = maxR > radius;
1286 const UInt_t nSlices = 500;
1291 const auto nCircles = nColors + 1 + solidFillAfter;
1297 std::vector<Double_t> circles(nSlices * nCircles * 2);
1301 for (
UInt_t i = 0; i < nColors; ++i) {
1302 const auto circle = &circles[i * nSlices * 2];
1304 const auto r = radius * locations[i];
1305 for (
UInt_t j = 0,
e = nSlices * 2 - 2; j <
e; j += 2) {
1306 circle[j] = center.fX +
r *
TMath::Cos(angle * j);
1307 circle[j + 1] = center.fY +
r *
TMath::Sin(angle * j);
1310 circle[(nSlices - 1) * 2] = circle[0];
1311 circle[(nSlices - 1) * 2 + 1] = circle[1];
1316 const auto circle = &circles[nColors * nSlices * 2];
1317 for (
UInt_t j = 0,
e = nSlices * 2 - 2; j <
e; j += 2) {
1318 circle[j] = center.fX + radius *
TMath::Cos(angle * j);
1319 circle[j + 1] = center.fY + radius *
TMath::Sin(angle * j);
1322 circle[(nSlices - 1) * 2] = circle[0];
1323 circle[(nSlices - 1) * 2 + 1] = circle[1];
1326 if (solidFillAfter) {
1328 const auto circle = &circles[(nCircles - 1) * nSlices * 2];
1329 for (
UInt_t j = 0,
e = nSlices * 2 - 2; j <
e; j += 2) {
1330 circle[j] = center.fX + maxR *
TMath::Cos(angle * j);
1331 circle[j + 1] = center.fY + maxR *
TMath::Sin(angle * j);
1334 circle[(nSlices - 1) * 2] = circle[0];
1335 circle[(nSlices - 1) * 2 + 1] = circle[1];
1350 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1353 glBegin(GL_TRIANGLE_FAN);
1355 glVertex2d(center.fX, center.fY);
1357 for (
UInt_t i = 0,
e = nSlices * 2; i <
e; i += 2)
1358 glVertex2dv(&circles[i]);
1363 for (
UInt_t i = 0; i < nColors - 1; ++i) {
1364 const Double_t *
const inner = &circles[i * nSlices * 2];
1365 const auto innerRGBA = rgba + i * 4;
1366 const auto outerRGBA = rgba + (i + 1) * 4;
1367 const Double_t *
const outer = &circles[(i + 1) * nSlices * 2];
1374 const Double_t *
const inner = &circles[nSlices * (nColors - 1) * 2];
1375 const auto solidRGBA = rgba + (nColors - 1) * 4;
1376 const Double_t *
const outer = &circles[nSlices * nColors * 2];
1381 if (solidFillAfter) {
1382 const Double_t *
const inner = &circles[nSlices * nColors * 2];
1383 const auto solidRGBA = rgba + (nColors - 1) * 4;
1384 const Double_t *
const outer = &circles[nSlices * (nColors + 1) * 2];
1398 assert(grad !=
nullptr &&
"DrawGradient, parameter 'grad' is null");
1399 assert(
n > 2 &&
"DrawGradient, invalid number of points");
1400 assert(
x !=
nullptr &&
"DrawGradient, parameter 'x' is null");
1401 assert(
y !=
nullptr &&
"DrawGradient, parameter 'y' is null");
1417 glMatrixMode(GL_PROJECTION);
1422 glOrtho(0., pixelW, 0., pixelH, -10., 10.);
1425 glMatrixMode(GL_MODELVIEW);
1439 end.
fX = end.
fX * w;
1440 end.
fY = end.
fY *
h;
1442 start.fX =
start.fX * bbox.fWidth + bbox.fXMin;
1443 start.fY =
start.fY * bbox.fHeight + bbox.fYMin;
1444 end.
fX = end.
fX * bbox.fWidth + bbox.fXMin;
1445 end.
fY = end.
fY * bbox.fHeight + bbox.fYMin;
1455 end.
fY = pixelH -
gPad->YtoPixel(end.
fY);
1458 const Double_t yMin = pixelH -
gPad->YtoPixel(bbox.fYMin);
1459 const Double_t yMax = pixelH -
gPad->YtoPixel(bbox.fYMax);
1476 gradBoxes[0] =
start.fY -
h;
1478 gradBoxes[i] = startEndLength * colorPositions[i - 1] +
start.fY;
1489 glRotated(angle, 0., 0., 1.);
1494 const unsigned nEdges = gradBoxes.size();
1500 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1504 rgba + (nColors - 1) * 4, rgba + (nColors - 1) * 4);
1506 for (
unsigned i = 1; i < nEdges - 2; ++i)
1508 xRight, rgba + (i - 1) * 4, rgba + i * 4);
1518 assert(
n > 2 &&
"DrawTesselation, invalid number of points");
1519 assert(
x !=
nullptr &&
"DrawTesselation, parameter 'x' is null");
1520 assert(
y !=
nullptr &&
"DrawTesselation, parameter 'y' is null");
1525 for (
Int_t i = 0; i <
n; ++i) {
1527 fVs[i * 3 + 1] =
y[i];
1528 fVs[i * 3 + 2] = 0.;
1533 GLUtesselator *t = (GLUtesselator *)
fTess.GetTess();
1535 gluNextContour(t, (GLenum)GLU_UNKNOWN);
1537 for (
Int_t i = 0; i <
n; ++i)
1538 gluTessVertex(t, &
fVs[i * 3], &
fVs[i * 3]);
1547template<
class ValueType>
1548void ConvertMarkerPoints(
Int_t n,
const ValueType *
x,
const ValueType *
y, std::vector<TPoint> & dst)
1553 for (
Int_t i = 0; i <
n; ++i) {
1554 dst[i].fX =
gPad->XtoPixel(
x[i]);
1555 dst[i].fY = padH -
gPad->YtoPixel(
y[i]);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
short Width_t
Line width (short).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Font_t
Font number (short).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
short Style_t
Style number (short).
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
const Double_t lineWidthTS
virtual Width_t GetLineWidth() const
Return the line width.
static Style_t GetMarkerStyleBase(Style_t style)
static Width_t GetMarkerLineWidth(Style_t style)
void Flush()
Flush canvas buffers.
TColorGradient extends basic TColor.
const Double_t * GetColors() const
Get colors.
SizeType_t GetNumberOfSteps() const
Get number of steps.
ECoordinateMode GetCoordinateMode() const
Get coordinate mode.
const Double_t * GetColorPositions() const
Get color positions.
static Int_t GetExtendedFontStartIndex()
static const char * GetFontNameFromId(Int_t)
Get font name from TAttAxis font id.
static TObjArray * GetFontFileArray()
Get id to file name map.
void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override
Draw text.
void TextExtentHelper(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const Char_t *text)
Helper function to get text extent.
void SetDrawMode(Int_t device, Int_t mode) override
Set drawing mode for specified device.
void TextAscentDescentHelper(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const Char_t *text)
Helper function to get text ascent / descent.
void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY, Bool_t enableBlending) override
Int_t ResizeDrawable(Int_t device, UInt_t w, UInt_t h) override
Resize a gVirtualX Pixmap.
void DestroyDrawable(Int_t device) override
Not required at the moment.
void DrawGradient(const TLinearGradient *gradient, Int_t n, const Double_t *x, const Double_t *y)
Rgl::Pad::Tesselator fTess
void SelectGLFont(Font_t font, Float_t size)
Select specified font/size.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Draw line segment in NDC coordinates.
std::vector< TPoint > fPoly
void DrawTextHelper(Double_t x, Double_t y, const Char_t *text, ETextMode mode)
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Draw filled or hollow box.
void SetAttLine(const TAttLine &att) override
Set line attributes.
void DrawPolygonWithGradient(Int_t n, const Double_t *x, const Double_t *y)
At the moment I assume both linear and radial gradients will work the same way - using a stencil buff...
void GetTextAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override
Get text extent.
void InvalidateCS() override
When TPad::Range for gPad is called, projection must be changed in OpenGL.
void ClearDrawable() override
Do nothing, sub-pads not cleared in GL.
void ClearWindow(Int_t device) override
Clear specified window - calling gVirtualX->ClearWindowW.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Poly line in NDC.
void OnPad(TVirtualPad *) override
Select pad where current painting will be performed.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Draw poly-line in user coordinates.
Rgl::Pad::GLLimits fLimits
void SetOpacity(Int_t percent) override
Delegate to gVirtualX.
void DrawTextNDC(Double_t x, Double_t y, const char *text, ETextMode mode) override
Draw text in NDC.
void SetAttFill(const TAttFill &att) override
Set fill attributes.
void InitPainter() override
Init gl-pad painter:
void SelectDrawable(Int_t device) override
For gVirtualX this means select pixmap (or window) and all subsequent drawings will go into this pixm...
Rgl::Pad::PolygonStippleSet fSSet
Rgl::Pad::MarkerPainter fMarker
void DrawPolyMarker()
Poly-marker.
void SaveViewport()
Extract and save the current viewport.
void CopyDrawable(Int_t device, Int_t px, Int_t py) override
Not required at the moment.
void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override
Using TImage save frame-buffer contents as a picture.
void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override
Draw tesselated polygon (probably, outline only).
void UpdateDrawable(Int_t mode) override
Call low-level update of selected drawable, redirect to gVirtualX.
void RestoreProjectionMatrix() const
Restore the projection matrix.
void SetAttMarker(const TAttMarker &att) override
Set marker attributes.
void LockPainter() override
Locked state of painter means, that GL context can be invalid, so no GL calls can be executed.
Float_t GetTextMagnitude() const override
Delegate to gVirtualX.
void DrawTesselation(Int_t n, const Double_t *x, const Double_t *y)
Int_t CreateDrawable(UInt_t w, UInt_t h) override
Not required at the moment.
UInt_t GetTextAdvance(Font_t font, Double_t size, const char *text, Bool_t kern) override
Get text advance.
void RestoreModelviewMatrix() const
Restore the modelview matrix.
std::vector< Double_t > fVs
void SaveProjectionMatrix() const
Save the projection matrix.
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw line segment.
void GetTextExtent(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override
Get text extent.
Bool_t IsCocoa() const override
Returns true when cocoa backend is used.
void SaveModelviewMatrix() const
Save the modelview matrix.
void RestoreViewport()
Restore the saved viewport.
static void InitializeIfNeeded()
Initialize globals that require other libraries to be initialized.
static Float_t GetScreenScalingFactor()
Returns scaling factor between screen points and GL viewport pixels.
static TImage * Create()
Create an image.
const Point & GetEnd() const
Get end.
const Point & GetStart() const
Get start.
void SetAttFill(const TAttFill &att) override
Set fill attributes.
Color_t GetMarkerColor() const override
const TAttText & GetAttText() const override
Get text attributes.
Short_t GetTextAlign() const override
const TAttMarker & GetAttMarker() const override
Get marker attributes.
Size_t GetMarkerSize() const override
Style_t GetMarkerStyle() const override
Font_t GetTextFont() const override
Width_t GetLineWidth() const override
Bool_t fFullyTransparent
if transformed fill attributes fully transparent
void SetAttMarker(const TAttMarker &att) override
Set marker attributes.
void SetAttLine(const TAttLine &att) override
Set line attributes.
Float_t GetTextAngle() const override
TAttFill GetAttFillInternal(Bool_t with_transparency)
Returns fill attributes after modification Checks for special fill styles 4000 .
Color_t GetTextColor() const override
Style_t GetLineStyle() const override
const TAttLine & GetAttLine() const override
Get line attributes.
Float_t GetTextSize() const override
The most important graphics class in the ROOT system.
Double_t GetRadius() const
Get radius.
const Point & GetCenter() const
Get center.
EGradientType GetGradientType() const
Get gradient type.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual Int_t GetCanvasID() const =0
virtual TCanvas * GetCanvas() const =0
BoundingRect< ValueType > FindBoundingRect(Int_t nPoints, const ValueType *xs, const ValueType *ys)
void ExtractRGBA(Color_t colorIndex, Float_t *rgba)
void DrawQuadStripWithRadialGradientFill(unsigned nPoints, const Double_t *inner, const Double_t *innerRGBA, const Double_t *outer, const Double_t *outerRGBA)
TODO: is it possible to use GLdouble to avoid problems with Double_t/GLdouble if they are not the sam...
void DrawBoxWithGradientFill(Double_t y1, Double_t y2, Double_t x1, Double_t x2, const Double_t *rgba1, const Double_t *rgba2)
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Sqrt(Double_t x)
Returns the square root of x.
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 RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
constexpr Double_t TwoPi()