Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

Fill Area Attributes class.

This class is used (in general by secondary inheritance) by many other classes (graphics, histograms). It holds all the fill area attributes.

Fill Area attributes

Fill Area attributes are:

Fill Area color

The fill area color is a color index (integer) pointing in the ROOT color table. The fill area color of any class inheriting from TAttFill can be changed using the method SetFillColor and retrieved using the method GetFillColor. The following table shows the first 50 default colors.

Color transparency

SetFillColorAlpha(), allows to set a transparent color. In the following example the fill color of the histogram histo is set to blue with a transparency of 35%. The color kBlue itself remains fully opaque.

histo->SetFillColorAlpha(kBlue, 0.35);
@ kBlue
Definition Rtypes.h:66

The transparency is available on all platforms when the flag OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc, or on Mac with the Cocoa backend. On the file output it is visible with PDF, PNG, Gif, JPEG, SVG, TeX... but not PostScript.

The ROOT Color Wheel.

The wheel contains the recommended 216 colors to be used in web applications. The colors in the Color Wheel are created by TColor::CreateColorWheel.

Using this color set for your text, background or graphics will give your application a consistent appearance across different platforms and browsers.

Colors are grouped by hue, the aspect most important in human perception Touching color chips have the same hue, but with different brightness and vividness.

Colors of slightly different hues clash. If you intend to display colors of the same hue together, you should pick them from the same group.

Each color chip is identified by a mnemonic (eg kYellow) and a number. The keywords, kRed, kBlue, kYellow, kPink, etc are defined in the header file Rtypes.h that is included in all ROOT other header files. We strongly recommend to use these keywords in your code instead of hardcoded color numbers, eg:

myObject.SetFillColor(kRed);
myObject.SetFillColor(kYellow-10);
myLine.SetLineColor(kMagenta+2);
@ kRed
Definition Rtypes.h:66
@ kMagenta
Definition Rtypes.h:66
@ kYellow
Definition Rtypes.h:66

Special case forcing black&white output.

If the current style fill area color is set to 0, then ROOT will force a black&white output for all objects with a fill area defined and independently of the object fill style.

Fill Area style

The fill area style defines the pattern used to fill a polygon. The fill area style of any class inheriting from TAttFill can be changed using the method SetFillStyle and retrieved using the method GetFillStyle.

Conventions for fill styles:

  • 0 : hollow
  • 1001 : Solid
  • 3000+pattern_number (see below)
  • For TPad only:
    • 4000 :the window is transparent.
    • 4000 to 4100 the window is 100% transparent to 100% opaque.

      The pad transparency is visible in binary outputs files like gif, jpg, png etc .. but not in vector graphics output files like PS, PDF and SVG. This convention (fill style > 4000) is kept for backward compatibility. It is better to use the color transparency instead.

pattern_number can have any value from 1 to 25 (see table), or any value from 100 to 999. For the latest the numbering convention is the following:

pattern_number = ijk (FillStyle = 3ijk)
i (1-9) : specify the space between each hatch
1 = 1/2mm 9 = 6mm
j (0-9) : specify angle between 0 and 90 degrees
0 = 0
1 = 10
2 = 20
3 = 30
4 = 45
5 = Not drawn
6 = 60
7 = 70
8 = 80
9 = 90
k (0-9) : specify angle between 90 and 180 degrees
0 = 180
1 = 170
2 = 160
3 = 150
4 = 135
5 = Not drawn
6 = 120
7 = 110
8 = 100
9 = 90
Option_t Option_t TPoint TPoint angle

The following table shows the list of pattern styles. The first table displays the 25 fixed patterns. They cannot be customized unlike the hatches displayed in the second table which be customized using:

  • gStyle->SetHatchesSpacing() to define the spacing between hatches.
  • gStyle->SetHatchesLineWidth() to define the hatches line width.

Definition at line 19 of file TAttFill.h.

Public Member Functions

 TAttFill ()
 AttFill default constructor.
 
 TAttFill (Color_t fcolor, Style_t fstyle)
 AttFill normal constructor.
 
virtual ~TAttFill ()
 AttFill destructor.
 
void Copy (TAttFill &attfill) const
 Copy this fill attributes to a new TAttFill.
 
virtual Color_t GetFillColor () const
 Return the fill area color.
 
virtual Style_t GetFillStyle () const
 Return the fill area style.
 
virtual TClassIsA () const
 
virtual Bool_t IsTransparent () const
 
virtual void Modify ()
 Change current fill area attributes if necessary.
 
virtual void ResetAttFill (Option_t *option="")
 Reset this fill attributes to default values.
 
virtual void SaveFillAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
 Save fill attributes as C++ statement(s) on output stream out.
 
virtual void SetFillAttributes ()
 Invoke the DialogCanvas Fill attributes.
 
virtual void SetFillColor (Color_t fcolor)
 Set the fill area color.
 
virtual void SetFillColorAlpha (Color_t fcolor, Float_t falpha)
 Set a transparent fill color.
 
virtual void SetFillStyle (Style_t fstyle)
 Set the fill area style.
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 

Protected Attributes

Color_t fFillColor
 Fill area color.
 
Style_t fFillStyle
 Fill area style.
 

#include <TAttFill.h>

Inheritance diagram for TAttFill:
[legend]

Constructor & Destructor Documentation

◆ TAttFill() [1/2]

TAttFill::TAttFill ( )

AttFill default constructor.

Default fill attributes are taking from the current style

Definition at line 176 of file TAttFill.cxx.

◆ TAttFill() [2/2]

TAttFill::TAttFill ( Color_t  color,
Style_t  style 
)

AttFill normal constructor.

  • color Fill Color
  • style Fill Style

Definition at line 188 of file TAttFill.cxx.

◆ ~TAttFill()

TAttFill::~TAttFill ( )
virtual

AttFill destructor.

Definition at line 197 of file TAttFill.cxx.

Member Function Documentation

◆ Class()

static TClass * TAttFill::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TAttFill::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TAttFill::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 41 of file TAttFill.h.

◆ Copy()

void TAttFill::Copy ( TAttFill attfill) const

Copy this fill attributes to a new TAttFill.

Definition at line 204 of file TAttFill.cxx.

◆ DeclFileName()

static const char * TAttFill::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 41 of file TAttFill.h.

◆ GetFillColor()

virtual Color_t TAttFill::GetFillColor ( ) const
inlinevirtual

Return the fill area color.

Reimplemented in TGraphMultiErrors, TGWin32VirtualXProxy, and TWebPadPainter.

Definition at line 30 of file TAttFill.h.

◆ GetFillStyle()

virtual Style_t TAttFill::GetFillStyle ( ) const
inlinevirtual

Return the fill area style.

Reimplemented in TGraphMultiErrors, TGWin32VirtualXProxy, and TWebPadPainter.

Definition at line 31 of file TAttFill.h.

◆ IsA()

virtual TClass * TAttFill::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Reimplemented in ROOT::Experimental::XRooFit::xRooHypoSpace, TMVA::TSpline1, TMVA::TSpline2, TStyle, TVirtualPad, TVirtualPS, TVirtualX, TGeoBatemanSol, TGeoMaterial, TGeoMixture, TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly, TGeoOverlap, TGCocoa, TGQuartz, TButton, TCanvas, TDialogCanvas, TGroupButton, TInspectCanvas, TPad, TPaveClass, TSlider, TSliderBox, TArc, TArrow, TBox, TCandle, TCrown, TCurlyArc, TCurlyLine, TCutG, TDiamond, TEllipse, TFrame, TGraphPolar, TGraphQQ, TLegend, TLegendEntry, TMathText, TPave, TPaveLabel, TPaveStats, TPavesText, TPaveText, TPieSlice, TPolyLine, TWbox, TGraphNode, TImageDump, TPDF, TPostScript, TSVG, TTeXDump, TGWin32, TGX11, TGX11TTF, TBRIK, TCONE, TCONS, TCTUB, TELTU, TGTRA, THYPE, TMarker3DBox, TMaterial, TMixture, TNode, TNodeDiv, TPARA, TPCON, TPGON, TShape, TSPHE, TTRAP, TTRD1, TTRD2, TTUBE, TTUBS, TXTRU, TGLTH3Composition, TWebPadPainter, TWebPS, THbookBranch, THbookTree, TEfficiency, TF1, TF12, TF2, TF3, TGraph, TGraph2D, TGraph2DAsymmErrors, TGraph2DErrors, TGraphAsymmErrors, TGraphBentErrors, TGraphErrors, TGraphMultiErrors, TH1, TH1C, TH1S, TH1I, TH1F, TH1D, TH1K, TH2, TH2C, TH2S, TH2I, TH2F, TH2D, TH2Poly, TH3, TH3C, TH3S, TH3I, TH3F, TH3D, TProfile, TProfile2D, TProfile2Poly, TProfile3D, TScatter, TSpline, TSpline3, TSpline5, ROOT::v5::TF1Data, TPaletteAxis, TProofChain, RooCurve, RooEllipse, RooHist, TBranch, TBranchClones, TBranchElement, TBranchObject, TBranchRef, TBranchSTL, TChain, TNtuple, TNtupleD, TTree, TTreeSQL, TParallelCoordVar, and TSpider.

Definition at line 41 of file TAttFill.h.

◆ IsTransparent()

Bool_t TAttFill::IsTransparent ( ) const
inlinevirtual

Reimplemented in TGWin32VirtualXProxy, and TWebPadPainter.

Definition at line 44 of file TAttFill.h.

◆ Modify()

void TAttFill::Modify ( )
virtual

Change current fill area attributes if necessary.

Definition at line 213 of file TAttFill.cxx.

◆ ResetAttFill()

void TAttFill::ResetAttFill ( Option_t option = "")
virtual

Reset this fill attributes to default values.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 227 of file TAttFill.cxx.

◆ SaveFillAttributes()

void TAttFill::SaveFillAttributes ( std::ostream &  out,
const char *  name,
Int_t  coldef = 1,
Int_t  stydef = 1001 
)
virtual

Save fill attributes as C++ statement(s) on output stream out.

Definition at line 236 of file TAttFill.cxx.

◆ SetFillAttributes()

void TAttFill::SetFillAttributes ( )
virtual

Invoke the DialogCanvas Fill attributes.

Reimplemented in TGWin32VirtualXProxy.

Definition at line 251 of file TAttFill.cxx.

◆ SetFillColor()

virtual void TAttFill::SetFillColor ( Color_t  fcolor)
inlinevirtual

Set the fill area color.

Reimplemented in TVirtualX, TGQuartz, TGWin32, TGWin32VirtualXProxy, TGX11, TPDF, TPostScript, TSVG, TTeXDump, TSpider, TGraphMultiErrors, and TWebPadPainter.

Definition at line 37 of file TAttFill.h.

◆ SetFillColorAlpha()

void TAttFill::SetFillColorAlpha ( Color_t  fcolor,
Float_t  falpha 
)
virtual

Set a transparent fill color.

falpha defines the percentage of the color opacity from 0. (fully transparent) to 1. (fully opaque).

Reimplemented in TGraphMultiErrors.

Definition at line 260 of file TAttFill.cxx.

◆ SetFillStyle()

virtual void TAttFill::SetFillStyle ( Style_t  fstyle)
inlinevirtual

Set the fill area style.

Reimplemented in TGraphMultiErrors, TPad, TWebPadPainter, TSpider, TVirtualX, TGQuartz, TGWin32, TGWin32VirtualXProxy, and TGX11.

Definition at line 39 of file TAttFill.h.

◆ Streamer()

virtual void TAttFill::Streamer ( TBuffer )
virtual

Reimplemented in ROOT::Experimental::XRooFit::xRooHypoSpace, TMVA::TSpline1, TMVA::TSpline2, TStyle, TVirtualPad, TVirtualPS, TVirtualX, TGeoBatemanSol, TGeoMaterial, TGeoMixture, TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly, TGeoOverlap, TGCocoa, TGQuartz, TButton, TCanvas, TDialogCanvas, TGroupButton, TInspectCanvas, TPad, TPaveClass, TSlider, TSliderBox, TArc, TArrow, TBox, TCandle, TCrown, TCurlyArc, TCurlyLine, TCutG, TDiamond, TEllipse, TFrame, TGraphPolar, TGraphQQ, TLegend, TLegendEntry, TMathText, TPave, TPaveLabel, TPaveStats, TPavesText, TPaveText, TPieSlice, TPolyLine, TWbox, TGraphNode, TImageDump, TPDF, TPostScript, TSVG, TTeXDump, TGWin32, TGX11, TGX11TTF, TBRIK, TCONE, TCONS, TCTUB, TELTU, TGTRA, THYPE, TMarker3DBox, TMaterial, TMixture, TNode, TNodeDiv, TPARA, TPCON, TPGON, TShape, TSPHE, TTRAP, TTRD1, TTRD2, TTUBE, TTUBS, TXTRU, TGLTH3Composition, TWebPadPainter, TWebPS, THbookBranch, THbookTree, TEfficiency, TF1, TF12, TF2, TF3, TGraph, TGraph2D, TGraph2DAsymmErrors, TGraph2DErrors, TGraphAsymmErrors, TGraphBentErrors, TGraphErrors, TGraphMultiErrors, TH1, TH1C, TH1S, TH1I, TH1F, TH1D, TH1K, TH2, TH2C, TH2S, TH2I, TH2F, TH2D, TH2Poly, TH3, TH3C, TH3S, TH3I, TH3F, TH3D, TProfile, TProfile2D, TProfile2Poly, TProfile3D, TScatter, TSpline, TSpline3, TSpline5, ROOT::v5::TF1Data, TPaletteAxis, TProofChain, RooCurve, RooEllipse, RooHist, TBranch, TBranchClones, TBranchElement, TBranchObject, TBranchRef, TBranchSTL, TChain, TNtuple, TNtupleD, TTree, TTreeSQL, TParallelCoordVar, and TSpider.

◆ StreamerNVirtual()

void TAttFill::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 41 of file TAttFill.h.

Member Data Documentation

◆ fFillColor

Color_t TAttFill::fFillColor
protected

Fill area color.

Definition at line 22 of file TAttFill.h.

◆ fFillStyle

Style_t TAttFill::fFillStyle
protected

Fill area style.

Definition at line 23 of file TAttFill.h.

  • core/base/inc/TAttFill.h
  • core/base/src/TAttFill.cxx