Logo ROOT  
Reference Guide
greyscale.C File Reference

Detailed Description

View in nbviewer Open in SWAN Create grey scale of 200 x 200 boxes.

void greyscale()
TCanvas *c = new TCanvas("grey", "Grey Scale", 500, 500);
Int_t n = 200; // tunable parameter
Float_t n1 = 1./n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
TBox *b = new TBox(n1*j, n1*(n-1-i), n1*(j+1), n1*(n-i));
Float_t grey = Float_t(i*n+j)/(n*n);
b->SetFillColor(TColor::GetColor(grey, grey, grey));
TPad *p = new TPad("p","p",0.3, 0.3, 0.7,0.7);
const char *guibackground = gEnv->GetValue("Gui.BackgroundColor", "");
TText *t = new TText(0.5, 0.5, "GUI Background Color");
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
float Float_t
Definition: RtypesCore.h:57
R__EXTERN TEnv * gEnv
Definition: TEnv.h:170
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:42
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:47
Create a Box.
Definition: TBox.h:22
The Canvas class.
Definition: TCanvas.h:23
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition: TColor.cxx:1822
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
The most important graphics class in the ROOT system.
Definition: TPad.h:26
Base class for several text objects.
Definition: TText.h:22
const Int_t n
Definition: legend1.C:16
Olivier Couet

Definition in file greyscale.C.