29#include <QFontDatabase>
109 painter->setRenderHint(QPainter::Antialiasing);
131 painter->setRenderHint(QPainter::Antialiasing);
156 painter->setRenderHint(QPainter::Antialiasing);
157 painter->setBrush(Qt::NoBrush);
180 auto px =
gPad->XtoAbsPixel(
xs[
n]);
181 auto py =
gPad->YtoAbsPixel(
ys[
n]);
202 auto px =
gPad->XtoAbsPixel(
xs[
n]);
203 auto py =
gPad->YtoAbsPixel(
ys[
n]);
223 auto px =
gPad->XtoAbsPixel(
xs[
n]);
224 auto py =
gPad->YtoAbsPixel(
ys[
n]);
230 painter->setRenderHint(QPainter::Antialiasing);
246 auto px =
gPad->XtoAbsPixel(
xs[
n]);
247 auto py =
gPad->YtoAbsPixel(
ys[
n]);
253 painter->setRenderHint(QPainter::Antialiasing);
269 auto px =
gPad->UtoAbsPixel(
u[
n]);
270 auto py =
gPad->VtoAbsPixel(
v[
n]);
276 painter->setRenderHint(QPainter::Antialiasing);
292 Int_t markerSize = 0;
293 std::vector<TPoint> markerShape;
294 auto markerType =
attr.GetMarkerShape(markerSize, markerShape);
296 painter->setRenderHint(QPainter::Antialiasing);
304 painter->setBrush(Qt::NoBrush);
316 for (
auto &
pnt : markerShape)
326 painter->drawEllipse({px, py}, markerSize / 2, markerSize / 2);
342 for (
int i = 0; i <
points.size() - 2; i += 3) {
440 auto c =
gROOT->GetColor(
id);
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);
465 if (
patt.Length() > 2) {
467 std::unique_ptr<TObjArray>
tokens(
patt.Tokenize(
" "));
469 int it = std::stoi(
tokens->At(
j)->GetName());
470 pattern.push_back(0.25 * it);
472 if (pattern.size() > 1) {
503 return QBrush(Qt::NoBrush);
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" }
567 ::Error(
"TQt6PadPainter::GetFontFamily",
"Not found font %s in configured path %s",
fname.Data(),
ttpath);
571 int qtId = QFontDatabase::addApplicationFont(
ttfont);
573 ::Error(
"TQt6PadPainter::GetFontFamily",
"No able to add font %s to QFontDataBase",
ttfont);
577 QString
fontFamily = QFontDatabase::applicationFontFamilies(
qtId).at(0);
595 if (family.isEmpty())
613 case 2:
x -=
fm.horizontalAdvance(s) / 2;
break;
614 case 3:
x -=
fm.horizontalAdvance(s);
break;
619 case 2:
y +=
fm.height() / 2;
break;
620 case 3:
y +=
fm.height();
break;
623 if (
att.GetTextAngle() == 0) {
642 if (family.isEmpty())
660 if (family.isEmpty())
678 if (family.isEmpty())
696 if (family.isEmpty())
714 if (family.isEmpty())
719 return fm.horizontalAdvance(QString::fromLatin1(
text));
const unsigned char gStipples[26][32]
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
float Float_t
Float 4 bytes (float)
short Font_t
Font number (short)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
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 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.
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
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.
QPaintWidget * fPaintWidget
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.
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
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.
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Namespace for ROOT features in testing.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.