Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TQt6PadPainter.h
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#ifndef ROOT_TQt6PadPainter
12#define ROOT_TQt6PadPainter
13
14#include "TPadPainterBase.h"
15
16class QColor;
17class QPen;
18class QBrush;
19class QPaintWidget;
20
21namespace ROOT {
22namespace Experimental {
23
24class TQt6Canvas;
25
27
28friend class TQt6Canvas;
29
30protected:
31
33
34 static QColor GetQColor(Color_t id);
35 QPen GetLinePen();
36 QBrush GetFillBrush();
37
38public:
39
40 TQt6PadPainter(QPaintWidget *widget = nullptr) { fPaintWidget = widget; }
41
42 Bool_t HasTTFonts() const override { return kTRUE; }
43
44 Bool_t IsNative() const override { return kTRUE; }
45
46 Bool_t IsSupportAlpha() const override { return kTRUE; }
47
48 void SetOpacity(Int_t percent) override;
49
50 //2. "Off-screen management" part.
51 // return non-zero value to let execute painting code
52 Int_t CreateDrawable(UInt_t, UInt_t) override { return 223344; }
53 void ClearDrawable() override {}
54 void CopyDrawable(Int_t, Int_t, Int_t) override {}
55 void DestroyDrawable(Int_t) override {}
56 void SelectDrawable(Int_t) override {}
57 void SetDoubleBuffer(Int_t /* device */, Int_t /* mode */) override {}
58
59 //jpg, png, bmp, gif output.
60 void SaveImage(TVirtualPad *, const char *, Int_t) const override;
61
62 //TASImage support (noop for a non-gl pad).
63 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
64 Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override;
65
67 void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
68
70 //TPad needs double and float versions.
71 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
72 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
73
74 //TPad needs both double and float versions of DrawPolyLine.
75 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
76 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
77 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
78
79 //TPad needs both versions.
80 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
81 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
82
83 void DrawTTFglyphs(Int_t px, Int_t py, TTFhandle &ttf, [[maybe_unused]] ETextMode mode) override;
84
85 void DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags = 0) override;
86
87private:
88 //Let's make this clear:
89 TQt6PadPainter(const TQt6PadPainter &rhs) = delete;
93
94 ClassDefOverride(TQt6PadPainter, 0) // Pad painter on Qt6 canvas
95};
96
97} // namespace Experimental
98} // namespace ROOT
99
100#endif
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
#define ClassDefOverride(name, id)
Definition Rtypes.h:347
Option_t Option_t DrawFillArea
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 mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint DrawPolyMarker
Option_t Option_t TPoint TPoint const char DrawLine
Option_t Option_t width
Option_t Option_t TPoint TPoint percent
Option_t Option_t TPoint TPoint SetOpacity
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
Represent area where actual canvas painting is performed.
QBrush GetFillBrush()
Return QBrush for fill drawing drawing.
void SaveImage(TVirtualPad *, const char *, Int_t) const override
Produce image.
Bool_t IsNative() const override
Int_t CreateDrawable(UInt_t, UInt_t) override
TQt6PadPainter(const TQt6PadPainter &rhs)=delete
Bool_t HasTTFonts() const override
void SetDoubleBuffer(Int_t, Int_t) override
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 DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags=0) override
Draw image, need to be implemented in correspondent.
void SelectDrawable(Int_t) override
TQt6PadPainter(TQt6PadPainter &&rhs)=delete
TQt6PadPainter(QPaintWidget *widget=nullptr)
Bool_t IsSupportAlpha() const override
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.
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 CopyDrawable(Int_t, Int_t, Int_t) override
TQt6PadPainter & operator=(const TQt6PadPainter &rhs)=delete
void DestroyDrawable(Int_t) override
QPen GetLinePen()
Return QPen for lines drawing.
An abstract interface to image processing library.
Definition TImage.h:29
Extends TVirtualPadPainter interface to simplify work with graphical attributes.
Basic TCanvasImp ABI implementation for Qt6.
Dynamic handle to work with freetype 2 library.
Definition TTFhandle.h:21
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:53
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16