Logo ROOT   6.18/05
Reference Guide
box.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_v7
3///
4/// This ROOT 7 example demonstrates how to create a ROOT 7 canvas (RCanvas) and
5/// draw ROOT 7 boxes in it (RBox). It generates a set of boxes using the
6/// "normal" coordinates' system.
7///
8/// \macro_image
9/// \macro_code
10///
11/// \date 2018-10-10
12/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
13/// is welcome!
14/// \author Olivier couet
15
16R__LOAD_LIBRARY(libROOTGpadv7)
17
18#include "ROOT/RCanvas.hxx"
19#include "ROOT/RColor.hxx"
20#include "ROOT/RBox.hxx"
21#include <ROOT/RPadPos.hxx>
22#include "TMath.h"
23
24void box()
25{
26 using namespace ROOT::Experimental;
27
28 // Create a canvas to be displayed.
29 auto canvas = RCanvas::Create("Canvas Title");
30
31 auto OptsBox1 = canvas->Draw(RBox({0.1_normal, 0.3_normal}, {0.3_normal,0.6_normal}));
32 RColor Color1(1., 0., 0., 0.5); // 50% opaque
33 RColor Color2(0., 0., 1., 0.3); // 30% opaque
34
35 OptsBox1->Border().SetColor(Color1).SetWidth(5);
36 //OptsBox1->Fill().SetColor(Color2);
37
38 auto OptsBox2 = canvas->Draw(RBox({0.4_normal, 0.2_normal}, {0.6_normal,0.7_normal}));
39 OptsBox2->Border().SetColor(Color2).SetStyle(2).SetWidth(3);
40 //OptsBox2->Fill().SetStyle(0);
41
42 auto OptsBox3 = canvas->Draw(RBox({0.7_normal, 0.4_normal}, {0.9_normal,0.6_normal}));
43 //OptsBox3->SetFillStyle(0);
44 //OptsBox3->SetRoundWidth(50);
45 //OptsBox3->SetRoundHeight(50);
46 OptsBox3->Border().SetWidth(3);
47
48 auto OptsBox4 = canvas->Draw(RBox({0.7_normal, 0.7_normal}, {0.9_normal,0.9_normal}));
49 //OptsBox4->SetFillStyle(0);
50 //OptsBox4->SetRoundWidth(50);
51 //OptsBox4->SetRoundHeight(25);
52 OptsBox4->Border().SetWidth(3);
53
54 auto OptsBox5 = canvas->Draw(RBox({0.7_normal, 0.1_normal}, {0.9_normal,0.3_normal}));
55 //OptsBox5->SetFillStyle(0);
56 //OptsBox5->SetRoundWidth(25);
57 //OptsBox5->SetRoundHeight(50);
58 OptsBox5->Border().SetWidth(3);
59
60 canvas->Show();
61}
#define R__LOAD_LIBRARY(LIBRARY)
Definition: Rtypes.h:473
A color: Red|Green|Blue|Alpha, or a position in a RPalette.
Definition: RColor.hxx:28
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1