ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
greyscale.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphics
3
/// \notebook
4
/// \preview Create grey scale of 200x200 boxes.
5
///
6
/// \macro_image
7
/// \macro_code
8
///
9
/// \author Olivier Couet
10
11
void
greyscale()
12
{
13
TCanvas
*
c
=
new
TCanvas
(
"grey"
,
"Grey Scale"
, 500, 500);
14
c
->SetBorderMode(0);
15
16
Int_t
n
= 200;
// tunable parameter
17
Float_t
n1 = 1. /
n
;
18
for
(
int
i = 0; i <
n
; i++) {
19
for
(
int
j = 0; j <
n
; j++) {
20
TBox
*
b
=
new
TBox
(n1 * j, n1 * (
n
- 1 - i), n1 * (j + 1), n1 * (
n
- i));
21
Float_t
grey =
Float_t
(i *
n
+ j) / (
n
*
n
);
22
b
->SetFillColor(
TColor::GetColor
(grey, grey, grey));
23
b
->Draw();
24
}
25
}
26
TPad
*p =
new
TPad
(
"p"
,
"p"
, 0.3, 0.3, 0.7, 0.7);
27
const
char
*guibackground =
gEnv
->GetValue(
"Gui.BackgroundColor"
,
""
);
28
p->
SetFillColor
(
TColor::GetColor
(guibackground));
29
p->
Draw
();
30
p->
cd
();
31
TText
*t =
new
TText
(0.5, 0.5,
"GUI Background Color"
);
32
t->
SetTextAlign
(22);
33
t->
SetTextSize
(.09);
34
t->
Draw
();
35
36
c
->SetEditable(
kFALSE
);
37
}
b
#define b(i)
Definition
RSha256.hxx:100
c
#define c(i)
Definition
RSha256.hxx:101
Int_t
int Int_t
Signed integer 4 bytes (int).
Definition
RtypesCore.h:59
kFALSE
constexpr Bool_t kFALSE
Definition
RtypesCore.h:108
Float_t
float Float_t
Float 4 bytes (float).
Definition
RtypesCore.h:71
gEnv
externTEnv * gEnv
Definition
TEnv.h:170
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition
TAttFill.h:40
TAttText::SetTextAlign
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition
TAttText.h:48
TAttText::SetTextSize
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition
TAttText.h:53
TBox
Create a Box.
Definition
TBox.h:22
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TColor::GetColor
static Int_t GetColor(const char *hexcolor)
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition
TObject.cxx:293
TPad
The most important graphics class in the ROOT system.
Definition
TPad.h:28
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition
TPad.cxx:694
TPad::Draw
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition
TPad.cxx:1512
TText
Definition
TText.h:22
n
const Int_t n
Definition
legend1.C:16
tutorials
visualisation
graphics
greyscale.C
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1