Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-16 09:22:47

0001 // @(#)root/gpad:$Id$
0002 // Author: Sergey Linev   1/04/2026
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TPadPainterBase
0013 #define ROOT_TPadPainterBase
0014 
0015 #include "TVirtualPadPainter.h"
0016 #include "TAttFill.h"
0017 #include "TAttLine.h"
0018 #include "TAttMarker.h"
0019 #include "TAttText.h"
0020 
0021 class TPadPainterBase : public TVirtualPadPainter {
0022 protected:
0023    TAttFill   fAttFill;   ///< current fill attributes
0024    TAttLine   fAttLine;   ///< current line attributes
0025    TAttMarker fAttMarker; ///< current marker attributes
0026    TAttText   fAttText;   ///< current text attributes
0027    Bool_t      fFullyTransparent = kFALSE; ///< if transformed fill attributes fully transparent
0028 
0029    TAttFill   GetAttFillInternal(Bool_t with_transparency);
0030 
0031 public:
0032 
0033    /// _____________________________________________________________________
0034    /// old methods only for backward compatibility
0035 
0036    //Line attributes to be set up in TPad.
0037    Color_t  GetLineColor() const override { return fAttLine.GetLineColor(); }
0038    Style_t  GetLineStyle() const override { return fAttLine.GetLineStyle(); }
0039    Width_t  GetLineWidth() const override { return fAttLine.GetLineWidth(); }
0040 
0041    void     SetLineColor(Color_t lcolor) override { fAttLine.SetLineColor(lcolor); SetAttLine(fAttLine); }
0042    void     SetLineStyle(Style_t lstyle) override { fAttLine.SetLineStyle(lstyle); SetAttLine(fAttLine); }
0043    void     SetLineWidth(Width_t lwidth) override { fAttLine.SetLineWidth(lwidth); SetAttLine(fAttLine); }
0044 
0045    //Fill attributes to be set up in TPad.
0046    Color_t  GetFillColor() const  override { return fAttFill.GetFillColor(); }
0047    Style_t  GetFillStyle() const override { return fAttFill.GetFillStyle(); }
0048    Bool_t   IsTransparent() const override { return fAttFill.IsTransparent(); }
0049 
0050    void     SetFillColor(Color_t fcolor) override { fAttFill.SetFillColor(fcolor); SetAttFill(fAttFill); }
0051    void     SetFillStyle(Style_t fstyle) override { fAttFill.SetFillStyle(fstyle); SetAttFill(fAttFill); }
0052 
0053    //Text attributes.
0054    Short_t  GetTextAlign() const override { return fAttText.GetTextAlign(); }
0055    Float_t  GetTextAngle() const override { return fAttText.GetTextAngle(); }
0056    Color_t  GetTextColor() const override { return fAttText.GetTextColor(); }
0057    Font_t   GetTextFont() const override { return fAttText.GetTextFont(); }
0058    Float_t  GetTextSize() const override { return fAttText.GetTextSize(); }
0059    Float_t  GetTextMagnitude() const override { return 1.; }
0060 
0061    void     SetTextAlign(Short_t align) override { fAttText.SetTextAlign(align); SetAttText(fAttText); }
0062    void     SetTextAngle(Float_t tangle) override { fAttText.SetTextAngle(tangle); SetAttText(fAttText); }
0063    void     SetTextColor(Color_t tcolor) override { fAttText.SetTextColor(tcolor); SetAttText(fAttText); }
0064    void     SetTextFont(Font_t tfont) override { fAttText.SetTextFont(tfont); SetAttText(fAttText); }
0065    void     SetTextSize(Float_t tsize) override { fAttText.SetTextSize(tsize); SetAttText(fAttText); }
0066    void     SetTextSizePixels(Int_t npixels) override { fAttText.SetTextSizePixels(npixels); SetAttText(fAttText); }
0067 
0068    //Marker attributes
0069    Color_t  GetMarkerColor() const override { return fAttMarker.GetMarkerColor(); }
0070    Style_t  GetMarkerStyle() const override { return fAttMarker.GetMarkerStyle(); }
0071    Size_t   GetMarkerSize()  const override { return fAttMarker.GetMarkerSize(); }
0072 
0073    void     SetMarkerColor(Color_t mcolor) override { fAttMarker.SetMarkerColor(mcolor); SetAttMarker(fAttMarker); }
0074    void     SetMarkerStyle(Style_t mstyle) override { fAttMarker.SetMarkerStyle(mstyle); SetAttMarker(fAttMarker); }
0075    void     SetMarkerSize(Size_t msize) override { fAttMarker.SetMarkerSize(msize); SetAttMarker(fAttMarker); }
0076 
0077   /// _____________________________________________________________________
0078 
0079    const TAttFill    &GetAttFill() const override { return fAttFill; }
0080    const TAttLine    &GetAttLine() const override { return fAttLine; }
0081    const TAttMarker  &GetAttMarker()const override { return fAttMarker; }
0082    const TAttText    &GetAttText() const override { return fAttText; }
0083 
0084    void SetAttFill(const TAttFill &att) override
0085    {
0086       if (&att != &fAttFill)
0087          att.Copy(fAttFill);
0088    }
0089 
0090    void SetAttLine(const TAttLine &att) override
0091    {
0092       if (&att != &fAttLine)
0093          att.Copy(fAttLine);
0094    }
0095 
0096    void SetAttMarker(const TAttMarker &att) override
0097    {
0098       if (&att != &fAttMarker)
0099          att.Copy(fAttMarker);
0100    }
0101 
0102    void SetAttText(const TAttText &att) override
0103    {
0104       if (&att != &fAttText)
0105          att.Copy(fAttText);
0106    }
0107 
0108    ClassDefOverride(TPadPainterBase, 0)//Pad painter with attributes handling
0109 };
0110 
0111 #endif