-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransparency.C
77 lines (68 loc) · 2.31 KB
/
transparency.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* @Description:
* @version:
* @Author: Hubery-Lee
* @E-mail: [email protected]
* @Date: 2022-10-15 20:07:02
* @LastEditTime: 2022-10-15 20:35:15
* @LastEditors: Hubery-Lee
*/
void transparency()
{
auto c1 = new TCanvas("c1", "c1",224,330,700,527);
c1->Range(-0.125,-0.125,1.125,1.125);
auto tex = new TLatex(0.06303724,0.0194223,"This text is opaque and this line is transparent");
tex->SetLineWidth(2);
tex->Draw();
auto arrow = new TArrow(0.5555158,0.07171314,0.8939828,0.6195219,0.05,"|>");
arrow->SetLineWidth(4);
arrow->SetAngle(30);
arrow->Draw();
// Draw a transparent graph.
Double_t x[10] = {
0.5232808, 0.8724928, 0.9280086, 0.7059456, 0.7399714,
0.4659742, 0.8241404, 0.4838825, 0.7936963, 0.743553};
Double_t y[10] = {
0.7290837, 0.9631474, 0.4775896, 0.6494024, 0.3555777,
0.622012, 0.7938247, 0.9482072, 0.3904382, 0.2410359};
auto graph = new TGraph(10,x,y);
graph->SetLineColorAlpha(46, 0.1);
graph->SetLineWidth(7);
graph->Draw("l");
// Draw an ellipse with opaque colors.
auto ellipse = new TEllipse(0.1740688,0.8352632,0.1518625,0.1010526,0,360,0);
ellipse->SetFillColor(30);
ellipse->SetLineColor(51);
ellipse->SetLineWidth(3);
ellipse->Draw();
// Draw an ellipse with transparent colors, above the previous one.
ellipse = new TEllipse(0.2985315,0.7092105,0.1566977,0.1868421,0,360,0);
ellipse->SetFillColorAlpha(9, 0.071);
ellipse->SetLineColorAlpha(8, 0.464);
ellipse->SetLineWidth(3);
ellipse->Draw();
// Draw a transparent blue text.
tex = new TLatex(0.04871059,0.1837649,"This text is transparent");
tex->SetTextColorAlpha(9, 0.476);
tex->SetTextSize(0.125);
tex->SetTextAngle(26.0);
tex->Draw();
// Draw two transparent markers
auto marker = new TMarker(0.03080229,0.998008,20);
marker->SetMarkerColorAlpha(2, .3);
marker->SetMarkerStyle(20);
marker->SetMarkerSize(1.7);
marker->Draw();
marker = new TMarker(0.1239255,0.8635458,20);
marker->SetMarkerColorAlpha(2, .2);
marker->SetMarkerStyle(20);
marker->SetMarkerSize(1.7);
marker->Draw();
// Draw an opaque marker
marker = new TMarker(0.3047994,0.6344622,20);
marker->SetMarkerColor(2);
marker->SetMarkerStyle(20);
marker->SetMarkerSize(1.7);
marker->Draw();
c1->Print("transparency.pdf");
}