Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGtk4PadPainter.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 12/08/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_TGtk4PadPainter
12#define ROOT_TGtk4PadPainter
13
14#include "TPadPainterBase.h"
15
16
17class Gtk4DrawArea;
18class TTFhandle;
19
20namespace ROOT {
21namespace Experimental {
22
23class TGtk4Canvas;
24
26
27friend class TGtk4Canvas;
28
29protected:
30
32
34
35 void SetGtk4Color(Color_t id);
38 void ApplyFillBrush();
39
40public:
41
42 TGtk4PadPainter(Gtk4DrawArea *widget = nullptr) { fDrawArea = widget; }
43
44 Bool_t HasTTFonts() const override { return kTRUE; }
45
46 Bool_t IsNative() 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 x, Int_t y, TTFhandle &ttf, ETextMode mode) override;
84
85 void DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags = 0) override;
86
87 Bool_t FillImageFromPad(TImage *image, TVirtualPad *pad) const override;
88
89 Bool_t IsSupportAlpha() const override { return kTRUE; }
90
91private:
92 //Let's make this clear:
93 TGtk4PadPainter(const TGtk4PadPainter &rhs) = delete;
97
98 ClassDefOverride(TGtk4PadPainter, 0) // Pad painter on Gtk4 canvas
99};
100
101} // namespace Experimental
102} // namespace ROOT
103
104#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
void SetGtk4Color(Color_t id)
Assign color to cairo context.
void DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags=0) override
Render image on drawable area.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Paint Polyline.
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.
TGtk4PadPainter(TGtk4PadPainter &&rhs)=delete
Bool_t HasTTFonts() const override
TGtk4PadPainter & operator=(const TGtk4PadPainter &rhs)=delete
void ApplyFillBrush()
Complete fill operation - which may include custom pattern handling.
Bool_t SetFillBrush()
Asign fill attributes before drawin shape.
void CopyDrawable(Int_t, Int_t, Int_t) override
void DrawTTFglyphs(Int_t x, Int_t y, TTFhandle &ttf, ETextMode mode) override
Render TTF glyphs on drawable area.
Bool_t IsSupportAlpha() const override
Int_t CreateDrawable(UInt_t, UInt_t) override
TGtk4PadPainter(const TGtk4PadPainter &rhs)=delete
Bool_t SetLinePen()
Asign pen attributes to draw line.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Paint a simple line in normalized coordinates.
void SaveImage(TVirtualPad *, const char *, Int_t) const override
Produce image.
void SetDoubleBuffer(Int_t, Int_t) override
Bool_t FillImageFromPad(TImage *image, TVirtualPad *pad) const override
extract image from recent drawing
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Paint a simple box.
TGtk4PadPainter(Gtk4DrawArea *widget=nullptr)
Basic TCanvasImp ABI implementation for Gtk4.
An abstract interface to image processing library.
Definition TImage.h:30
Extends TVirtualPadPainter interface to simplify work with graphical attributes.
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