Logo ROOT   6.08/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 #ifndef ROOT_Rtypes
16 #include "Rtypes.h"
17 #endif
18 
19 class TVirtualPad;
20 
22 public:
25 
26  virtual ~TVirtualPadPainter();
27 
28  //Line attributes to be set up in TPad.
29  virtual Color_t GetLineColor() const = 0;
30  virtual Style_t GetLineStyle() const = 0;
31  virtual Width_t GetLineWidth() const = 0;
32 
33  virtual void SetLineColor(Color_t lcolor) = 0;
34  virtual void SetLineStyle(Style_t lstyle) = 0;
35  virtual void SetLineWidth(Width_t lwidth) = 0;
36 
37  //Fill attributes to be set up in TPad.
38  virtual Color_t GetFillColor() const = 0;
39  virtual Style_t GetFillStyle() const = 0;
40  virtual Bool_t IsTransparent() const = 0;
41 
42  virtual void SetFillColor(Color_t fcolor) = 0;
43  virtual void SetFillStyle(Style_t fstyle) = 0;
44  virtual void SetOpacity(Int_t percent) = 0;
45 
46  //Text attributes.
47  virtual Short_t GetTextAlign() const = 0;
48  virtual Float_t GetTextAngle() const = 0;
49  virtual Color_t GetTextColor() const = 0;
50  virtual Font_t GetTextFont() const = 0;
51  virtual Float_t GetTextSize() const = 0;
52  virtual Float_t GetTextMagnitude() const = 0;
53 
54  virtual void SetTextAlign(Short_t align=11) = 0;
55  virtual void SetTextAngle(Float_t tangle=0) = 0;
56  virtual void SetTextColor(Color_t tcolor=1) = 0;
57  virtual void SetTextFont(Font_t tfont=62) = 0;
58  virtual void SetTextSize(Float_t tsize=1) = 0;
59  virtual void SetTextSizePixels(Int_t npixels) = 0;
60 
61  //This part is an interface to X11 pixmap management and to save sub-pads off-screens for OpenGL.
62  //Currently, must be implemented only for X11/GDI
63  virtual Int_t CreateDrawable(UInt_t w, UInt_t h) = 0;//gVirtualX->OpenPixmap
64  virtual void ClearDrawable() = 0;//gVirtualX->Clear()
65  virtual void CopyDrawable(Int_t device, Int_t px, Int_t py) = 0;
66  virtual void DestroyDrawable() = 0;//gVirtualX->CloseWindow
67  virtual void SelectDrawable(Int_t device) = 0;//gVirtualX->SelectWindow
68 
69  //TASImage support.
70  virtual void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
71  Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) = 0;
72  //
73  //These functions are not required by X11/GDI.
74  virtual void InitPainter();
75  virtual void InvalidateCS();
76  virtual void LockPainter();
77 
78  //Now, drawing primitives.
79  virtual void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2) = 0;
80  virtual void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) = 0;
81 
82  virtual void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) = 0;
83 
84  virtual void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) = 0;
85  virtual void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) = 0;
86 
87  virtual void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) = 0;
88  virtual void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) = 0;
89  virtual void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) = 0;
90 
91  virtual void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) = 0;
92  virtual void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) = 0;
93 
94  virtual void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) = 0;
95  virtual void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) = 0;
96  virtual void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) = 0;
97  virtual void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) = 0;
98 
99  //gif, jpg, png, bmp output.
100  virtual void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const = 0;
101 
102 
103  static TVirtualPadPainter *PadPainter(Option_t *opt = "");
104 
105  ClassDef(TVirtualPadPainter, 0)//Painter interface for pad.
106 };
107 
108 #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.
virtual void DestroyDrawable()=0
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:254
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:59
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.