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);
375 if (pointSize >
fLimits.GetMaxPointSize())
376 pointSize =
fLimits.GetMaxPointSize();
377 glPointSize((GLfloat)pointSize);
379 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
401 gPad->UtoAbsPixel(u2),
gPad->VtoAbsPixel(
v2));
410 glVertex2d(
gPad->GetX1() + u1 * xRange,
gPad->GetY1() +
v1 * yRange);
411 glVertex2d(
gPad->GetX1() + u2 * xRange,
gPad->GetY1() +
v2 * yRange);
435 if (IsGradientFill(
fGlFillAtt.GetFillColor())) {
444 glBegin(GL_LINE_LOOP);
461 assert(
x !=
nullptr &&
"DrawFillArea, parameter 'x' is null");
462 assert(
y !=
nullptr &&
"DrawFillArea, parameter 'y' is null");
468 ::Error(
"TGLPadPainter::DrawFillArea",
469 "invalid number of points in a polygon");
473 if (IsGradientFill(
fGlFillAtt.GetFillColor()))
500 for (
Int_t i = 0; i <
n; ++i) {
502 fVs[i * 3 + 1] =
y[i];
507 GLUtesselator *t = (GLUtesselator *)
fTess.GetTess();
509 gluNextContour(t, (GLenum)GLU_UNKNOWN);
511 for (
Int_t i = 0; i <
n; ++i)
512 gluTessVertex(t, &
fVs[i * 3], &
fVs[i * 3]);
521template<
class ValueType>
526 std::vector<TPoint>
xy(
n);
527 for (
Int_t i = 0; i <
n; ++i) {
538 glBegin(GL_LINE_STRIP);
540 for (
Int_t i = 0; i <
n; ++i)
541 glVertex2d(
x[i],
y[i]);
544 glVertex2d(
x[0],
y[0]);
551 if (pointSize >
fLimits.GetMaxPointSize())
552 pointSize =
fLimits.GetMaxPointSize();
553 glPointSize((GLfloat)pointSize);
555 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
558 for (
Int_t i = 0; i <
n; ++i)
559 glVertex2d(
x[i],
y[i]);
594 glBegin(GL_LINE_STRIP);
596 for (
Int_t i = 0; i <
n; ++i)
597 glVertex2d(
x1 + u[i] * xRange,
y1 +
v[i] * yRange);
614template<
class ValueType>
617 std::vector<TPoint> poly(
n);
621 for (
Int_t i = 0; i <
n; ++i) {
622 poly[i].fX =
gPad->XtoAbsPixel(
x[i]);
623 poly[i].fY =
gPad->YtoAbsPixel(
y[i]);
632 for (
Int_t i = 0; i <
n; ++i) {
633 poly[i].fX =
gPad->XtoPixel(
x[i]);
634 poly[i].fY = padH -
gPad->YtoPixel(
y[i]);
640 glOrtho(0,
gPad->GetPadWidth(), 0,
gPad->GetPadHeight(), -10., 10.);
642 glMatrixMode(GL_MODELVIEW);
648 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
652 glLineWidth(
w >
fLimits.GetMaxLineWidth() ?
fLimits.GetMaxLineWidth() : !
w ? 1.f :
w);
657 switch (markerStyle) {
676 fMarker.DrawFullDotSmall(
n, poly.data());
679 fMarker.DrawFullDotMedium(
n, poly.data());
683 fMarker.DrawFullDotLarge(
n, poly.data());
686 fMarker.DrawFullSquare(
n, poly.data());
689 fMarker.DrawFullTrianlgeUp(
n, poly.data());
692 fMarker.DrawFullTrianlgeDown(
n, poly.data());
695 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
696 fMarker.DrawFullSquare(
n, poly.data());
697 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
700 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
701 fMarker.DrawFullTrianlgeUp(
n, poly.data());
702 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
705 fMarker.DrawDiamond(
n, poly.data());
708 fMarker.DrawOpenCross(
n, poly.data());
711 fMarker.DrawFullStar(
n, poly.data());
714 fMarker.DrawOpenStar(
n, poly.data());
717 fMarker.DrawOpenTrianlgeDown(
n, poly.data());
720 fMarker.DrawFullDiamond(
n, poly.data());
723 fMarker.DrawFullCross(
n, poly.data());
726 fMarker.DrawOpenDiamondCross(
n, poly.data());
729 fMarker.DrawOpenSquareDiagonal(
n, poly.data());
732 fMarker.DrawOpenThreeTriangles(
n, poly.data());
735 fMarker.DrawOctagonCross(
n, poly.data());
738 fMarker.DrawFullThreeTriangles(
n, poly.data());
741 fMarker.DrawOpenFourTrianglesX(
n, poly.data());
744 fMarker.DrawFullFourTrianglesX(
n, poly.data());
747 fMarker.DrawOpenDoubleDiamond(
n, poly.data());
750 fMarker.DrawFullDoubleDiamond(
n, poly.data());
753 fMarker.DrawOpenFourTrianglesPlus(
n, poly.data());
756 fMarker.DrawFullFourTrianglesPlus(
n, poly.data());
759 fMarker.DrawOpenCrossX(
n, poly.data());
762 fMarker.DrawFullCrossX(
n, poly.data());
765 fMarker.DrawFourSquaresX(
n, poly.data());
768 fMarker.DrawFourSquaresPlus(
n, poly.data());
773 glMatrixMode(GL_MODELVIEW);
805 fontIndex = 20 + shift * 10;
807 fontIndex += shift * 10;
826 glOrtho(0,
gPad->GetAbsWNDC() *
gPad->GetWw(), 0,
gPad->GetAbsHNDC() *
gPad->GetWh(), -10., 10.);
828 glMatrixMode(GL_MODELVIEW);
846 glMatrixMode(GL_MODELVIEW);
914 glMatrixMode(GL_PROJECTION);
925 glMatrixMode(GL_PROJECTION);
936 glMatrixMode(GL_MODELVIEW);
947 glMatrixMode(GL_MODELVIEW);
956 glGetIntegerv(GL_VIEWPORT,
fVp);
978 std::vector<unsigned> buff(canvas->GetWw() * canvas->GetWh());
979 glPixelStorei(GL_PACK_ALIGNMENT, 1);
980 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
983 glReadPixels(0, 0, canvas->GetWw(), canvas->GetWh(), GL_RGBA, GL_UNSIGNED_BYTE, (
char *)&buff[0]);
987 ::Error(
"TGLPadPainter::SaveImage",
"TImage creation failed");
991 image->DrawRectangle(0, 0, canvas->GetWw(), canvas->GetWh());
992 UInt_t *argb = image->GetArgbArray();
995 ::Error(
"TGLPadPainter::SaveImage",
"null argb array in TImage object");
999 const Int_t nLines = canvas->GetWh();
1000 const Int_t nPixels = canvas->GetWw();
1002 for (
Int_t i = 0; i < nLines; ++i) {
1003 Int_t base = (nLines - 1 - i) * nPixels;
1004 for (
Int_t j = 0; j < nPixels; ++j, ++base) {
1008 const UInt_t bgra = ((
pix & 0xff) << 16) | (
pix & 0xff00) |
1009 ((
pix & 0xff0000) >> 16) | (
pix & 0xff000000);
1012 argb[i * nPixels + j] = bgra;
1029 ::Error(
"TGLPadPainter::DrawPixels",
"pixel data is null");
1033 if (std::numeric_limits<UInt_t>::digits >= 32) {
1042 ::Error(
"TGLPadPainter::DrawPixels",
"invalid width");
1048 ::Error(
"TGLPadPainter::DrawPixels",
"invalid height");
1057 const Double_t rasterX =
Double_t(dstX) / (pad->GetAbsWNDC() * pad->GetWw()) *
1058 (pad->GetX2() - pad->GetX1()) + pad->GetX1();
1060 const Double_t yRange = pad->GetY2() - pad->GetY1();
1061 const Double_t rasterY = yRange -
Double_t(dstY +
height) / (pad->GetAbsHNDC() * pad->GetWh()) * yRange +
1064 GLdouble oldPos[4] = {};
1066 glGetDoublev(GL_CURRENT_RASTER_POSITION, oldPos);
1068 glRasterPos2d(rasterX, rasterY);
1070 std::vector<unsigned char> upsideDownImage(4 *
width *
height);
1071 const unsigned char *srcLine = pixelData + 4 *
width * (
height - 1);
1072 unsigned char *dstLine = &upsideDownImage[0];
1074 std::copy(srcLine, srcLine + 4 *
width, dstLine);
1076 if (enableBlending) {
1078 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1084 glDisable(GL_BLEND);
1087 glRasterPos2d(oldPos[0], oldPos[1]);
1089 ::Error(
"TGLPadPainter::DrawPixels",
"no pad found to draw");
1101 assert(
n > 2 &&
"DrawPolygonWithGradient, invalid number of points");
1102 assert(
x !=
nullptr &&
"DrawPolygonWithGradient, parameter 'x' is null");
1103 assert(
y !=
nullptr &&
"DrawPolygonWithGradient, parameter 'y' is null");
1106 assert(grad !=
nullptr &&
"DrawPolygonWithGradient, the current fill color is not a gradient fill");
1117 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1119 glStencilFunc(GL_NEVER, 1, 0xFF);
1120 glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
1122 glStencilMask(0xFF);
1123 glClear(GL_STENCIL_BUFFER_BIT);
1128 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
1129 glStencilMask(0x00);
1131 glStencilFunc(GL_EQUAL, 0, 0xFF);
1133 glStencilFunc(GL_EQUAL, 1, 0xFF);
1144 assert(lGrad !=
nullptr &&
"DrawPolygonWithGradient, unknown gradient type");
1154 assert(grad !=
nullptr &&
"DrawGradient, parameter 'grad' is null");
1155 assert(nPoints > 2 &&
"DrawGradient, invalid number of points");
1156 assert(xs !=
nullptr &&
"DrawGradient, parameter 'xs' is null");
1157 assert(ys !=
nullptr &&
"DrawGradient, parameter 'ys' is null");
1160 ::Warning(
"TGLPadPainter::DrawGradient",
1161 "extended radial gradient is not supported");
1172 radius *=
TMath::Max(bbox.fWidth, bbox.fHeight);
1173 center.fX = bbox.fWidth * center.fX + bbox.fXMin;
1174 center.fY = bbox.fHeight * center.fY + bbox.fYMin;
1176 const auto w =
gPad->GetX2() -
gPad->GetX1();
1177 const auto h =
gPad->GetY2() -
gPad->GetY1();
1184 const auto pixelW =
gPad->GetAbsWNDC() *
gPad->GetWw();
1185 const auto pixelH =
gPad->GetAbsHNDC() *
gPad->GetWh();
1190 glMatrixMode(GL_PROJECTION);
1193 glOrtho(0., pixelW, 0., pixelH, -10., 10.);
1196 center.fX =
gPad->XtoPixel(center.fX);
1197 center.fY = pixelH -
gPad->YtoPixel(center.fY);
1203 const Double_t yMin = pixelH -
gPad->YtoPixel(bbox.fYMin);
1204 const Double_t yMax = pixelH -
gPad->YtoPixel(bbox.fYMax);
1211 maxR =
TMath::Sqrt(maxDistX * maxDistX + maxDistY * maxDistY);
1216 const Bool_t solidFillAfter = maxR > radius;
1219 const UInt_t nSlices = 500;
1224 const auto nCircles = nColors + 1 + solidFillAfter;
1230 std::vector<Double_t> circles(nSlices * nCircles * 2);
1234 for (
UInt_t i = 0; i < nColors; ++i) {
1235 const auto circle = &circles[i * nSlices * 2];
1237 const auto r = radius * locations[i];
1238 for (
UInt_t j = 0,
e = nSlices * 2 - 2; j <
e; j += 2) {
1243 circle[(nSlices - 1) * 2] = circle[0];
1244 circle[(nSlices - 1) * 2 + 1] = circle[1];
1249 const auto circle = &circles[nColors * nSlices * 2];
1250 for (
UInt_t j = 0,
e = nSlices * 2 - 2; j <
e; j += 2) {
1255 circle[(nSlices - 1) * 2] = circle[0];
1256 circle[(nSlices - 1) * 2 + 1] = circle[1];
1259 if (solidFillAfter) {
1261 const auto circle = &circles[(nCircles - 1) * nSlices * 2];
1262 for (
UInt_t j = 0,
e = nSlices * 2 - 2; j <
e; j += 2) {
1267 circle[(nSlices - 1) * 2] = circle[0];
1268 circle[(nSlices - 1) * 2 + 1] = circle[1];
1283 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1286 glBegin(GL_TRIANGLE_FAN);
1288 glVertex2d(center.fX, center.fY);
1290 for (
UInt_t i = 0,
e = nSlices * 2; i <
e; i += 2)
1291 glVertex2dv(&circles[i]);
1296 for (
UInt_t i = 0; i < nColors - 1; ++i) {
1297 const Double_t *
const inner = &circles[i * nSlices * 2];
1298 const auto innerRGBA = rgba + i * 4;
1299 const auto outerRGBA = rgba + (i + 1) * 4;
1300 const Double_t *
const outer = &circles[(i + 1) * nSlices * 2];
1307 const Double_t *
const inner = &circles[nSlices * (nColors - 1) * 2];
1308 const auto solidRGBA = rgba + (nColors - 1) * 4;
1309 const Double_t *
const outer = &circles[nSlices * nColors * 2];
1314 if (solidFillAfter) {
1315 const Double_t *
const inner = &circles[nSlices * nColors * 2];
1316 const auto solidRGBA = rgba + (nColors - 1) * 4;
1317 const Double_t *
const outer = &circles[nSlices * (nColors + 1) * 2];
1331 assert(grad !=
nullptr &&
"DrawGradient, parameter 'grad' is null");
1332 assert(
n > 2 &&
"DrawGradient, invalid number of points");
1333 assert(
x !=
nullptr &&
"DrawGradient, parameter 'x' is null");
1334 assert(
y !=
nullptr &&
"DrawGradient, parameter 'y' is null");
1350 glMatrixMode(GL_PROJECTION);
1355 glOrtho(0., pixelW, 0., pixelH, -10., 10.);
1358 glMatrixMode(GL_MODELVIEW);
1370 start.
fX = start.
fX *
w;
1371 start.
fY = start.
fY *
h;
1372 end.
fX = end.
fX *
w;
1373 end.
fY = end.
fY *
h;
1375 start.
fX = start.
fX * bbox.fWidth + bbox.fXMin;
1376 start.
fY = start.
fY * bbox.fHeight + bbox.fYMin;
1377 end.
fX = end.
fX * bbox.fWidth + bbox.fXMin;
1378 end.
fY = end.
fY * bbox.fHeight + bbox.fYMin;
1385 start.
fX =
gPad->XtoPixel(start.
fX);
1386 start.
fY = pixelH -
gPad->YtoPixel(start.
fY);
1388 end.
fY = pixelH -
gPad->YtoPixel(end.
fY);
1391 const Double_t yMin = pixelH -
gPad->YtoPixel(bbox.fYMin);
1392 const Double_t yMax = pixelH -
gPad->YtoPixel(bbox.fYMax);
1402 (end.
fY - start.
fY) * (end.
fY - start.
fY));
1409 gradBoxes[0] = start.
fY -
h;
1411 gradBoxes[i] = startEndLength * colorPositions[i - 1] + start.
fY;
1418 if (end.
fX > start.
fX)
1421 glTranslated(start.
fX, start.
fY, 0.);
1422 glRotated(
angle, 0., 0., 1.);
1423 glTranslated(-start.
fX, -start.
fY, 0.);
1427 const unsigned nEdges = gradBoxes.size();
1433 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1437 rgba + (nColors - 1) * 4, rgba + (nColors - 1) * 4);
1439 for (
unsigned i = 1; i < nEdges - 2; ++i)
1441 xRight, rgba + (i - 1) * 4, rgba + i * 4);
1451 assert(
n > 2 &&
"DrawTesselation, invalid number of points");
1452 assert(
x !=
nullptr &&
"DrawTesselation, parameter 'x' is null");
1453 assert(
y !=
nullptr &&
"DrawTesselation, parameter 'y' is null");
1458 for (
Int_t i = 0; i <
n; ++i) {
1460 fVs[i * 3 + 1] =
y[i];
1461 fVs[i * 3 + 2] = 0.;
1466 GLUtesselator *t = (GLUtesselator *)
fTess.GetTess();
1468 gluNextContour(t, (GLenum)GLU_UNKNOWN);
1470 for (
Int_t i = 0; i <
n; ++i)
1471 gluTessVertex(t, &
fVs[i * 3], &
fVs[i * 3]);
short Style_t
Style number (short)
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
short Width_t
Line width (short)
float Float_t
Float 4 bytes (float)
short Font_t
Font number (short)
double Double_t
Double 8 bytes.
short SCoord_t
Screen coordinates (short)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
const Double_t lineWidthTS
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
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 const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint percent
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
Option_t Option_t TPoint TPoint DrawText
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Fill Area Attributes class.
virtual Width_t GetLineWidth() const
Return the line width.
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
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 DrawPolyMarkerHelper(Int_t n, const ValueType *x, const ValueType *y)
Poly-marker drawing.
void SetDrawMode(Int_t device, Int_t mode) override
Set drawing mode for specified device.
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.
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...
Bool_t IsInvertMode()
Returns true when invert mode is configured and painter in locked state Used when non-opaque of objec...
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 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 DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override
Poly-marker.
void DrawPolyLineHelper(Int_t n, const ValueType *x, const ValueType *y)
Draw poly-line in user coordinates.
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.
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.
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()