Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::Experimental::RCanvas Class Reference

A window's topmost RPad.

Author
Axel Naumann axel@.nosp@m.cern.nosp@m..ch
Date
2015-07-08
Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

Definition at line 47 of file RCanvas.hxx.

Public Types

using Primitives_t = std::vector<std::shared_ptr<RDrawable>>
using Version_t = uint64_t

Public Member Functions

 RCanvas ()
 Create a temporary RCanvas; for long-lived ones please use Create().
 ~RCanvas () override=default
template<class T, class... ARGS>
std::shared_ptr< T > Add (ARGS... args)
 Add drawable of specified class T.
std::shared_ptr< RFrameAddFrame ()
 Add a frame object for the pad.
std::shared_ptr< RPadAddPad (const RPadPos &, const RPadExtent &)
 Add subpad.
template<class PANEL>
bool AddPanel (std::shared_ptr< PANEL > &panel)
 Insert panel into the canvas, canvas should be shown at this moment.
void ClearOnClose (const std::shared_ptr< void > &handle)
 Set handle which will be cleared when connection is closed.
void ClearShown ()
 clear IsShown() flag
void ClearStyle ()
void ClearUpdated ()
 clear IsUpdated() flag
std::string CreateJSON ()
 Provide JSON which can be used for offline display.
std::vector< std::vector< std::shared_ptr< RPad > > > Divide (int nHoriz, int nVert, const RPadExtent &padding={})
 Divide this pad into a grid of subpads with padding in between.
template<class T, class... ARGS>
std::shared_ptr< T > Draw (ARGS... args)
 Create drawable of specified class T.
template<class T, class... ARGS>
auto Draw (const std::shared_ptr< T > &what, ARGS... args)
 Add object to be painted.
std::shared_ptr< RDrawableDraw (std::shared_ptr< RDrawable > &&drawable)
 Add existing drawable instance to canvas.
const RPadBaseFindPadForPrimitiveWithDisplayId (const std::string &display_id) const
 Find subpad which contains primitive with given display id.
std::shared_ptr< RDrawableFindPrimitive (const std::string &id) const
 Find primitive with specified id.
std::shared_ptr< RDrawableFindPrimitiveByDisplayId (const std::string &display_id) const
 Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification of objects.
const RCanvasGetCanvas () const override
 Access to the top-most canvas, if any (const version).
RCanvasGetCanvas () override
 Access to the top-most canvas, if any (non-const version).
const std::string & GetCssClass () const
const char * GetCssType () const
std::shared_ptr< RFrameGetFrame ()
 Get a frame object if exists.
const std::shared_ptr< RFrameGetFrame () const
 Get a frame object if exists.
int GetHeight () const
 Get canvas height.
const std::string & GetId () const
uint64_t GetModified () const
 Get modify counter.
Internal::RVirtualCanvasPainterGetPainter ()
std::shared_ptr< RDrawableGetPrimitive (unsigned num) const
 returns primitive of given number
auto GetPrimitives () const
 Get all primitives contained in the pad.
const std::string & GetTitle () const
 Get the canvas's title.
std::string GetUID () const
 Return unique identifier for the canvas Used in iPython display.
int GetWidth () const
 Get canvas width.
std::shared_ptr< RWebWindowGetWindow ()
 Returns window handle for the canvas.
std::string GetWindowAddr () const
 Returns window name used to display canvas.
std::string GetWindowUrl (bool remote)
 Returns window URL which can be used for connection.
void Hide ()
 Hide all canvas displays.
bool IsModified () const
 Returns true is canvas was modified since last painting.
bool IsShown () const
 returns true if Show() method was called
bool IsUpdated () const
 returns true if Update() method was called
void Modified ()
void Modified (std::shared_ptr< RDrawable > drawable)
 Set newest version to specified drawable.
unsigned NumPrimitives () const
 returns number of primitives in the pad
void Remove ()
 Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed.
bool Remove (const std::shared_ptr< RDrawable > &drawable)
 Remove drawable from list of primitives.
bool Remove (const std::string &id)
 Remove an object from the list of primitives.
bool RemoveAt (unsigned indx)
 Remove drawable at specified position.
void ResolveSharedPtrs ()
 To resolve problem with storing of shared pointers Call this method when reading canvas from the file Can be called many times - after reinitialization of shared pointers no changes will be performed.
void Run (double tm=0.)
 Run canvas functionality for given time (in seconds).
bool SaveAs (const std::string &filename)
 Save canvas in image file.
void SetCssClass (const std::string &cl)
void SetHeight (int height)
 Set canvas height.
void SetId (const std::string &id)
void SetSize (int width, int height)
 Set canvas pixel size - width and height.
RCanvasSetTitle (const std::string &title)
 Set the canvas's title.
void SetWidth (int width)
 Set canvas width.
void Show (const std::string &where="")
 Display the canvas.
void Update (bool async=false, CanvasCallback_t callback=nullptr)
 update drawing
void UseStyle (const std::shared_ptr< RStyle > &style) override
 Use provided style for pad and all primitives inside.
void Wipe ()
 Wipe the pad by clearing the list of primitives.

Static Public Member Functions

static std::shared_ptr< RCanvasCreate (const std::string &title)
 Create new canvas instance.
static const std::vector< std::shared_ptr< RCanvas > > GetCanvases ()
 Returns list of created canvases.
static void ReleaseHeldCanvases ()
 Release list of held canvases pointers If no other shared pointers exists on the canvas, object will be destroyed.

Protected Member Functions

void CollectShared (Internal::RIOSharedVector_t &) override
 Collect all shared items to resolve shared_ptr after IO.
virtual std::unique_ptr< RDisplayItemDisplay (const RDisplayContext &)
 Creates display item for drawable By default item contains drawable data itself.
void DisplayPrimitives (RPadBaseDisplayItem &paditem, RDisplayContext &ctxt)
 Create display items for all primitives in the pad Each display item gets its special id, which used later for client-server communication Second parameter is version id which already delivered to the client.
virtual void Execute (const std::string &)
RAttrMapGetAttrMap ()
const RAttrMapGetAttrMap () const
Version_t GetVersion () const
virtual bool IsFrameRequired () const
bool MatchSelector (const std::string &selector) const
 Preliminary method which checks if drawable matches with given selector Following selector are allowed: "type" or "#id" or ".class_name" Here type is drawable kind like 'rect' or 'pad' id is drawable identifier, specified with RDrawable::SetId() method class_name is drawable class name, specified with RDrawable::SetCssClass() method.
virtual void OnDisplayItemDestroyed (RDisplayItem *) const
virtual void PopulateMenu (RMenuItems &)
void SetCssType (const char *csstype)
void SetDrawableVersion (Version_t vers) override
 Assign drawable version - for pad itself and all primitives.

Private Types

using Primitive_t = Internal::RIOShared<RDrawable>

Private Member Functions

 RCanvas (const RCanvas &)=delete
 Disable copy construction for now.
uint64_t IncModified ()
RCanvasoperator= (const RCanvas &)=delete
 Disable assignment for now.
void TestIfFrameRequired (const RDrawable *drawable)

Private Attributes

RAttrMap fAttr
 attributes values
std::string fCssClass
 user-defined CSS class, used for RStyle
const char * fCssType {nullptr}
 ! drawable type, not stored in the root file, must be initialized in constructor
int fHeight {0}
 Height of the canvas in pixels.
std::string fId
 user-defined CSS id, used for RStyle
Version_t fModified {1}
 Modify counter, incremented every time canvas is changed.
std::unique_ptr< Internal::RVirtualCanvasPainterfPainter
 The painter of this canvas, bootstrapping the graphics connection.
std::vector< Primitive_tfPrimitives
 Content of the pad.
bool fShown {false}
 indicate if Show() method was called before
std::weak_ptr< RStylefStyle
 ! style applied for RDrawable, not stored when canvas is saved
std::string fTitle
 to apply attributes changes
bool fUpdated {false}
 indicate if Update() method was called before
Version_t fVersion {1}
 ! drawable version, changed from the canvas
int fWidth {0}
 Width of the canvas in pixels.

Friends

class RCanvasPainter
 use for ID generation
class RChangeAttrRequest
 used for primitives drawing
class RPadBase

#include <ROOT/RCanvas.hxx>

Inheritance diagram for ROOT::Experimental::RCanvas:
ROOT::Experimental::RPadBase ROOT::Experimental::RDrawable

Member Typedef Documentation

◆ Primitive_t

Definition at line 41 of file RPadBase.hxx.

◆ Primitives_t

using ROOT::Experimental::RPadBase::Primitives_t = std::vector<std::shared_ptr<RDrawable>>
inherited

Definition at line 71 of file RPadBase.hxx.

◆ Version_t

using ROOT::Experimental::RDrawable::Version_t = uint64_t
inherited

Definition at line 123 of file RDrawable.hxx.

Constructor & Destructor Documentation

◆ RCanvas() [1/2]

ROOT::Experimental::RCanvas::RCanvas ( const RCanvas & )
privatedelete

Disable copy construction for now.

◆ RCanvas() [2/2]

ROOT::Experimental::RCanvas::RCanvas ( )
inline

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

Definition at line 88 of file RCanvas.hxx.

◆ ~RCanvas()

ROOT::Experimental::RCanvas::~RCanvas ( )
overridedefault

Member Function Documentation

◆ Add()

template<class T, class... ARGS>
std::shared_ptr< T > ROOT::Experimental::RPadBase::Add ( ARGS... args)
inlineinherited

Add drawable of specified class T.

Definition at line 108 of file RPadBase.hxx.

◆ AddFrame()

std::shared_ptr< RFrame > RPadBase::AddFrame ( )
inherited

Add a frame object for the pad.

If frame already exists - just return it

Definition at line 189 of file RPadBase.cxx.

◆ AddPad()

std::shared_ptr< RPad > RPadBase::AddPad ( const RPadPos & pos,
const RPadExtent & extent )
inherited

Add subpad.

Definition at line 138 of file RPadBase.cxx.

◆ AddPanel()

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

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

Definition at line 143 of file RCanvas.hxx.

◆ ClearOnClose()

void ROOT::Experimental::RCanvas::ClearOnClose ( const std::shared_ptr< void > & handle)

Set handle which will be cleared when connection is closed.

Definition at line 249 of file RCanvas.cxx.

◆ ClearShown()

void ROOT::Experimental::RCanvas::ClearShown ( )
inline

clear IsShown() flag

Definition at line 123 of file RCanvas.hxx.

◆ ClearStyle()

void ROOT::Experimental::RDrawable::ClearStyle ( )
inlineinherited

Definition at line 213 of file RDrawable.hxx.

◆ ClearUpdated()

void ROOT::Experimental::RCanvas::ClearUpdated ( )
inline

clear IsUpdated() flag

Definition at line 173 of file RCanvas.hxx.

◆ CollectShared()

void RPadBase::CollectShared ( Internal::RIOSharedVector_t & vect)
overrideprotectedvirtualinherited

Collect all shared items to resolve shared_ptr after IO.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 226 of file RPadBase.cxx.

◆ Create()

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

Create new canvas instance.

Definition at line 89 of file RCanvas.cxx.

◆ CreateJSON()

std::string ROOT::Experimental::RCanvas::CreateJSON ( )

Provide JSON which can be used for offline display.

Create JSON data for the canvas Can be used of offline display with JSROOT.

Definition at line 221 of file RCanvas.cxx.

◆ Display()

std::unique_ptr< RDisplayItem > RDrawable::Display ( const RDisplayContext & ctxt)
protectedvirtualinherited

Creates display item for drawable By default item contains drawable data itself.

Reimplemented in ROOT::Experimental::RPad, and ROOT::Experimental::TObjectDrawable.

Definition at line 68 of file RDrawable.cxx.

◆ DisplayPrimitives()

void RPadBase::DisplayPrimitives ( RPadBaseDisplayItem & paditem,
RDisplayContext & ctxt )
protectedinherited

Create display items for all primitives in the pad Each display item gets its special id, which used later for client-server communication Second parameter is version id which already delivered to the client.

Definition at line 112 of file RPadBase.cxx.

◆ Divide()

std::vector< std::vector< std::shared_ptr< RPad > > > RPadBase::Divide ( int nHoriz,
int nVert,
const RPadExtent & padding = {} )
inherited

Divide this pad into a grid of subpads with padding in between.

Divide pad on nHoriz X nVert subpads Return array of array of pads.

Parameters
nHorizNumber of horizontal pads.
nVertNumber of vertical pads.
paddingPadding between pads.
Returns
vector of vector (ret[x][y]) of created pads.

Definition at line 154 of file RPadBase.cxx.

◆ Draw() [1/3]

template<class T, class... ARGS>
std::shared_ptr< T > ROOT::Experimental::RPadBase::Draw ( ARGS... args)
inlineinherited

Create drawable of specified class T.

Definition at line 95 of file RPadBase.hxx.

◆ Draw() [2/3]

template<class T, class... ARGS>
auto ROOT::Experimental::RPadBase::Draw ( const std::shared_ptr< T > & what,
ARGS... args )
inlineinherited

Add object to be painted.

Correspondent drawable will be created via GetDrawable() function which should be defined and be accessed at calling time. If required, extra arguments for GetDrawable() function can be provided.

Definition at line 81 of file RPadBase.hxx.

◆ Draw() [3/3]

std::shared_ptr< RDrawable > ROOT::Experimental::RPadBase::Draw ( std::shared_ptr< RDrawable > && drawable)
inlineinherited

Add existing drawable instance to canvas.

Definition at line 120 of file RPadBase.hxx.

◆ Execute()

void RDrawable::Execute ( const std::string & exec)
protectedvirtualinherited

Reimplemented in ROOT::Experimental::TObjectDrawable.

Definition at line 40 of file RDrawable.cxx.

◆ FindPadForPrimitiveWithDisplayId()

const RPadBase * RPadBase::FindPadForPrimitiveWithDisplayId ( const std::string & display_id) const
inherited

Find subpad which contains primitive with given display id.

Definition at line 87 of file RPadBase.cxx.

◆ FindPrimitive()

std::shared_ptr< RDrawable > RPadBase::FindPrimitive ( const std::string & id) const
inherited

Find primitive with specified id.

Definition at line 40 of file RPadBase.cxx.

◆ FindPrimitiveByDisplayId()

std::shared_ptr< RDrawable > RPadBase::FindPrimitiveByDisplayId ( const std::string & display_id) const
inherited

Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification of objects.

Definition at line 64 of file RPadBase.cxx.

◆ GetAttrMap() [1/2]

RAttrMap & ROOT::Experimental::RDrawable::GetAttrMap ( )
inlineprotectedinherited

Definition at line 185 of file RDrawable.hxx.

◆ GetAttrMap() [2/2]

const RAttrMap & ROOT::Experimental::RDrawable::GetAttrMap ( ) const
inlineprotectedinherited

Definition at line 186 of file RDrawable.hxx.

◆ GetCanvas() [1/2]

const RCanvas * ROOT::Experimental::RCanvas::GetCanvas ( ) const
inlineoverridevirtual

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

Implements ROOT::Experimental::RPadBase.

Definition at line 92 of file RCanvas.hxx.

◆ GetCanvas() [2/2]

RCanvas * ROOT::Experimental::RCanvas::GetCanvas ( )
inlineoverridevirtual

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

Implements ROOT::Experimental::RPadBase.

Definition at line 95 of file RCanvas.hxx.

◆ GetCanvases()

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

Returns list of created canvases.

Definition at line 45 of file RCanvas.cxx.

◆ GetCssClass()

const std::string & ROOT::Experimental::RDrawable::GetCssClass ( ) const
inlineinherited

Definition at line 218 of file RDrawable.hxx.

◆ GetCssType()

const char * ROOT::Experimental::RDrawable::GetCssType ( ) const
inlineinherited

Definition at line 215 of file RDrawable.hxx.

◆ GetFrame() [1/2]

std::shared_ptr< RFrame > RPadBase::GetFrame ( )
inherited

Get a frame object if exists.

Definition at line 214 of file RPadBase.cxx.

◆ GetFrame() [2/2]

const std::shared_ptr< RFrame > RPadBase::GetFrame ( ) const
inherited

Get a frame object if exists.

Definition at line 202 of file RPadBase.cxx.

◆ GetHeight()

int ROOT::Experimental::RCanvas::GetHeight ( ) const
inline

Get canvas height.

Definition at line 114 of file RCanvas.hxx.

◆ GetId()

const std::string & ROOT::Experimental::RDrawable::GetId ( ) const
inlineinherited

Definition at line 221 of file RDrawable.hxx.

◆ GetModified()

uint64_t ROOT::Experimental::RCanvas::GetModified ( ) const
inline

Get modify counter.

Definition at line 150 of file RCanvas.hxx.

◆ GetPainter()

Internal::RVirtualCanvasPainter * ROOT::Experimental::RCanvas::GetPainter ( )

◆ GetPrimitive()

std::shared_ptr< RDrawable > ROOT::Experimental::RPadBase::GetPrimitive ( unsigned num) const
inlineinherited

returns primitive of given number

Definition at line 135 of file RPadBase.hxx.

◆ GetPrimitives()

auto ROOT::Experimental::RPadBase::GetPrimitives ( ) const
inlineinherited

Get all primitives contained in the pad.

Definition at line 148 of file RPadBase.hxx.

◆ GetTitle()

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

Get the canvas's title.

Definition at line 187 of file RCanvas.hxx.

◆ GetUID()

std::string ROOT::Experimental::RCanvas::GetUID ( ) const

Return unique identifier for the canvas Used in iPython display.

Definition at line 209 of file RCanvas.cxx.

◆ GetVersion()

Version_t ROOT::Experimental::RDrawable::GetVersion ( ) const
inlineprotectedinherited

Definition at line 197 of file RDrawable.hxx.

◆ GetWidth()

int ROOT::Experimental::RCanvas::GetWidth ( ) const
inline

Get canvas width.

Definition at line 111 of file RCanvas.hxx.

◆ GetWindow()

std::shared_ptr< ROOT::RWebWindow > ROOT::Experimental::RCanvas::GetWindow ( )

Returns window handle for the canvas.

Definition at line 170 of file RCanvas.cxx.

◆ GetWindowAddr()

std::string ROOT::Experimental::RCanvas::GetWindowAddr ( ) const

Returns window name used to display canvas.

Returns window name for canvas.

Definition at line 147 of file RCanvas.cxx.

◆ GetWindowUrl()

std::string ROOT::Experimental::RCanvas::GetWindowUrl ( bool remote)

Returns window URL which can be used for connection.

Returns window URL which can be used for connection See ROOT::RWebWindow::GetUrl docu for more details.

Definition at line 159 of file RCanvas.cxx.

◆ Hide()

void ROOT::Experimental::RCanvas::Hide ( )

Hide all canvas displays.

Definition at line 181 of file RCanvas.cxx.

◆ IncModified()

uint64_t ROOT::Experimental::RCanvas::IncModified ( )
inlineprivate

Definition at line 82 of file RCanvas.hxx.

◆ IsFrameRequired()

virtual bool ROOT::Experimental::RDrawable::IsFrameRequired ( ) const
inlineprotectedvirtualinherited

Reimplemented in ROOT::Experimental::RPaletteDrawable.

Definition at line 183 of file RDrawable.hxx.

◆ IsModified()

bool ROOT::Experimental::RCanvas::IsModified ( ) const

Returns true is canvas was modified since last painting.

Definition at line 70 of file RCanvas.cxx.

◆ IsShown()

bool ROOT::Experimental::RCanvas::IsShown ( ) const
inline

returns true if Show() method was called

Definition at line 120 of file RCanvas.hxx.

◆ IsUpdated()

bool ROOT::Experimental::RCanvas::IsUpdated ( ) const
inline

returns true if Update() method was called

Definition at line 170 of file RCanvas.hxx.

◆ MatchSelector()

bool RDrawable::MatchSelector ( const std::string & selector) const
protectedinherited

Preliminary method which checks if drawable matches with given selector Following selector are allowed: "type" or "#id" or ".class_name" Here type is drawable kind like 'rect' or 'pad' id is drawable identifier, specified with RDrawable::SetId() method class_name is drawable class name, specified with RDrawable::SetCssClass() method.

Definition at line 59 of file RDrawable.cxx.

◆ Modified() [1/2]

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

Definition at line 153 of file RCanvas.hxx.

◆ Modified() [2/2]

void ROOT::Experimental::RCanvas::Modified ( std::shared_ptr< RDrawable > drawable)
inline

Set newest version to specified drawable.

Definition at line 156 of file RCanvas.hxx.

◆ NumPrimitives()

unsigned ROOT::Experimental::RPadBase::NumPrimitives ( ) const
inlineinherited

returns number of primitives in the pad

Definition at line 132 of file RPadBase.hxx.

◆ OnDisplayItemDestroyed()

virtual void ROOT::Experimental::RDrawable::OnDisplayItemDestroyed ( RDisplayItem * ) const
inlineprotectedvirtualinherited

Definition at line 194 of file RDrawable.hxx.

◆ operator=()

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

Disable assignment for now.

◆ PopulateMenu()

void RDrawable::PopulateMenu ( RMenuItems & items)
protectedvirtualinherited

Reimplemented in ROOT::Experimental::RFrame, and ROOT::Experimental::TObjectDrawable.

Definition at line 30 of file RDrawable.cxx.

◆ ReleaseHeldCanvases()

void ROOT::Experimental::RCanvas::ReleaseHeldCanvases ( )
static

Release list of held canvases pointers If no other shared pointers exists on the canvas, object will be destroyed.

Definition at line 56 of file RCanvas.cxx.

◆ Remove() [1/3]

void ROOT::Experimental::RCanvas::Remove ( )

Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed.

Remove canvas from global canvas lists, will be destroyed once last shared_ptr is disappear.

Definition at line 235 of file RCanvas.cxx.

◆ Remove() [2/3]

bool ROOT::Experimental::RPadBase::Remove ( const std::shared_ptr< RDrawable > & drawable)
inlineinherited

Remove drawable from list of primitives.

Definition at line 169 of file RPadBase.hxx.

◆ Remove() [3/3]

bool ROOT::Experimental::RPadBase::Remove ( const std::string & id)
inlineinherited

Remove an object from the list of primitives.

Definition at line 157 of file RPadBase.hxx.

◆ RemoveAt()

bool ROOT::Experimental::RPadBase::RemoveAt ( unsigned indx)
inlineinherited

Remove drawable at specified position.

Definition at line 181 of file RPadBase.hxx.

◆ ResolveSharedPtrs()

void ROOT::Experimental::RCanvas::ResolveSharedPtrs ( )

To resolve problem with storing of shared pointers Call this method when reading canvas from the file Can be called many times - after reinitialization of shared pointers no changes will be performed.

Definition at line 309 of file RCanvas.cxx.

◆ Run()

void ROOT::Experimental::RCanvas::Run ( double tm = 0.)

Run canvas functionality for given time (in seconds).

Run canvas functionality for the given time (in seconds) Used to process canvas-related actions in the appropriate thread context.

Must be regularly called when canvas created and used in extra thread. Time parameter specifies minimal execution time in seconds - if default value 0 is used, just all pending actions will be performed. When canvas is not yet displayed - just performs sleep for given time interval.

Example of usage:

void draw_canvas(bool &run_loop, std::make_shared<RH1D> hist)
{
auto canvas = RCanvas::Create("Canvas title");
canvas->Draw(hist)->SetLineColor(RColor::kBlue);
canvas->Show();
while (run_loop) {
pHist->Fill(1);
canvas->Modified();
canvas->Update();
canvas->Run(0.1); // process canvas events
}
canvas->Remove();
}
int main()
{
RAxisConfig xaxis(100, -10., 10.);
auto pHist = std::make_shared<RH1D>(xaxis);
bool run_loop = true;
std::thread thrd(draw_canvas, run_loop, pHist);
std::this_thread::sleep_for(std::chrono::seconds(100));
run_loop = false;
thrd.join();
return 0;
}
int main()
Definition Prototype.cxx:12
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
Definition RCanvas.cxx:89
static R__DLLEXPORT constexpr RGB_t kBlue
Definition RColor.hxx:186

Definition at line 295 of file RCanvas.cxx.

◆ SaveAs()

bool ROOT::Experimental::RCanvas::SaveAs ( const std::string & filename)

Save canvas in image file.

Create image file for the canvas Supported SVG (extension .svg), JPEG (extension .jpg or .jpeg), PNG (extension .png) or JSON (extension .json).

Definition at line 191 of file RCanvas.cxx.

◆ SetCssClass()

void ROOT::Experimental::RDrawable::SetCssClass ( const std::string & cl)
inlineinherited

Definition at line 217 of file RDrawable.hxx.

◆ SetCssType()

void ROOT::Experimental::RDrawable::SetCssType ( const char * csstype)
inlineprotectedinherited

Definition at line 192 of file RDrawable.hxx.

◆ SetDrawableVersion()

void RPadBase::SetDrawableVersion ( Version_t vers)
overrideprotectedvirtualinherited

Assign drawable version - for pad itself and all primitives.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 238 of file RPadBase.cxx.

◆ SetHeight()

void ROOT::Experimental::RCanvas::SetHeight ( int height)
inline

Set canvas height.

Definition at line 108 of file RCanvas.hxx.

◆ SetId()

void ROOT::Experimental::RDrawable::SetId ( const std::string & id)
inlineinherited

Definition at line 220 of file RDrawable.hxx.

◆ SetSize()

void ROOT::Experimental::RCanvas::SetSize ( int width,
int height )
inline

Set canvas pixel size - width and height.

Definition at line 98 of file RCanvas.hxx.

◆ SetTitle()

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

Set the canvas's title.

Definition at line 190 of file RCanvas.hxx.

◆ SetWidth()

void ROOT::Experimental::RCanvas::SetWidth ( int width)
inline

Set canvas width.

Definition at line 105 of file RCanvas.hxx.

◆ Show()

void ROOT::Experimental::RCanvas::Show ( const std::string & where = "")

Display the canvas.

Create new display for the canvas The parameter where specifies which program could be used for display creation Possible values:

  • cef Chromium Embeded Framework, local display, local communication
  • qt6 Qt6 WebEngine (when running via qt6web), 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 115 of file RCanvas.cxx.

◆ TestIfFrameRequired()

void ROOT::Experimental::RPadBase::TestIfFrameRequired ( const RDrawable * drawable)
inlineprivateinherited

Definition at line 53 of file RPadBase.hxx.

◆ Update()

void ROOT::Experimental::RCanvas::Update ( bool async = false,
CanvasCallback_t callback = nullptr )

update drawing

Update canvas.

Definition at line 78 of file RCanvas.cxx.

◆ UseStyle()

void RPadBase::UseStyle ( const std::shared_ptr< RStyle > & style)
overridevirtualinherited

Use provided style for pad and all primitives inside.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 30 of file RPadBase.cxx.

◆ Wipe()

void ROOT::Experimental::RPadBase::Wipe ( )
inlineinherited

Wipe the pad by clearing the list of primitives.

Definition at line 190 of file RPadBase.hxx.

◆ RCanvasPainter

friend class RCanvasPainter
friend

use for ID generation

Definition at line 49 of file RCanvas.hxx.

◆ RChangeAttrRequest

friend class RChangeAttrRequest
friend

used for primitives drawing

Definition at line 50 of file RCanvas.hxx.

◆ RPadBase

friend class RPadBase
friend

Definition at line 48 of file RCanvas.hxx.

Member Data Documentation

◆ fAttr

RAttrMap ROOT::Experimental::RDrawable::fAttr
privateinherited

attributes values

Definition at line 172 of file RDrawable.hxx.

◆ fCssClass

std::string ROOT::Experimental::RDrawable::fCssClass
privateinherited

user-defined CSS class, used for RStyle

Definition at line 175 of file RDrawable.hxx.

◆ fCssType

const char* ROOT::Experimental::RDrawable::fCssType {nullptr}
privateinherited

! drawable type, not stored in the root file, must be initialized in constructor

Definition at line 174 of file RDrawable.hxx.

◆ fHeight

int ROOT::Experimental::RCanvas::fHeight {0}
private

Height of the canvas in pixels.

Definition at line 59 of file RCanvas.hxx.

◆ fId

std::string ROOT::Experimental::RDrawable::fId
privateinherited

user-defined CSS id, used for RStyle

Definition at line 176 of file RDrawable.hxx.

◆ fModified

Version_t ROOT::Experimental::RCanvas::fModified {1}
private

Modify counter, incremented every time canvas is changed.

!

Definition at line 62 of file RCanvas.hxx.

◆ fPainter

std::unique_ptr<Internal::RVirtualCanvasPainter> ROOT::Experimental::RCanvas::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 67 of file RCanvas.hxx.

◆ fPrimitives

std::vector<Primitive_t> ROOT::Experimental::RPadBase::fPrimitives
privateinherited

Content of the pad.

Definition at line 45 of file RPadBase.hxx.

◆ fShown

bool ROOT::Experimental::RCanvas::fShown {false}
private

indicate if Show() method was called before

!

Definition at line 70 of file RCanvas.hxx.

◆ fStyle

std::weak_ptr<RStyle> ROOT::Experimental::RDrawable::fStyle
privateinherited

! style applied for RDrawable, not stored when canvas is saved

Definition at line 173 of file RDrawable.hxx.

◆ fTitle

std::string ROOT::Experimental::RCanvas::fTitle
private

to apply attributes changes

Title of the canvas.

Definition at line 53 of file RCanvas.hxx.

◆ fUpdated

bool ROOT::Experimental::RCanvas::fUpdated {false}
private

indicate if Update() method was called before

!

Definition at line 73 of file RCanvas.hxx.

◆ fVersion

Version_t ROOT::Experimental::RDrawable::fVersion {1}
privateinherited

! drawable version, changed from the canvas

Definition at line 177 of file RDrawable.hxx.

◆ fWidth

int ROOT::Experimental::RCanvas::fWidth {0}
private

Width of the canvas in pixels.

Definition at line 56 of file RCanvas.hxx.


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