Logo ROOT   6.12/07
Reference Guide
TVirtualPadPainter.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Timur Pocheptsov 6/5/2009
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2012, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TVirtualPadPainter
13 #define ROOT_TVirtualPadPainter
14 
15 #include "Rtypes.h"
16 
17 class TVirtualPad;
18 
20 public:
23 
24  virtual ~TVirtualPadPainter();
25 
26  //Line attributes to be set up in TPad.
27  virtual Color_t GetLineColor() const = 0;
28  virtual Style_t GetLineStyle() const = 0;
29  virtual Width_t GetLineWidth() const = 0;
30 
31  virtual void SetLineColor(Color_t lcolor) = 0;
32  virtual void SetLineStyle(Style_t lstyle) = 0;
33  virtual void SetLineWidth(Width_t lwidth) = 0;
34 
35  //Fill attributes to be set up in TPad.
36  virtual Color_t GetFillColor() const = 0;
37  virtual Style_t GetFillStyle() const = 0;
38  virtual Bool_t IsTransparent() const = 0;
39 
40  virtual void SetFillColor(Color_t fcolor) = 0;
41  virtual void SetFillStyle(Style_t fstyle) = 0;
42  virtual void SetOpacity(Int_t percent) = 0;
43 
44  //Text attributes.
45  virtual Short_t GetTextAlign() const = 0;
46  virtual Float_t GetTextAngle() const = 0;
47  virtual Color_t GetTextColor() const = 0;
48  virtual Font_t GetTextFont() const = 0;
49  virtual Float_t GetTextSize() const = 0;
50  virtual Float_t GetTextMagnitude() const = 0;
51 
52  virtual void SetTextAlign(Short_t align=11) = 0;
53  virtual void SetTextAngle(Float_t tangle=0) = 0;
54  virtual void SetTextColor(Color_t tcolor=1) = 0;
55  virtual void SetTextFont(Font_t tfont=62) = 0;
56  virtual void SetTextSize(Float_t tsize=1) = 0;
57  virtual void SetTextSizePixels(Int_t npixels) = 0;
58 
59  //This part is an interface to X11 pixmap management and to save sub-pads off-screens for OpenGL.
60  //Currently, must be implemented only for X11/GDI
61  virtual Int_t CreateDrawable(UInt_t w, UInt_t h) = 0;//gVirtualX->OpenPixmap
62  virtual void ClearDrawable() = 0;//gVirtualX->Clear()
63  virtual void CopyDrawable(Int_t device, Int_t px, Int_t py) = 0;
64  virtual void DestroyDrawable(Int_t device) = 0;//gVirtualX->CloseWindow
65  virtual void SelectDrawable(Int_t device) = 0;//gVirtualX->SelectWindow
66 
67  //TASImage support.
68  virtual void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
69  Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) = 0;
70  //
71  //These functions are not required by X11/GDI.
72  virtual void InitPainter();
73  virtual void InvalidateCS();
74  virtual void LockPainter();
75 
76  //Now, drawing primitives.
77  virtual void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) = 0;
78  virtual void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) = 0;
79 
80  virtual void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) = 0;
81 
82  virtual void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) = 0;
83  virtual void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) = 0;
84 
85  virtual void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) = 0;
86  virtual void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) = 0;
87  virtual void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) = 0;
88 
89  virtual void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) = 0;
90  virtual void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) = 0;
91 
92  virtual void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) = 0;
93  virtual void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) = 0;
94  virtual void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) = 0;
95  virtual void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) = 0;
96 
97  //gif, jpg, png, bmp output.
98  virtual void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const = 0;
99 
100 
101  static TVirtualPadPainter *PadPainter(Option_t *opt = "");
102 
103  ClassDef(TVirtualPadPainter, 0)//Painter interface for pad.
104 };
105 
106 #endif
virtual void SetOpacity(Int_t percent)=0
virtual void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v)=0
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
virtual void SetTextSizePixels(Int_t npixels)=0
virtual Float_t GetTextMagnitude() const =0
TH1 * h
Definition: legend2.C:5
static TVirtualPadPainter * PadPainter(Option_t *opt="")
Create a pad painter of specified type.
int Int_t
Definition: RtypesCore.h:41
virtual Int_t CreateDrawable(UInt_t w, UInt_t h)=0
bool Bool_t
Definition: RtypesCore.h:59
virtual void InitPainter()
Empty definition.
virtual void SetLineWidth(Width_t lwidth)=0
short Font_t
Definition: RtypesCore.h:75
virtual void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode)=0
virtual Style_t GetFillStyle() const =0
virtual void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const =0
virtual Bool_t IsTransparent() const =0
virtual void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode)=0
static const double x2[5]
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)=0
virtual Float_t GetTextSize() const =0
virtual Width_t GetLineWidth() const =0
virtual void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode)=0
virtual void SetLineStyle(Style_t lstyle)=0
virtual void SetTextFont(Font_t tfont=62)=0
virtual void SetFillColor(Color_t fcolor)=0
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:49
virtual void DestroyDrawable(Int_t device)=0
short Color_t
Definition: RtypesCore.h:79
virtual Short_t GetTextAlign() const =0
virtual void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y)=0
SVector< double, 2 > v
Definition: Dict.h:5
virtual void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)=0
virtual ~TVirtualPadPainter()
Virtual dtor.
virtual Font_t GetTextFont() const =0
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void SetLineColor(Color_t lcolor)=0
short Short_t
Definition: RtypesCore.h:35
short Width_t
Definition: RtypesCore.h:78
virtual void SelectDrawable(Int_t device)=0
virtual Color_t GetTextColor() const =0
virtual Color_t GetFillColor() const =0
virtual void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y)=0
virtual void SetTextAlign(Short_t align=11)=0
static const double x1[5]
double Double_t
Definition: RtypesCore.h:55
TText * text
virtual void SetTextColor(Color_t tcolor=1)=0
int type
Definition: TGX11.cxx:120
Double_t y[n]
Definition: legend1.C:17
virtual void SetTextSize(Float_t tsize=1)=0
virtual Style_t GetLineStyle() const =0
virtual void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y)=0
virtual void LockPainter()
Empty definition.
virtual void InvalidateCS()
Empty definition.
virtual void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending)=0
virtual Float_t GetTextAngle() const =0
virtual void ClearDrawable()=0
virtual void SetFillStyle(Style_t fstyle)=0
virtual void SetTextAngle(Float_t tangle=0)=0
virtual void CopyDrawable(Int_t device, Int_t px, Int_t py)=0
const Int_t n
Definition: legend1.C:16
virtual Color_t GetLineColor() const =0
To make it possible to use GL for 2D graphic in a TPad/TCanvas.