Logo ROOT   6.12/07
Reference Guide
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROOT::Experimental::TCanvas Class Reference

A window's topmost TPad.

Access is through TCanvasPtr.

Definition at line 39 of file TCanvas.hxx.

Public Member Functions

 TCanvas ()=default
 Create a temporary TCanvas; for long-lived ones please use Create(). More...
 
 ~TCanvas ()
 
template<class PANEL >
bool AddPanel (std::shared_ptr< PANEL > &panel)
 Insert panel into the canvas, canvas should be shown at this moment. More...
 
const TCanvasGetCanvas () const override
 Access to the top-most canvas, if any (const version). More...
 
TCanvasGetCanvas () override
 Access to the top-most canvas, if any (non-const version). More...
 
const std::array< TPadCoord::Pixel, 2 > & GetSize () const
 Return canvas pixel size as array with two elements - width and height. More...
 
const std::string & GetTitle () const
 Get the canvas's title. More...
 
void Hide ()
 Close all canvas displays. More...
 
bool IsModified () const
 
void Modified ()
 
std::array< TPadCoord::Normal, 2 > PixelsToNormal (const std::array< TPadCoord::Pixel, 2 > &pos) const final
 Convert a Pixel position to Canvas-normalized positions. More...
 
void SaveAs (const std::string &filename, bool async=false, CanvasCallback_t callback=nullptr)
 Save canvas in image file. More...
 
void SetSize (const std::array< TPadCoord::Pixel, 2 > &sz)
 Set canvas pixel size as array with two elements - width and height. More...
 
void SetSize (const TPadCoord::Pixel &width, const TPadCoord::Pixel &height)
 Set canvas pixel size - width and height. More...
 
void SetTitle (const std::string &title)
 Set the canvas's title. More...
 
void Show (const std::string &where="")
 Display the canvas. More...
 
void Update (bool async=false, CanvasCallback_t callback=nullptr)
 update drawing More...
 
- Public Member Functions inherited from ROOT::Experimental::TPadBase
virtual ~TPadBase ()
 
std::vector< std::vector< TPad * > > Divide (int nHoriz, int nVert, const TPadExtent &padding={})
 Divide this pad into a grid of subpad with padding in between. More...
 
template<class T >
auto & Draw (const std::shared_ptr< T > &what)
 Add something to be painted. More...
 
template<class T >
auto & Draw (std::unique_ptr< T > &&what)
 Add something to be painted. The pad claims ownership. More...
 
template<class T , class = typename std::enable_if<!ROOT::TypeTraits::IsSmartOrDumbPtr<T>::value>::type>
auto & Draw (const T &what)
 Add a copy of something to be painted. More...
 
const Primitives_tGetPrimitives () const
 Get the elements contained in the canvas. More...
 
std::array< TPadCoord::Normal, 2 > UserToNormal (const std::array< TPadCoord::User, 2 > &pos) const
 Convert user coordinates to normal coordinates. More...
 
void Wipe ()
 Remove an object from the list of primitives. More...
 

Static Public Member Functions

static std::shared_ptr< TCanvasCreate (const std::string &title)
 
static const std::vector< std::shared_ptr< TCanvas > > & GetCanvases ()
 

Private Member Functions

 TCanvas (const TCanvas &)=delete
 Disable copy construction for now. More...
 
TCanvasoperator= (const TCanvas &)=delete
 Disable assignment for now. More...
 

Private Attributes

Internal::TDrawingAttrTable< TColorfColorTable
 Colors used by drawing options in the pad and any sub-pad. More...
 
Internal::TDrawingAttrTable< double > fFPAttrTable
 Floating points used by drawing options in the pad and any sub-pad. More...
 
Internal::TDrawingAttrTable< long long > fIntAttrTable
 Integers used by drawing options in the pad and any sub-pad. More...
 
uint64_t fModified
 Modify counter, incremented every time canvas is changed. More...
 
std::unique_ptr< Internal::TVirtualCanvasPainterfPainter
 The painter of this canvas, bootstrapping the graphics connection. More...
 
std::array< TPadCoord::Pixel, 2 > fSize
 Size of the canvas in pixels,. More...
 
std::string fTitle
 Title of the canvas. More...
 

Drawing options attribute handling

class ROOT::Experimental::TDrawingOptsBaseNoDefault
 
template<class PRIMITIVE >
class ROOT::Experimental::TDrawingAttrRef
 
Internal::TDrawingAttrTable< TColor > & GetAttrTable (TColor *)
 Attribute table (non-const access). More...
 
Internal::TDrawingAttrTable< long long > & GetAttrTable (long long *)
 
Internal::TDrawingAttrTable< double > & GetAttrTable (double *)
 
const Internal::TDrawingAttrTable< TColor > & GetAttrTable (TColor *) const
 Attribute table (const access). More...
 
const Internal::TDrawingAttrTable< long long > & GetAttrTable (long long *) const
 
const Internal::TDrawingAttrTable< double > & GetAttrTable (double *) const
 

Additional Inherited Members

- Public Types inherited from ROOT::Experimental::TPadBase
using Primitives_t = std::vector< std::unique_ptr< TDrawable > >
 
- Protected Member Functions inherited from ROOT::Experimental::TPadBase
 TPadBase ()=default
 Allow derived classes to default construct a TPadBase. More...
 

#include <ROOT/TCanvas.hxx>

Inheritance diagram for ROOT::Experimental::TCanvas:
[legend]

Constructor & Destructor Documentation

◆ TCanvas() [1/2]

ROOT::Experimental::TCanvas::TCanvas ( const TCanvas )
privatedelete

Disable copy construction for now.

◆ TCanvas() [2/2]

ROOT::Experimental::TCanvas::TCanvas ( )
default

Create a temporary TCanvas; for long-lived ones please use Create().

◆ ~TCanvas()

ROOT::Experimental::TCanvas::~TCanvas ( )
inline

Definition at line 94 of file TCanvas.hxx.

Member Function Documentation

◆ AddPanel()

template<class PANEL >
bool ROOT::Experimental::TCanvas::AddPanel ( std::shared_ptr< PANEL > &  panel)
inline

Insert panel into the canvas, canvas should be shown at this moment.

Definition at line 122 of file TCanvas.hxx.

◆ Create()

std::shared_ptr< ROOT::Experimental::TCanvas > TCanvas::Create ( const std::string &  title)
static

Definition at line 63 of file TCanvas.cxx.

◆ GetAttrTable() [1/6]

Internal::TDrawingAttrTable<TColor>& ROOT::Experimental::TCanvas::GetAttrTable ( TColor )
inlineprivate

Attribute table (non-const access).

Definition at line 74 of file TCanvas.hxx.

◆ GetAttrTable() [2/6]

Internal::TDrawingAttrTable<long long>& ROOT::Experimental::TCanvas::GetAttrTable ( long long *  )
inlineprivate

Definition at line 75 of file TCanvas.hxx.

◆ GetAttrTable() [3/6]

Internal::TDrawingAttrTable<double>& ROOT::Experimental::TCanvas::GetAttrTable ( double *  )
inlineprivate

Definition at line 76 of file TCanvas.hxx.

◆ GetAttrTable() [4/6]

const Internal::TDrawingAttrTable<TColor>& ROOT::Experimental::TCanvas::GetAttrTable ( TColor ) const
inlineprivate

Attribute table (const access).

Definition at line 79 of file TCanvas.hxx.

◆ GetAttrTable() [5/6]

const Internal::TDrawingAttrTable<long long>& ROOT::Experimental::TCanvas::GetAttrTable ( long long *  ) const
inlineprivate

Definition at line 80 of file TCanvas.hxx.

◆ GetAttrTable() [6/6]

const Internal::TDrawingAttrTable<double>& ROOT::Experimental::TCanvas::GetAttrTable ( double *  ) const
inlineprivate

Definition at line 81 of file TCanvas.hxx.

◆ GetCanvas() [1/2]

const TCanvas& ROOT::Experimental::TCanvas::GetCanvas ( ) const
inlineoverridevirtual

Access to the top-most canvas, if any (const version).

Implements ROOT::Experimental::TPadBase.

Definition at line 96 of file TCanvas.hxx.

◆ GetCanvas() [2/2]

TCanvas& ROOT::Experimental::TCanvas::GetCanvas ( )
inlineoverridevirtual

Access to the top-most canvas, if any (non-const version).

Implements ROOT::Experimental::TPadBase.

Definition at line 99 of file TCanvas.hxx.

◆ GetCanvases()

const std::vector< std::shared_ptr< ROOT::Experimental::TCanvas > > & TCanvas::GetCanvases ( )
static

Definition at line 35 of file TCanvas.cxx.

◆ GetSize()

const std::array<TPadCoord::Pixel, 2>& ROOT::Experimental::TCanvas::GetSize ( ) const
inline

Return canvas pixel size as array with two elements - width and height.

Definition at line 102 of file TCanvas.hxx.

◆ GetTitle()

const std::string& ROOT::Experimental::TCanvas::GetTitle ( ) const
inline

Get the canvas's title.

Definition at line 140 of file TCanvas.hxx.

◆ Hide()

void TCanvas::Hide ( )

Close all canvas displays.

Definition at line 107 of file TCanvas.cxx.

◆ IsModified()

bool TCanvas::IsModified ( ) const

Definition at line 46 of file TCanvas.cxx.

◆ Modified()

void ROOT::Experimental::TCanvas::Modified ( )
inline

Definition at line 128 of file TCanvas.hxx.

◆ operator=()

TCanvas& ROOT::Experimental::TCanvas::operator= ( const TCanvas )
privatedelete

Disable assignment for now.

◆ PixelsToNormal()

std::array<TPadCoord::Normal, 2> ROOT::Experimental::TCanvas::PixelsToNormal ( const std::array< TPadCoord::Pixel, 2 > &  pos) const
inlinefinalvirtual

Convert a Pixel position to Canvas-normalized positions.

Implements ROOT::Experimental::TPadBase.

Definition at line 146 of file TCanvas.hxx.

◆ SaveAs()

void TCanvas::SaveAs ( const std::string &  filename,
bool  async = false,
CanvasCallback_t  callback = nullptr 
)

Save canvas in image file.

Definition at line 113 of file TCanvas.cxx.

◆ SetSize() [1/2]

void ROOT::Experimental::TCanvas::SetSize ( const std::array< TPadCoord::Pixel, 2 > &  sz)
inline

Set canvas pixel size as array with two elements - width and height.

Definition at line 105 of file TCanvas.hxx.

◆ SetSize() [2/2]

void ROOT::Experimental::TCanvas::SetSize ( const TPadCoord::Pixel width,
const TPadCoord::Pixel height 
)
inline

Set canvas pixel size - width and height.

Definition at line 108 of file TCanvas.hxx.

◆ SetTitle()

void ROOT::Experimental::TCanvas::SetTitle ( const std::string &  title)
inline

Set the canvas's title.

Definition at line 143 of file TCanvas.hxx.

◆ Show()

void TCanvas::Show ( const std::string &  where = "")

Display the canvas.

Create new display for the canvas Parameter.

where specifies which program could be used for display creation
Possible values:
 cef - Chromium Embeded Framework, local display, local communication
 qt5 - Qt5 WebEngine (when running via rootqt5), local display, local communication
browser - default system web-browser, communication via random http port from range 8800 - 9800 <prog> - any program name which will be started instead of default browser, like firefox or /usr/bin/opera one could also specify $url in program name, which will be replaced with canvas URL native - either any available local display or default browser

Canvas can be displayed in several different places

Definition at line 85 of file TCanvas.cxx.

◆ Update()

void TCanvas::Update ( bool  async = false,
CanvasCallback_t  callback = nullptr 
)

update drawing

Definition at line 51 of file TCanvas.cxx.

Friends And Related Function Documentation

◆ ROOT::Experimental::TDrawingAttrRef

template<class PRIMITIVE >
friend class ROOT::Experimental::TDrawingAttrRef
friend

Definition at line 85 of file TCanvas.hxx.

◆ ROOT::Experimental::TDrawingOptsBaseNoDefault

Definition at line 83 of file TCanvas.hxx.

Member Data Documentation

◆ fColorTable

Internal::TDrawingAttrTable<TColor> ROOT::Experimental::TCanvas::fColorTable
private

Colors used by drawing options in the pad and any sub-pad.

Definition at line 48 of file TCanvas.hxx.

◆ fFPAttrTable

Internal::TDrawingAttrTable<double> ROOT::Experimental::TCanvas::fFPAttrTable
private

Floating points used by drawing options in the pad and any sub-pad.

Definition at line 54 of file TCanvas.hxx.

◆ fIntAttrTable

Internal::TDrawingAttrTable<long long> ROOT::Experimental::TCanvas::fIntAttrTable
private

Integers used by drawing options in the pad and any sub-pad.

Definition at line 51 of file TCanvas.hxx.

◆ fModified

uint64_t ROOT::Experimental::TCanvas::fModified
private

Modify counter, incremented every time canvas is changed.

!

Definition at line 57 of file TCanvas.hxx.

◆ fPainter

std::unique_ptr<Internal::TVirtualCanvasPainter> ROOT::Experimental::TCanvas::fPainter
private

The painter of this canvas, bootstrapping the graphics connection.

Unmapped canvases (those that never had Draw() invoked) might not have a painter. !

Definition at line 62 of file TCanvas.hxx.

◆ fSize

std::array<TPadCoord::Pixel, 2> ROOT::Experimental::TCanvas::fSize
private

Size of the canvas in pixels,.

Definition at line 45 of file TCanvas.hxx.

◆ fTitle

std::string ROOT::Experimental::TCanvas::fTitle
private

Title of the canvas.

Definition at line 42 of file TCanvas.hxx.

Libraries for ROOT::Experimental::TCanvas:
[legend]

The documentation for this class was generated from the following files: