83 painter->setRenderHint(QPainter::Antialiasing);
85 painter->drawLine(QPoint(px1, py1), QPoint(px2, py2));
105 painter->setRenderHint(QPainter::Antialiasing);
107 painter->drawLine(QPoint(px1, py1), QPoint(px2, py2));
130 painter->setRenderHint(QPainter::Antialiasing);
131 painter->setBrush(Qt::NoBrush);
134 painter->setPen(Qt::NoPen);
139 painter->drawRect(rectangle);
153 for (
Int_t n = 0;
n < nPoints; ++
n) {
154 auto px =
gPad->XtoAbsPixel(xs[
n]);
155 auto py =
gPad->YtoAbsPixel(ys[
n]);
156 points.push_back({(qreal) px, (qreal) py});
159 painter->setPen(Qt::NoPen);
161 painter->drawPolygon(
points);
175 for (
Int_t n = 0;
n < nPoints; ++
n) {
176 auto px =
gPad->XtoAbsPixel(xs[
n]);
177 auto py =
gPad->YtoAbsPixel(ys[
n]);
178 points.push_back({(qreal) px, (qreal) py});
181 painter->setPen(Qt::NoPen);
183 painter->drawPolygon(
points);
196 for (
Int_t n = 0;
n < nPoints; ++
n) {
197 auto px =
gPad->XtoAbsPixel(xs[
n]);
198 auto py =
gPad->YtoAbsPixel(ys[
n]);
199 points.push_back({(qreal) px, (qreal) py});
204 painter->setRenderHint(QPainter::Antialiasing);
206 painter->drawPolyline(
points);
219 for (
Int_t n = 0;
n < nPoints; ++
n) {
220 auto px =
gPad->XtoAbsPixel(xs[
n]);
221 auto py =
gPad->YtoAbsPixel(ys[
n]);
222 points.push_back({(qreal) px, (qreal) py});
227 painter->setRenderHint(QPainter::Antialiasing);
229 painter->drawPolyline(
points);
242 for (
Int_t n = 0;
n < nPoints; ++
n) {
243 auto px =
gPad->UtoAbsPixel(u[
n]);
244 auto py =
gPad->VtoAbsPixel(
v[
n]);
245 points.push_back({(qreal) px, (qreal) py});
250 painter->setRenderHint(QPainter::Antialiasing);
252 painter->drawPolyline(
points);
262 if (!painter || nPoints < 1)
266 Int_t markerSize = 0;
267 std::vector<TPoint> markerShape;
268 auto markerType =
attr.GetMarkerShape(markerSize, markerShape);
270 painter->setRenderHint(QPainter::Antialiasing);
274 customPen.setColor(col);
275 customPen.setWidth(markerLineWidth);
276 customPen.setStyle(Qt::SolidLine);
277 painter->setPen(customPen);
278 painter->setBrush(Qt::NoBrush);
280 QBrush customBrush(col);
281 painter->setBrush(customBrush);
282 painter->setPen(Qt::NoPen);
285 for (
Int_t n = 0;
n < nPoints; ++
n) {
290 for (
auto &pnt : markerShape)
291 points.push_back({(qreal) (px + pnt.fX), (qreal) (py + pnt.fY)});
295 painter->drawPoint(px, py);
300 painter->drawEllipse({px, py}, markerSize / 2, markerSize / 2);
304 painter->drawPolyline(
points);
308 painter->drawPolygon(
points);
312 painter->drawLines(
points);
316 for (
int i = 0; i <
points.size() - 2; i += 3) {
321 painter->drawPolygon(triangle);
333 drawMarkersHelper<Double_t>(nPoints,
x,
y,
342 drawMarkersHelper<Float_t>(nPoints,
x,
y,
358 auto c =
gROOT->GetColor(
id);
360 return QColor((
int)(
c->GetRed() * 255), (
int)(
c->GetGreen() * 255), (
int)(
c->GetBlue() * 255), (
int)(
c->GetAlpha() * 255));
361 return QColor(0, 0, 0);
371 auto style = att.GetLineStyle();
374 customPen.setColor(
GetQColor(att.GetLineColor()));
375 customPen.setWidth(att.GetLineWidth());
376 customPen.setStyle(Qt::SolidLine);
384 QList<qreal> pattern;
385 std::unique_ptr<TObjArray> tokens(patt.
Tokenize(
" "));
386 for (
Int_t j = 0; j < tokens->GetEntries(); j++) {
387 int it = std::stoi(tokens->At(j)->GetName());
388 pattern.push_back(0.25 * it);
390 if (pattern.size() > 1) {
391 customPen.setStyle(Qt::CustomDashLine);
392 customPen.setDashPattern(pattern);
409 return QBrush(
GetQColor(att.GetFillColor()));
412 Int_t fasi = att.GetFillStyle() % 1000;
413 Int_t stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
414 QBitmap
bitmap = QBitmap::fromData(QSize(16, 16), (uchar *)
gStipples[stn]);
415 QImage image =
bitmap.toImage();
416 image.setColor(0, qRgba(0, 0, 0, 0));
417 image.setColor(1,
GetQColor(att.GetFillColor()).rgba());
418 return QBrush(QPixmap::fromImage(image.copy()));
421 return QBrush(Qt::NoBrush);
441 Int_t bx = 0, by = 0;
447 QImage colorFill(
width, rows, QImage::Format_ARGB32);
448 colorFill.fill(textColor);
450 QPainter maskPainter(&colorFill);
457 QImage::Format_Alpha8
460 maskPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
461 maskPainter.drawImage(0, 0, maskImage);
464 painter->drawImage(QPoint(px + bx, py + by), colorFill);
480 int bytesPerLine =
width * 4;
489 QImage::Format_ARGB32
494 painter->drawImage(px, py, image);
const unsigned char gStipples[26][32]
short Color_t
Color number (short)
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
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 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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
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
QBrush GetFillBrush()
Return QBrush for fill drawing drawing.
void SaveImage(TVirtualPad *, const char *, Int_t) const override
Produce image.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
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 DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags=0) override
Draw image, need to be implemented in correspondent.
static QColor GetQColor(Color_t id)
Return QColor created from specified TColor.
void DrawTTFglyphs(Int_t px, Int_t py, TTFhandle &ttf, ETextMode mode) override
Render TTF glyphs on drawable area.
QPaintWidget * fPaintWidget
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.
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.
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 Color_t GetTextColor() const
Return the text color.
An abstract interface to image processing library.
virtual UInt_t * GetArgbArray()
virtual UInt_t GetWidth() const
virtual UInt_t GetHeight() const
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
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Dynamic handle to work with freetype 2 library.
UInt_t GetNumGlyphs() const
return number of glyphs
Bool_t GetGlyphData(UInt_t n, Int_t &offx, Int_t &offy, UChar_t *&buffer, UInt_t &width, UInt_t &rows, UInt_t &pitch)
Returns data for glyph bitmap Instead direct access to FT_BitmapGlyph one can obtain all relevant fie...
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual Int_t UtoAbsPixel(Double_t u) const =0
virtual Int_t VtoAbsPixel(Double_t v) const =0
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.