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  04/03/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_TPadPainterPS
0013 #define ROOT_TPadPainterPS
0014 
0015 #include "TPadPainterBase.h"
0016 
0017 /*
0018 TPadPainterPS is an attempt to abstract
0019 pad painting operation to the TVirtualPS interface.
0020 So using same API as for normal object drawing on interactive canvas,
0021 one also will be able to produce vector-based and binary images  */
0022 
0023 class TVirtualPad;
0024 class TVirtualPS;
0025 
0026 class TPadPainterPS : public TPadPainterBase {
0027 private:
0028    TVirtualPS    *fPS = nullptr;
0029    TVirtualPad   *fPad = nullptr;
0030 public:
0031    TPadPainterPS(TVirtualPS *ps);
0032 
0033    void     SetOpacity(Int_t percent) override;
0034 
0035    //Overall attributes
0036    void      SetAttFill(const TAttFill &att) override;
0037    void      SetAttLine(const TAttLine &att) override;
0038    void      SetAttMarker(const TAttMarker &att) override;
0039    void      SetAttText(const TAttText &att) override;
0040 
0041    //Final overriders for TVirtualPadPainter pure virtual functions.
0042    //1. Part, which simply delegates to TVirtualX.
0043 
0044    //2. "Off-screen management" part.
0045    Int_t    CreateDrawable(UInt_t w, UInt_t h) override;
0046    void     ClearDrawable() override;
0047    void     CopyDrawable(Int_t device, Int_t px, Int_t py) override;
0048    void     DestroyDrawable(Int_t device) override;
0049    void     SelectDrawable(Int_t device) override;
0050 
0051    void     NewPage() override;
0052 
0053    //TASImage support (noop for a non-gl pad).
0054    void     DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
0055                        Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override;
0056 
0057    void     DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override;
0058    void     DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
0059 
0060    void     DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override;
0061 
0062    //TPad needs double and float versions.
0063    void     DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
0064    void     DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
0065 
0066    //TPad needs both double and float versions of DrawPolyLine.
0067    void     DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
0068    void     DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
0069    void     DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
0070 
0071    void     DrawSegments(Int_t n, Double_t *x, Double_t *y) override;
0072    void     DrawSegmentsNDC(Int_t n, Double_t *u, Double_t *v) override;
0073 
0074    //TPad needs both versions.
0075    void     DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
0076    void     DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
0077 
0078    void     DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
0079    void     DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
0080    void     DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
0081    void     DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
0082 
0083    void     DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
0084 
0085    //jpg, png, bmp, gif output.
0086    void     SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
0087 
0088    void     OnPad(TVirtualPad *pad) override { fPad = pad; }
0089 
0090    TVirtualPS *GetPS() const override { return fPS; }
0091 
0092 
0093 private:
0094    //Let's make this clear:
0095    TPadPainterPS(const TPadPainterPS &) = delete;
0096    TPadPainterPS(TPadPainterPS &&) = delete;
0097    TPadPainterPS &operator=(const TPadPainterPS &) = delete;
0098    TPadPainterPS &operator=(TPadPainterPS &&) = delete;
0099 
0100    ClassDefOverride(TPadPainterPS, 0) //TPad painting with TVirtualPS interface
0101 };
0102 
0103 #endif