28 namespace Experimental {
30 class TDrawingOptsBaseNoDefault;
31 template <
class PRIMITIVE>
45 std::array<TPadCoord::Pixel, 2>
fSize;
62 std::unique_ptr<Internal::TVirtualCanvasPainter>
fPainter;
84 template <
class PRIMITIVE>
89 static std::shared_ptr<TCanvas>
Create(
const std::string &title);
102 const std::array<TPadCoord::Pixel, 2> &
GetSize()
const {
return fSize; }
105 void SetSize(
const std::array<TPadCoord::Pixel, 2> &sz) { fSize = sz; }
115 void Show(
const std::string &where =
"");
121 template <
class PANEL>
123 if (!fPainter)
return false;
124 return fPainter->AddPanel(panel->GetWindow());
143 void SetTitle(
const std::string &title) { fTitle = title; }
146 std::array<TPadCoord::Normal, 2>
PixelsToNormal(
const std::array<TPadCoord::Pixel, 2> &pos)
const final 148 return {{pos[0] / fSize[0], pos[1] / fSize[1]}};
151 static const std::vector<std::shared_ptr<TCanvas>> &
GetCanvases();
const Internal::TDrawingAttrTable< long long > & GetAttrTable(long long *) const
Internal::TDrawingAttrTable< TColor > fColorTable
Colors used by drawing options in the pad and any sub-pad.
Internal::TDrawingAttrTable< TColor > & GetAttrTable(TColor *)
Attribute table (non-const access).
Namespace for new ROOT classes and functions.
TCanvas & GetCanvas() override
Access to the top-most canvas, if any (non-const version).
void SetSize(const std::array< TPadCoord::Pixel, 2 > &sz)
Set canvas pixel size as array with two elements - width and height.
std::string fTitle
Title of the canvas.
Internal::TDrawingAttrTable< long long > & GetAttrTable(long long *)
A window's topmost TPad.
uint64_t fModified
Modify counter, incremented every time canvas is changed.
const TCanvas & GetCanvas() const override
Access to the top-most canvas, if any (const version).
const std::string & GetTitle() const
Get the canvas's title.
TCanvas & operator=(const TCanvas &)=delete
Disable assignment for now.
A pixel coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the TPad...
void Wipe()
Remove an object from the list of primitives.
std::unique_ptr< Internal::TVirtualCanvasPainter > fPainter
The painter of this canvas, bootstrapping the graphics connection.
void Update(bool async=false, CanvasCallback_t callback=nullptr)
update drawing
Base class for graphic containers for TDrawable-s.
std::array< TPadCoord::Normal, 2 > PixelsToNormal(const std::array< TPadCoord::Pixel, 2 > &pos) const final
Convert a Pixel position to Canvas-normalized positions.
void Hide()
Close all canvas displays.
TCanvas()=default
Create a temporary TCanvas; for long-lived ones please use Create().
Internal::TDrawingAttrTable< double > & GetAttrTable(double *)
void SetSize(const TPadCoord::Pixel &width, const TPadCoord::Pixel &height)
Set canvas pixel size - width and height.
const Internal::TDrawingAttrTable< TColor > & GetAttrTable(TColor *) const
Attribute table (const access).
bool AddPanel(std::shared_ptr< PANEL > &panel)
Insert panel into the canvas, canvas should be shown at this moment.
std::array< TPadCoord::Pixel, 2 > fSize
Size of the canvas in pixels,.
const Internal::TDrawingAttrTable< double > & GetAttrTable(double *) const
void SaveAs(const std::string &filename, bool async=false, CanvasCallback_t callback=nullptr)
Save canvas in image file.
std::function< void(bool)> CanvasCallback_t
The TCanvas keep track of TColors, integer and floating point attributes used by the drawing options...
void Show(const std::string &where="")
Display the canvas.
Internal::TDrawingAttrTable< long long > fIntAttrTable
Integers used by drawing options in the pad and any sub-pad.
Internal::TDrawingAttrTable< double > fFPAttrTable
Floating points used by drawing options in the pad and any sub-pad.
A color: Red|Green|Blue|Alpha, or a position in a TPalette.
static std::shared_ptr< TCanvas > Create(const std::string &title)
const std::array< TPadCoord::Pixel, 2 > & GetSize() const
Return canvas pixel size as array with two elements - width and height.
void SetTitle(const std::string &title)
Set the canvas's title.
static const std::vector< std::shared_ptr< TCanvas > > & GetCanvases()