Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rtext_angle.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_rcanvas
3///
4/// This macro demonstrate the text attributes for RText. Angle, size and color are
5/// changed in a loop. The text alignment and the text font are fixed.
6///
7/// \macro_image (rcanvas_js)
8/// \macro_code
9///
10/// \date 2017-10-17
11/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
12/// is welcome!
13/// \author Olivier Couet <Olivier.Couet@cern.ch>
14
15/*************************************************************************
16 * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
17 * All rights reserved. *
18 * *
19 * For the licensing terms see $ROOTSYS/LICENSE. *
20 * For the list of contributors see $ROOTSYS/README/CREDITS. *
21 *************************************************************************/
22
23#include "ROOT/RCanvas.hxx"
24#include "ROOT/RColor.hxx"
25#include "ROOT/RText.hxx"
26#include "ROOT/RPadPos.hxx"
27
28using namespace ROOT::Experimental;
29
30void rtext_angle()
31{
32 // Create a canvas to be displayed.
33 auto canvas = RCanvas::Create("RText angle example");
34
35 for (double angle = 0; angle <= 360; angle += 10) {
36 auto draw = canvas->Draw<RText>(RPadPos(0.5_normal, 0.6_normal), "____ Hello World");
37
38 draw->text.color = RColor((int) (0.38*angle), (int) (0.64*angle), (int) (0.76*angle));
39 draw->text.size = 0.01 + angle/5000.;
40 draw->text.angle = angle;
41 draw->text.align = RAttrText::kLeftTop;
42 draw->text.font = RAttrFont::kArial;
43 }
44
45 canvas->Show();
46}
Option_t Option_t TPoint TPoint angle
The color class.
Definition RColor.hxx:33
A position (horizontal and vertical) in a RPad.
Definition RPadPos.hxx:28