20namespace Experimental {
38 std::array<RPadLength::Pixel, 2>
fSize;
46 std::unique_ptr<Internal::RVirtualCanvasPainter>
fPainter;
55 static std::shared_ptr<RCanvas>
Create(
const std::string &title);
68 const std::array<RPadLength::Pixel, 2> &
GetSize()
const {
return fSize; }
86 void Show(
const std::string &where =
"");
98 template <
class PANEL>
102 return fPainter->AddPanel(panel->GetWindow());
115 void Run(
double tm = 0.);
133 std::array<RPadLength::Normal, 2>
PixelsToNormal(
const std::array<RPadLength::Pixel, 2> &pos)
const final
135 return {{pos[0] /
fSize[0], pos[1] /
fSize[1]}};
138 static const std::vector<std::shared_ptr<RCanvas>>
GetCanvases();
include TDocParser_001 C image html pict1_TDocParser_001 png width
static const std::vector< std::shared_ptr< RCanvas > > GetCanvases()
RCanvas(const RCanvas &)=delete
Disable copy construction for now.
RCanvas * GetCanvas() override
Access to the top-most canvas, if any (non-const version).
const std::string & GetTitle() const
Get the canvas's title.
RCanvas & SetSize(const RPadLength::Pixel &width, const RPadLength::Pixel &height)
Set canvas pixel size - width and height.
RCanvas & SetTitle(const std::string &title)
Set the canvas's title.
RCanvas & SetSize(const std::array< RPadLength::Pixel, 2 > &sz)
Set canvas pixel size as array with two elements - width and height.
std::array< RPadLength::Normal, 2 > PixelsToNormal(const std::array< RPadLength::Pixel, 2 > &pos) const final
Convert a Pixel position to Canvas-normalized positions.
std::array< RPadLength::Pixel, 2 > fSize
Size of the canvas in pixels,.
bool IsModified() const
Returns true is canvas was modified since last painting.
const std::array< RPadLength::Pixel, 2 > & GetSize() const
Return canvas pixel size as array with two elements - width and height.
RCanvas & operator=(const RCanvas &)=delete
Disable assignment for now.
void Show(const std::string &where="")
Display the canvas.
std::string GetWindowAddr() const
Returns window name used to display canvas.
void Remove()
Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed.
void ResolveSharedPtrs()
To resolve problem with storing of shared pointers Call this method when reading canvas from the file...
void Run(double tm=0.)
Run canvas functionality for given time (in seconds)
std::string fTitle
used for primitives drawing
uint64_t fModified
Modify counter, incremented every time canvas is changed.
std::unique_ptr< Internal::RVirtualCanvasPainter > fPainter
The painter of this canvas, bootstrapping the graphics connection.
static std::shared_ptr< RCanvas > Create(const std::string &title)
RCanvas()=default
Create a temporary RCanvas; for long-lived ones please use Create().
const RCanvas * GetCanvas() const override
Access to the top-most canvas, if any (const version).
void Update(bool async=false, CanvasCallback_t callback=nullptr)
update drawing
void SaveAs(const std::string &filename, bool async=false, CanvasCallback_t callback=nullptr)
Save canvas in image file.
friend class RCanvasPainter
use for ID generation
bool AddPanel(std::shared_ptr< PANEL > &panel)
Insert panel into the canvas, canvas should be shown at this moment.
void Hide()
Hide all canvas displays.
Base class for graphic containers for RDrawable-s.
std::function< void(bool)> CanvasCallback_t