Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TQt6PadPainter.cxx
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 26/06/2026
2
3/*************************************************************************
4 * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#include "TQt6PadPainter.h"
12#include "TError.h"
13#include "TSystem.h"
14#include "TStyle.h"
15#include "TEnv.h"
16#include "TMath.h"
17#include "TPad.h"
18#include "TPoint.h"
19#include "TROOT.h"
20#include "TColor.h"
21#include "RStipples.h"
22
23#include <memory>
24#include <map>
25
26#include "QPaintWidget.h"
27
28#include <QFont>
29#include <QFontDatabase>
30#include <QRect>
31#include <QPainter>
32
33using namespace ROOT::Experimental;
34
35// to scale fonts to the same size as in the TTF
36const Float_t kScale = 0.75 * 0.93376068;
37
38/** \class TQt6PadPainter
39 \ingroup qt6canvas
40 \brief Implement TVirtualPadPainter for Qt6 graphics
41
42 Uses QPainter object which only exists inside paintEvent of Qt.
43*/
44
45//////////////////////////////////////////////////////////////////////////
46/// Set opacity - similar to TVirtualPS usecase
47
48void TQt6PadPainter::SetOpacity(Int_t percent)
49{
51}
52
53//////////////////////////////////////////////////////////////////////////
54/// Set cursor
55
57{
58 switch(cursor) {
59 case kBottomLeft: fPaintWidget->setCursor(Qt::SizeBDiagCursor); break;
60 case kBottomRight: fPaintWidget->setCursor(Qt::SizeFDiagCursor); break;
61 case kTopLeft: fPaintWidget->setCursor(Qt::SizeFDiagCursor); break;
62 case kTopRight: fPaintWidget->setCursor(Qt::SizeBDiagCursor); break;
63 case kBottomSide: fPaintWidget->setCursor(Qt::SizeVerCursor); break;
64 case kLeftSide: fPaintWidget->setCursor(Qt::SizeHorCursor); break;
65 case kTopSide: fPaintWidget->setCursor(Qt::SizeVerCursor); break;
66 case kRightSide: fPaintWidget->setCursor(Qt::SizeHorCursor); break;
67 case kMove: fPaintWidget->setCursor(Qt::DragMoveCursor); break;
68 case kCross: fPaintWidget->setCursor(Qt::CrossCursor); break;
69 case kArrowHor: fPaintWidget->setCursor(Qt::SizeHorCursor); break;
70 case kArrowVer: fPaintWidget->setCursor(Qt::UpArrowCursor); break;
71 case kHand: fPaintWidget->setCursor(Qt::OpenHandCursor); break;
72 case kRotate: fPaintWidget->setCursor(Qt::ClosedHandCursor); break;
73 case kPointer: fPaintWidget->setCursor(Qt::ArrowCursor); break;
74 case kArrowRight: fPaintWidget->setCursor(Qt::SizeHorCursor); break;
75 case kCaret: fPaintWidget->setCursor(Qt::WaitCursor); break;
76 case kWatch: fPaintWidget->setCursor(Qt::WaitCursor); break;
77 case kNoDrop: fPaintWidget->setCursor(Qt::ForbiddenCursor); break;
78 default:
79 fPaintWidget->unsetCursor();
80 }
81}
82
83////////////////////////////////////////////////////////////////////////////////
84///Noop, for non-gl pad TASImage calls gVirtualX->CopyArea.
85
86void TQt6PadPainter::DrawPixels(const unsigned char * /*pixelData*/, UInt_t /*width*/, UInt_t /*height*/,
87 Int_t /*dstX*/, Int_t /*dstY*/, Bool_t /*enableAlphaBlending*/)
88{
89
90}
91
92
93////////////////////////////////////////////////////////////////////////////////
94/// Paint a simple line.
95
97{
99 if (!painter || GetAttLine().GetLineWidth() <= 0)
100 return;
101
102 const Int_t px1 = gPad->XtoAbsPixel(x1);
103 const Int_t py1 = gPad->YtoAbsPixel(y1);
104 const Int_t px2 = gPad->XtoAbsPixel(x2);
105 const Int_t py2 = gPad->YtoAbsPixel(y2);
106
107 painter->setPen(GetLinePen());
108
109 painter->setRenderHint(QPainter::Antialiasing);
110
111 painter->drawLine(QPoint(px1, py1), QPoint(px2, py2));
112}
113
114
115////////////////////////////////////////////////////////////////////////////////
116/// Paint a simple line in normalized coordinates.
117
119{
121 if (!painter || GetAttLine().GetLineWidth() <= 0)
122 return;
123
124 const Int_t px1 = gPad->UtoAbsPixel(u1);
125 const Int_t py1 = gPad->VtoAbsPixel(v1);
126 const Int_t px2 = gPad->UtoAbsPixel(u2);
127 const Int_t py2 = gPad->VtoAbsPixel(v2);
128
129 painter->setPen(GetLinePen());
130
131 painter->setRenderHint(QPainter::Antialiasing);
132
133 painter->drawLine(QPoint(px1, py1), QPoint(px2, py2));
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Paint a simple box.
138
140{
142 return;
143
145 if (!painter)
146 return;
147
148 const Int_t px1 = gPad->XtoAbsPixel(x1);
149 const Int_t py1 = gPad->YtoAbsPixel(y1);
150 const Int_t px2 = gPad->XtoAbsPixel(x2);
151 const Int_t py2 = gPad->YtoAbsPixel(y2);
152
154 // draw only border
155 painter->setPen(GetLinePen());
156 painter->setRenderHint(QPainter::Antialiasing);
157 painter->setBrush(Qt::NoBrush);
158 } else {
159 // draw only fill
160 painter->setPen(Qt::NoPen);
161 painter->setBrush(GetFillBrush());
162 }
163
164 QRect rectangle(TMath::Min(px1, px2), TMath::Min(py1, py2), TMath::Abs(px2 - px1), TMath::Abs(py2 - py1));
165 painter->drawRect(rectangle);
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Paint filled area.
170
172{
174
175 if (!painter || (GetAttFill().GetFillStyle() <= 0) || (nPoints < 3))
176 return;
177
179 for (Int_t n = 0; n < nPoints; ++n) {
180 auto px = gPad->XtoAbsPixel(xs[n]);
181 auto py = gPad->YtoAbsPixel(ys[n]);
182 points.push_back({(qreal) px, (qreal) py});
183 }
184
185 painter->setPen(Qt::NoPen);
186 painter->setBrush(GetFillBrush());
187 painter->drawPolygon(points);
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Paint filled area.
192
194{
196
197 if (!painter || (GetAttFill().GetFillStyle() <= 0) || (nPoints < 3))
198 return;
199
201 for (Int_t n = 0; n < nPoints; ++n) {
202 auto px = gPad->XtoAbsPixel(xs[n]);
203 auto py = gPad->YtoAbsPixel(ys[n]);
204 points.push_back({(qreal) px, (qreal) py});
205 }
206
207 painter->setPen(Qt::NoPen);
208 painter->setBrush(GetFillBrush());
209 painter->drawPolygon(points);
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Paint Polyline.
214
216{
218 if (!painter || (GetAttLine().GetLineWidth() <= 0) || (nPoints < 2))
219 return;
220
222 for (Int_t n = 0; n < nPoints; ++n) {
223 auto px = gPad->XtoAbsPixel(xs[n]);
224 auto py = gPad->YtoAbsPixel(ys[n]);
225 points.push_back({(qreal) px, (qreal) py});
226 }
227
228 painter->setPen(GetLinePen());
229
230 painter->setRenderHint(QPainter::Antialiasing);
231
232 painter->drawPolyline(points);
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// Paint polyline.
237
239{
241 if (!painter || (GetAttLine().GetLineWidth() <= 0) || (nPoints < 2))
242 return;
243
245 for (Int_t n = 0; n < nPoints; ++n) {
246 auto px = gPad->XtoAbsPixel(xs[n]);
247 auto py = gPad->YtoAbsPixel(ys[n]);
248 points.push_back({(qreal) px, (qreal) py});
249 }
250
251 painter->setPen(GetLinePen());
252
253 painter->setRenderHint(QPainter::Antialiasing);
254
255 painter->drawPolyline(points);
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// Paint polyline in normalized coordinates.
260
262{
264 if (!painter || (GetAttLine().GetLineWidth() <= 0) || (nPoints < 2))
265 return;
266
268 for (Int_t n = 0; n < nPoints; ++n) {
269 auto px = gPad->UtoAbsPixel(u[n]);
270 auto py = gPad->VtoAbsPixel(v[n]);
271 points.push_back({(qreal) px, (qreal) py});
272 }
273
274 painter->setPen(GetLinePen());
275
276 painter->setRenderHint(QPainter::Antialiasing);
277
278 painter->drawPolyline(points);
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Helper function to paint markers
283
284template<typename T>
285void drawMarkersHelper(Int_t nPoints, const T *x, const T *y,
286 const TAttMarker &attr, const QColor &col, QPainter *painter)
287{
288 if (!painter || nPoints < 1)
289 return;
290
291 auto markerLineWidth = TAttMarker::GetMarkerLineWidth(attr.GetMarkerStyle());
292 Int_t markerSize = 0; ///< size of simple markers
293 std::vector<TPoint> markerShape; ///< marker shape points
294 auto markerType = attr.GetMarkerShape(markerSize, markerShape);
295
296 painter->setRenderHint(QPainter::Antialiasing);
297
298 if ((markerType == TAttMarker::kShapeDot) || (markerLineWidth > 0)) {
300 customPen.setColor(col);
301 customPen.setWidth(markerLineWidth);
302 customPen.setStyle(Qt::SolidLine);
303 painter->setPen(customPen);
304 painter->setBrush(Qt::NoBrush);
305 } else {
307 painter->setBrush(customBrush);
308 painter->setPen(Qt::NoPen);
309 }
310
311 for (Int_t n = 0; n < nPoints; ++n) {
312 Int_t px = gPad->XtoAbsPixel(x[n]);
313 Int_t py = gPad->YtoAbsPixel(y[n]);
314
316 for (auto &pnt : markerShape)
317 points.push_back({(qreal) (px + pnt.fX), (qreal) (py + pnt.fY)});
318
319 switch(markerType) {
321 painter->drawPoint(px, py);
322 break;
325 // hollow or filled circle
326 painter->drawEllipse({px, py}, markerSize / 2, markerSize / 2);
327 break;
329 // hollow polygon
330 painter->drawPolyline(points);
331 break;
333 // filled polygon
334 painter->drawPolygon(points);
335 break;
337 // segmented line
338 painter->drawLines(points);
339 break;
341 // filled triangles
342 for (int i = 0; i < points.size() - 2; i += 3) {
343 // Construct a temporary triangle polygon
345 triangle << points[i] << points[i + 1] << points[i + 2];
346 // Draw and fill the triangle
347 painter->drawPolygon(triangle);
348 }
349 break;
350 }
351 }
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// Paint polymarker.
356
362
363////////////////////////////////////////////////////////////////////////////////
364/// Paint polymarker.
365
371
372////////////////////////////////////////////////////////////////////////////////
373/// Paint text.
374
376{
377 const Int_t px = gPad->XtoAbsPixel(x);
378 const Int_t py = gPad->YtoAbsPixel(y);
379
380 PaintQString(px, py, QString::fromLatin1(text));
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Paint text with url
385
386void TQt6PadPainter::DrawTextUrl(Double_t x, Double_t y, const char *text, const char * /* url */)
387{
388 const Int_t px = gPad->XtoAbsPixel(x);
389 const Int_t py = gPad->YtoAbsPixel(y);
390
391 PaintQString(px, py, QString::fromLatin1(text));
392}
393
394////////////////////////////////////////////////////////////////////////////////
395/// Special version working with wchar_t and required by TMathText.
396
398{
399 const Int_t px = gPad->XtoAbsPixel(x);
400 const Int_t py = gPad->YtoAbsPixel(y);
401
402 PaintQString(px, py, QString::fromWCharArray(text));
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Paint text in normalized coordinates.
407
409{
410 const Int_t px = gPad->UtoAbsPixel(u);
411 const Int_t py = gPad->VtoAbsPixel(v);
412
413 PaintQString(px, py, QString::fromLatin1(text));
414}
415
416////////////////////////////////////////////////////////////////////////////////
417/// Paint text in normalized coordinates.
418
420{
421 const Int_t px = gPad->UtoAbsPixel(u);
422 const Int_t py = gPad->VtoAbsPixel(v);
423
424 PaintQString(px, py, QString::fromWCharArray(text));
425}
426
427
428////////////////////////////////////////////////////////////////////////////////
429/// Produce image
430
431void TQt6PadPainter::SaveImage(TVirtualPad * /* pad */, const char * /* fileName */, Int_t /* gtype */) const
432{
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Return QColor created from specified TColor
437
439{
440 auto c = gROOT->GetColor(id);
441 if (c)
442 return QColor((int)(c->GetRed() * 255), (int)(c->GetGreen() * 255), (int)(c->GetBlue() * 255), (int)(c->GetAlpha() * 255));
443 return QColor(0, 0, 0);
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Return QPen for lines drawing
448
450{
451 auto &att = GetAttLine();
452
453 auto style = att.GetLineStyle();
454
456 customPen.setColor(GetQColor(att.GetLineColor()));
457 customPen.setWidth(att.GetLineWidth());
458 customPen.setStyle(Qt::SolidLine);
459
461
462 if (style > 1)
464
465 if (patt.Length() > 2) {
466 QList<qreal> pattern;
467 std::unique_ptr<TObjArray> tokens(patt.Tokenize(" "));
468 for (Int_t j = 0; j < tokens->GetEntries(); j++) {
469 int it = std::stoi(tokens->At(j)->GetName());
470 pattern.push_back(0.25 * it);
471 }
472 if (pattern.size() > 1) {
473 customPen.setStyle(Qt::CustomDashLine);
474 customPen.setDashPattern(pattern);
475 }
476 }
477
478 return customPen;
479}
480
481////////////////////////////////////////////////////////////////////////////////
482/// Return QBrush for fill drawing drawing
483
485{
486 auto &att = GetAttFill();
487
488 Int_t style = att.GetFillStyle() / 1000;
489
490 if (style == 1)
491 return QBrush(GetQColor(att.GetFillColor()));
492
493 if (style == 3) {
494 Int_t fasi = att.GetFillStyle() % 1000;
495 Int_t stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
496 QBitmap bitmap = QBitmap::fromData(QSize(16, 16), (uchar *)gStipples[stn]);
497 QImage image = bitmap.toImage();
498 image.setColor(0, qRgba(0, 0, 0, 0)); // transparent
499 image.setColor(1, GetQColor(att.GetFillColor()).rgba());
500 return QBrush(QPixmap::fromImage(image.copy()));
501 }
502
503 return QBrush(Qt::NoBrush);
504}
505
506
507////////////////////////////////////////////////////////////////////////////////
508/// Return font family for specified ROOT font id
509/// If necessary, register TTF font to Qt first
510
512{
513 // TODO: make special generic method, used from several places
514 static const char *fonttable[][2] = {
515 { "Root.TTFont.0", "FreeSansBold.otf" },
516 { "Root.TTFont.1", "FreeSerifItalic.otf" },
517 { "Root.TTFont.2", "FreeSerifBold.otf" },
518 { "Root.TTFont.3", "FreeSerifBoldItalic.otf" },
519 { "Root.TTFont.4", "texgyreheros-regular.otf" },
520 { "Root.TTFont.5", "texgyreheros-italic.otf" },
521 { "Root.TTFont.6", "texgyreheros-bold.otf" },
522 { "Root.TTFont.7", "texgyreheros-bolditalic.otf" },
523 { "Root.TTFont.8", "FreeMono.otf" },
524 { "Root.TTFont.9", "FreeMonoOblique.otf" },
525 { "Root.TTFont.10", "FreeMonoBold.otf" },
526 { "Root.TTFont.11", "FreeMonoBoldOblique.otf" },
527 { "Root.TTFont.12", "symbol.ttf" },
528 { "Root.TTFont.13", "FreeSerif.otf" },
529 { "Root.TTFont.14", "wingding.ttf" },
530 { "Root.TTFont.15", "symbol.ttf" },
531 { "Root.TTFont.STIXGen", "STIXGeneral.otf" },
532 { "Root.TTFont.STIXGenIt", "STIXGeneralItalic.otf" },
533 { "Root.TTFont.STIXGenBd", "STIXGeneralBol.otf" },
534 { "Root.TTFont.STIXGenBdIt", "STIXGeneralBolIta.otf" },
535 { "Root.TTFont.STIXSiz1Sym", "STIXSiz1Sym.otf" },
536 { "Root.TTFont.STIXSiz1SymBd", "STIXSiz1SymBol.otf" },
537 { "Root.TTFont.STIXSiz2Sym", "STIXSiz2Sym.otf" },
538 { "Root.TTFont.STIXSiz2SymBd", "STIXSiz2SymBol.otf" },
539 { "Root.TTFont.STIXSiz3Sym", "STIXSiz3Sym.otf" },
540 { "Root.TTFont.STIXSiz3SymBd", "STIXSiz3SymBol.otf" },
541 { "Root.TTFont.STIXSiz4Sym", "STIXSiz4Sym.otf" },
542 { "Root.TTFont.STIXSiz4SymBd", "STIXSiz4SymBol.otf" },
543 { "Root.TTFont.STIXSiz5Sym", "STIXSiz5Sym.otf" },
544 { "Root.TTFont.ME", "DroidSansFallback.ttf" },
545 { "Root.TTFont.CJKMing", "DroidSansFallback.ttf" },
546 { "Root.TTFont.CJKGothic", "DroidSansFallback.ttf" }
547 };
548
549 int fontid = fontnumber / 10;
551 fontid = 0;
552
553 static std::map<int, QString> registeredFonts;
554
555 auto iter = registeredFonts.find(fontid);
556 if (iter != registeredFonts.end())
557 return iter->second;
558
559 const char *ttpath = gEnv->GetValue("Root.TTFontPath",
561
563
565
566 if (!ttfont) {
567 ::Error("TQt6PadPainter::GetFontFamily", "Not found font %s in configured path %s", fname.Data(), ttpath);
568 return "";
569 }
570
571 int qtId = QFontDatabase::addApplicationFont(ttfont);
572 if (qtId == -1) {
573 ::Error("TQt6PadPainter::GetFontFamily", "No able to add font %s to QFontDataBase", ttfont);
574 return "";
575 }
576
577 QString fontFamily = QFontDatabase::applicationFontFamilies(qtId).at(0);
578
580
581 return fontFamily;
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// Actual text painting image
586
587void TQt6PadPainter::PaintQString(int x, int y, const QString &s)
588{
590 if (!painter)
591 return;
592
593 const TAttText &att = GetAttText();
594 auto family = GetFontFamily(att.GetTextFont());
595 if (family.isEmpty())
596 return;
597
598 auto textsize = att.GetTextSizePixels(*gPad);
600
601 painter->setFont(QFont(family, pixelsize));
602
603 painter->setPen(GetQColor(att.GetTextColor()));
604
605 Int_t txalh = att.GetTextAlign() / 10;
606 Int_t txalv = att.GetTextAlign() % 10;
607
608 auto fm = painter->fontMetrics();
609
610 switch (txalh) {
611 case 0:
612 case 1: break; //left
613 case 2: x -= fm.horizontalAdvance(s) / 2; break; //center
614 case 3: x -= fm.horizontalAdvance(s); break; //right
615 }
616
617 switch (txalv) {
618 case 1: break; //bottom
619 case 2: y += fm.height() / 2; break; // middle
620 case 3: y += fm.height(); break; //top
621 }
622
623 if (att.GetTextAngle() == 0) {
624 // Just draw text
625 painter->drawText(x, y, s);
626 } else {
627 // Draw with rotation
628 painter->save();
629 painter->translate(x, y);
630 painter->rotate(-att.GetTextAngle());
631 painter->drawText(0, 0, s);
632 painter->restore();
633 }
634}
635
636////////////////////////////////////////////////////////////////////////////////
637/// Returns text extent
638
640{
641 auto family = GetFontFamily(font);
642 if (family.isEmpty())
643 return;
644
645 Int_t pixelsize = (Int_t) (size*kScale+0.5);
646
647 QFontMetrics fm(QFont(family, pixelsize));
648 QRect rect = fm.boundingRect(QString::fromLatin1(mess));
649
650 w = rect.width();
651 h = rect.height();
652}
653
654////////////////////////////////////////////////////////////////////////////////
655/// Returns text extent
656
658{
659 auto family = GetFontFamily(font);
660 if (family.isEmpty())
661 return;
662
663 Int_t pixelsize = (Int_t) (size*kScale+0.5);
664
665 QFontMetrics fm(QFont(family, pixelsize));
666 QRect rect = fm.boundingRect(QString::fromWCharArray(mess));
667
668 w = rect.width();
669 h = rect.height();
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Returns text accent / descent
674
676{
677 auto family = GetFontFamily(font);
678 if (family.isEmpty())
679 return;
680
681 Int_t pixelsize = (Int_t) (size*kScale+0.5);
682
683 QFontMetrics fm(QFont(family, pixelsize));
684 QRect rect = fm.boundingRect(QString::fromLatin1(mess));
685
686 a = -rect.top();
687 d = rect.bottom();
688}
689
690////////////////////////////////////////////////////////////////////////////////
691/// Returns text accent / descent
692
694{
695 auto family = GetFontFamily(font);
696 if (family.isEmpty())
697 return;
698
699 Int_t pixelsize = (Int_t) (size*kScale+0.5);
700
701 QFontMetrics fm(QFont(family, pixelsize));
702 QRect rect = fm.boundingRect(QString::fromWCharArray(mess));
703
704 a = -rect.top();
705 d = rect.bottom();
706}
707
708////////////////////////////////////////////////////////////////////////////////
709/// Returns text advance
710
712{
713 auto family = GetFontFamily(font);
714 if (family.isEmpty())
715 return 0;
716 Int_t pixelsize = (Int_t) (size*kScale+0.5);
717
718 QFontMetrics fm(QFont(family, pixelsize));
719 return fm.horizontalAdvance(QString::fromLatin1(text));
720}
ECursor
Definition GuiTypes.h:373
@ kRightSide
Definition GuiTypes.h:374
@ kBottomSide
Definition GuiTypes.h:374
@ kArrowRight
Definition GuiTypes.h:376
@ kTopLeft
Definition GuiTypes.h:373
@ kBottomRight
Definition GuiTypes.h:373
@ kArrowVer
Definition GuiTypes.h:375
@ kCaret
Definition GuiTypes.h:376
@ kTopSide
Definition GuiTypes.h:374
@ kLeftSide
Definition GuiTypes.h:374
@ kWatch
Definition GuiTypes.h:376
@ kMove
Definition GuiTypes.h:375
@ kTopRight
Definition GuiTypes.h:373
@ kBottomLeft
Definition GuiTypes.h:373
@ kHand
Definition GuiTypes.h:375
@ kCross
Definition GuiTypes.h:375
@ kRotate
Definition GuiTypes.h:375
@ kNoDrop
Definition GuiTypes.h:376
@ kArrowHor
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:376
#define d(i)
Definition RSha256.hxx:102
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
const unsigned char gStipples[26][32]
Definition RStipples.h:24
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
short Font_t
Font number (short)
Definition RtypesCore.h:96
const Float_t kScale
Definition TASImage.cxx:131
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
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 rect
Option_t Option_t fontnumber
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 bitmap
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t textsize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Option_t Option_t TPoint TPoint percent
Option_t Option_t style
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
void drawMarkersHelper(Int_t nPoints, const T *x, const T *y, const TAttMarker &attr, const QColor &col, QPainter *painter)
Helper function to paint markers.
const Float_t kScale
#define gROOT
Definition TROOT.h:417
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
@ kReadPermission
Definition TSystem.h:55
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
#define gPad
QPainter * getPainter() const
void SetCursor(Int_t, ECursor) override
Set cursor.
QBrush GetFillBrush()
Return QBrush for fill drawing drawing.
void SaveImage(TVirtualPad *, const char *, Int_t) const override
Produce image.
void PaintQString(int x, int y, const QString &s)
Actual text painting image.
void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override
Paint text with url.
static QString GetFontFamily(Font_t id)
Return font family for specified ROOT font id If necessary, register TTF font to Qt first.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
void GetTextAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override
Returns text accent / descent.
void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override
Noop, for non-gl pad TASImage calls gVirtualX->CopyArea.
void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override
Paint polymarker.
void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override
Paint text.
static QColor GetQColor(Color_t id)
Return QColor created from specified TColor.
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override
Paint text in normalized coordinates.
void GetTextExtent(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override
Returns text extent.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Paint a simple box.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Paint Polyline.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Paint a simple line in normalized coordinates.
UInt_t GetTextAdvance(Font_t font, Double_t size, const char *text, Bool_t kern) override
Returns text advance.
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Paint a simple line.
void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override
Paint filled area.
QPen GetLinePen()
Return QPen for lines drawing.
const_iterator end() const
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:42
Marker Attributes class.
Definition TAttMarker.h:22
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
@ kShapeTriangles
Definition TAttMarker.h:48
@ kShapeFilledArea
Definition TAttMarker.h:48
@ kShapeFilledCircle
Definition TAttMarker.h:48
Text Attributes class.
Definition TAttText.h:21
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:511
Color_t GetMarkerColor() const override
const TAttText & GetAttText() const override
Get text attributes.
const TAttMarker & GetAttMarker() const override
Get marker attributes.
const TAttFill & GetAttFill() const override
Get fill attributes.
Width_t GetLineWidth() const override
TAttFill fAttFill
current fill attributes
const TAttLine & GetAttLine() const override
Get line attributes.
Style_t GetFillStyle() const override
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
Definition TROOT.cxx:3522
Basic string class.
Definition TString.h:137
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1167
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition TSystem.cxx:1554
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Namespace for ROOT features in testing.
Definition TROOT.h:100
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122