A demo to show transparency with TMultiGraph (and a really interesting curve/equation).
Point compression in TPadPainter. You can see all three flowers ONLY with Cocoa (transparency).
#include <cassert>
#include <vector>
namespace {
typedef std::vector<Double_t> vector_type;
typedef vector_type::size_type size_type;
void create_flower(vector_type &xs, vector_type &ys, size_type nPoints,
Double_t r)
{
assert(nPoints > 100 && "create_flower, number of points is too small");
xs.resize(nPoints + 1);
ys.resize(nPoints + 1);
for (size_type i = 0; i <= nPoints; ++i) {
r * (1 +
TMath::Sin(11 * u / 5)) - 4 * p4 * p4 * p4 * p4 * p8 * p8 * p8 * p8 * p8 * p8 * p8 * p8;
}
}
}
void flower()
{
::Error(
"flower",
"failed to create custom colors");
return;
}
TCanvas *
const cnv =
new TCanvas(
"Chrysanthemum",
"Chrysanthemum", 900, 900);
::Error(
"flower",
"This macro requires OS X version of ROOT with cocoa enabled");
delete cnv;
return;
}
vector_type xs, ys;
create_flower(xs, ys, 300, 6);
new TColor(indices[0], 0., 0., 0.5,
"custom_blue", 0.7);
create_flower(xs, ys, 500000, 8);
new TColor(indices[1], 0.5, 0., 0.5,
"custom_purple", 0.5);
create_flower(xs, ys, 100000, 10);
new TColor(indices[2], 1., 0., 0.4,
"custom_magenta", 0.2);
}
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
void SetName(const char *name="") override
Set the name of the TNamed.
void SetTitle(const char *title="") override
Set the title of the TNamed.
virtual void Add(TGraph *graph, Option_t *chopt="")
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
unsigned FindFreeCustomColorIndices(Color_t(&indices)[N])
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.