Skip to content
Snippets Groups Projects
Commit 87ca73cc authored by Timur Pocheptsov's avatar Timur Pocheptsov
Browse files

Missing includes.

parent 49598253
No related branches found
No related tags found
No related merge requests found
......@@ -23,17 +23,17 @@ void grad2()
//to avoid possible conflicts with other tutorials.
Color_t freeIndices[4] = {};
if (ROOT::GLTutorials::FindFreeCustomColorIndices(freeIndices) != 4) {
Error("grad2", "can not allocate new custom colors");
::Error("grad2", "can not allocate new custom colors");
return;
}
//Make sure canvas supports OpenGL.
gStyle->SetCanvasPreferGL(kTRUE);
//'Aliases' (instead of freeIndices[someIndex])
const Color_t customRed = freeIndices[0], grad1 = freeIndices[1];
const Color_t customGreen = freeIndices[2], grad2 = freeIndices[3];
//Make sure canvas supports OpenGL.
gStyle->SetCanvasPreferGL(kTRUE);
//2. Check that we have a canvas with an OpenGL support.
TCanvas * const cnv = new TCanvas("gradiend demo 2", "gradient demo 2", 100, 100, 800, 600);
if (!cnv->UseGL()) {
......@@ -63,7 +63,7 @@ void grad2()
typedef TColorGradient::Point Point;
//Starting and ending points for a gradient fill (it's a vertical gradient):
gradFill1->SetStartEnd(Point(0., 0.), Point(0., 1));
gradFill1->SetStartEnd(Point(0., 0.), Point(0., 1.));
// c) Custom semi-transparent green.
new TColor(customGreen, 0., 1., 0., "green", 0.5);
......@@ -73,10 +73,10 @@ void grad2()
TLinearGradient * const gradFill2 = new TLinearGradient(grad2, 2, locations, idx2);
//Vertical gradient fill.
gradFill2->SetStartEnd(Point(0., 0), Point(0., 1.));
gradFill2->SetStartEnd(Point(0., 0.), Point(0., 1.));
TH1F * hist = new TH1F("a2", "b2", 10, -2., 3.);
TH1F * hist2 = new TH1F("c3", "d3", 10, -3., 3.);
TH1F * const hist = new TH1F("a2", "b2", 10, -2., 3.);
TH1F * const hist2 = new TH1F("c3", "d3", 10, -3., 3.);
hist->FillRandom("landau", 100000);
hist2->FillRandom("gaus", 100000);
......
......@@ -9,7 +9,6 @@
//Includes for ACLiC:
#include "TColorGradient.h"
#include "TCanvas.h"
#include "TError.h"
......@@ -40,7 +39,6 @@ void gradients()
gStyle->SetCanvasPreferGL(kTRUE);
//Create a canvas to check if we have a right back-end which supports gradients:
TCanvas * const c = new TCanvas("cpie","Gradient colours demo", 700, 700);
//Before we allocated any new colour or created any object:
if (!c->UseGL()) {
......@@ -49,8 +47,6 @@ void gradients()
return;
}
c->cd();
//Linear gradient is defined by: 1) colors (to interpolate between them),
//2) coordinates for these colors along the gradient axis [0., 1.] (must be sorted!).
//3) Start and end points for a gradient, you specify them in some NDC rect ([0,0 - 1,1]),
......@@ -69,19 +65,19 @@ void gradients()
0.8, 1., 0.9, 1. /*pale green*/};
TLinearGradient * const gradientFill1 = new TLinearGradient(linearFill, 2, locations, rgbaData1);
//45 degrees:
gradientFill1->SetStartEnd(TColorGradient::Point(0, 0), TColorGradient::Point(1, 1));
gradientFill1->SetStartEnd(TColorGradient::Point(0., 0.), TColorGradient::Point(1., 1.));
//Set as a background color in the canvas:
c->SetFillColor(linearFill);
//Draw a text in the canvas (the object above the text will be
//semi-transparent):
TText * t = new TText(0.05, 0.7, "Can you see the text?");
TText * const t = new TText(0.05, 0.7, "Can you see the text?");
t->Draw();
//We create a nested pad on top to render a TPie in,
//this way we still have a text (below) + TPie with
//a fancy colour on top.
TPad * pad = new TPad("p", "p", 0., 0., 1., 1.);
TPad * const pad = new TPad("p", "p", 0., 0., 1., 1.);
//TPad itself is fully transparent:
new TColor(transparentFill, 1., 1., 1., "transparent_fill_color", 0.);
......@@ -112,7 +108,7 @@ void gradients()
Int_t colors[nSlices] = {radialFill, radialFill, radialFill,
radialFill, radialFill};
TPie *pie = new TPie("pie", "TPie:", nSlices, values, colors);
TPie * const pie = new TPie("pie", "TPie:", nSlices, values, colors);
//One slice is slightly shifted:
pie->SetEntryRadiusOffset(2, 0.05);
//Move labels to the center (to fit the pad's space):
......
......@@ -12,12 +12,11 @@
#include "TParallelCoordVar.h"
#include "TParallelCoord.h"
#include "TVirtualX.h"
#include "TNtuple.h"
#include "TCanvas.h"
#include "TRandom.h"
#include "TColor.h"
#include "Rtypes.h"
#include "TStyle.h"
#include "TError.h"
#include "TList.h"
#include "TROOT.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment