Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:18

0001 // @(#)root/gpad:$Id$
0002 // Author:  Olivier Couet, Timur Pocheptsov  06/05/2009
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2009, 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_TPadPainter
0013 #define ROOT_TPadPainter
0014 
0015 #include "TVirtualPadPainter.h"
0016 
0017 /*
0018 TVirtualPadPainter is an attempt to abstract
0019 painting operation furthermore. gVirtualX can
0020 be X11 or GDI, but pad painter can be gVirtualX (X11 or GDI),
0021 or gl pad painter.
0022 */
0023 
0024 class TVirtualPad;
0025 
0026 class TPadPainter : public TVirtualPadPainter {
0027 public:
0028    TPadPainter();
0029    //Final overriders for TVirtualPadPainter pure virtual functions.
0030    //1. Part, which simply delegates to TVirtualX.
0031 
0032    //Line attributes.
0033    Color_t  GetLineColor() const override;
0034    Style_t  GetLineStyle() const override;
0035    Width_t  GetLineWidth() const override;
0036 
0037    void     SetLineColor(Color_t lcolor) override;
0038    void     SetLineStyle(Style_t lstyle) override;
0039    void     SetLineWidth(Width_t lwidth) override;
0040 
0041    //Fill attributes.
0042    Color_t  GetFillColor() const override;
0043    Style_t  GetFillStyle() const override;
0044    Bool_t   IsTransparent() const override;
0045 
0046    void     SetFillColor(Color_t fcolor) override;
0047    void     SetFillStyle(Style_t fstyle) override;
0048    void     SetOpacity(Int_t percent) override;
0049 
0050    //Text attributes.
0051    Short_t  GetTextAlign() const override;
0052    Float_t  GetTextAngle() const override;
0053    Color_t  GetTextColor() const override;
0054    Font_t   GetTextFont()  const override;
0055    Float_t  GetTextSize()  const override;
0056    Float_t  GetTextMagnitude() const override;
0057 
0058    void     SetTextAlign(Short_t align) override;
0059    void     SetTextAngle(Float_t tangle) override;
0060    void     SetTextColor(Color_t tcolor) override;
0061    void     SetTextFont(Font_t tfont) override;
0062    void     SetTextSize(Float_t tsize) override;
0063    void     SetTextSizePixels(Int_t npixels) override;
0064 
0065    //2. "Off-screen management" part.
0066    Int_t    CreateDrawable(UInt_t w, UInt_t h) override;
0067    void     ClearDrawable() override;
0068    void     CopyDrawable(Int_t device, Int_t px, Int_t py) override;
0069    void     DestroyDrawable(Int_t device) override;
0070    void     SelectDrawable(Int_t device) override;
0071 
0072    //TASImage support (noop for a non-gl pad).
0073    void     DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
0074                        Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override;
0075 
0076    void     DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override;
0077    void     DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
0078 
0079    void     DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override;
0080 
0081    //TPad needs double and float versions.
0082    void     DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
0083    void     DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
0084 
0085    //TPad needs both double and float versions of DrawPolyLine.
0086    void     DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
0087    void     DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
0088    void     DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
0089 
0090    //TPad needs both versions.
0091    void     DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
0092    void     DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
0093 
0094    void     DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
0095    void     DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
0096    void     DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
0097    void     DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
0098 
0099    //jpg, png, bmp, gif output.
0100    void     SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
0101 
0102 private:
0103    //Let's make this clear:
0104    TPadPainter(const TPadPainter &) = delete;
0105    TPadPainter(TPadPainter &&) = delete;
0106    TPadPainter &operator=(const TPadPainter &) = delete;
0107    TPadPainter &operator=(TPadPainter &&) = delete;
0108 
0109    ClassDefOverride(TPadPainter, 0) //TPad painting
0110 };
0111 
0112 #endif