Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
draw_text.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_v7
3///
4/// \macro_code
5///
6/// \date 2017-10-17
7/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
8/// is welcome!
9/// \author Olivier Couet <Olivier.Couet@cern.ch>
10
11/*************************************************************************
12 * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
13 * All rights reserved. *
14 * *
15 * For the licensing terms see $ROOTSYS/LICENSE. *
16 * For the list of contributors see $ROOTSYS/README/CREDITS. *
17 *************************************************************************/
18
19#include "ROOT/RCanvas.hxx"
20#include "ROOT/RColor.hxx"
21#include "ROOT/RText.hxx"
22#include "ROOT/RPadPos.hxx"
23
24void draw_text()
25{
26 using namespace ROOT::Experimental;
27
28 // Create a canvas to be displayed.
29 auto canvas = RCanvas::Create("Canvas Title");
30
31 for (int i=0; i<=360; i+=10) {
32 auto text = canvas->Draw<RText>(RPadPos(0.5_normal, 0.6_normal), "____ Hello World");
33
34 RColor col((int) (0.38*i), (int) (0.64*i), (int) (0.76*i));
35 text->AttrText().SetColor(col).SetSize(10+i/10).SetAngle(i).SetAlign(13).SetFont(42);
36 }
37
38 canvas->Show();
39}
The color class.
Definition RColor.hxx:35
A position (horizontal and vertical) in a RPad.
Definition RPadPos.hxx:28
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:197
TText * text