ROOT  6.06/09
Reference Guide
TPadPainter.h
Go to the documentation of this file.
1 // @(#)root/gpad:$Id$
2 // Author: Olivier Couet, Timur Pocheptsov 06/05/2009
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2009, 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_TPadPainter
13 #define ROOT_TPadPainter
14 
15 #ifndef ROOT_TVirtualPadPainter
16 #include "TVirtualPadPainter.h"
17 #endif
18 
19 /*
20 TVirtualPadPainter is an attempt to abstract
21 painting operation furthermore. gVirtualX can
22 be X11 or GDI, but pad painter can be gVirtualX (X11 or GDI),
23 or gl pad painter.
24 */
25 
26 class TVirtualPad;
27 
29 public:
30  TPadPainter();
31  //Final overriders for TVirtualPadPainter pure virtual functions.
32  //1. Part, which simply delegates to TVirtualX.
33  //Line attributes.
34  Color_t GetLineColor() const;
35  Style_t GetLineStyle() const;
36  Width_t GetLineWidth() const;
37 
38  void SetLineColor(Color_t lcolor);
39  void SetLineStyle(Style_t lstyle);
40  void SetLineWidth(Width_t lwidth);
41  //Fill attributes.
42  Color_t GetFillColor() const;
43  Style_t GetFillStyle() const;
44  Bool_t IsTransparent() const;
45 
46  void SetFillColor(Color_t fcolor);
47  void SetFillStyle(Style_t fstyle);
48  void SetOpacity(Int_t percent);
49  //Text attributes.
50  Short_t GetTextAlign() const;
51  Float_t GetTextAngle() const;
52  Color_t GetTextColor() const;
53  Font_t GetTextFont() const;
54  Float_t GetTextSize() const;
55  Float_t GetTextMagnitude() const;
56 
57  void SetTextAlign(Short_t align);
58  void SetTextAngle(Float_t tangle);
59  void SetTextColor(Color_t tcolor);
60  void SetTextFont(Font_t tfont);
61  void SetTextSize(Float_t tsize);
62  void SetTextSizePixels(Int_t npixels);
63  //2. "Off-screen management" part.
65  void ClearDrawable();
66  void CopyDrawable(Int_t id, Int_t px, Int_t py);
67  void DestroyDrawable();
68  void SelectDrawable(Int_t device);
69 
70  //TASImage support (noop for a non-gl pad).
71  void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
72  Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending);
73 
74 
76  void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2);
77 
78  void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode);
79  //TPad needs double and float versions.
80  void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y);
81  void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y);
82 
83  //TPad needs both double and float versions of DrawPolyLine.
84  void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y);
85  void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y);
86  void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v);
87 
88  //TPad needs both versions.
89  void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y);
90  void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y);
91 
92  void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode);
93  void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode);
94  void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode);
95  void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode);
96 
97  //jpg, png, bmp, gif output.
98  void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const;
99 
100 private:
101  //Let's make this clear:
102  TPadPainter(const TPadPainter &rhs) = delete;
103  TPadPainter(TPadPainter && rhs) = delete;
104  TPadPainter & operator = (const TPadPainter &rhs) = delete;
105  TPadPainter & operator = (TPadPainter && rhs) = delete;
106 
107  ClassDef(TPadPainter, 0) //Abstract interface for painting in TPad
108 };
109 
110 #endif
void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y)
Paint polymarker.
void CopyDrawable(Int_t id, Int_t px, Int_t py)
Copy a gVirtualX pixmap.
const Double_t * v1
Definition: TArcBall.cxx:33
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
Float_t GetTextMagnitude() const
Delegate to gVirtualX.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v)
Paint polyline in normalized coordinates.
TH1 * h
Definition: legend2.C:5
Float_t GetTextAngle() const
Delegate to gVirtualX.
void SetFillStyle(Style_t fstyle)
Delegate to gVirtualX.
void SetLineStyle(Style_t lstyle)
Delegate to gVirtualX.
void SelectDrawable(Int_t device)
Select the window in which the graphics will go.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Color_t GetTextColor() const
Delegate to gVirtualX.
void SetTextColor(Color_t tcolor)
Delegate to gVirtualX.
short Font_t
Definition: RtypesCore.h:75
void SetTextSizePixels(Int_t npixels)
Delegate to gVirtualX.
Style_t GetLineStyle() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:98
static const double x2[5]
void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y)
Paint filled area.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
Float_t GetTextSize() const
Delegate to gVirtualX.
void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode)
Paint text.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
void ClearDrawable()
Clear the current gVirtualX window.
short Color_t
Definition: RtypesCore.h:79
void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const
Save the image displayed in the canvas pointed by "pad" into a binary file.
void SetFillColor(Color_t fcolor)
Delegate to gVirtualX.
void SetTextAlign(Short_t align)
Delegate to gVirtualX.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode)
Paint a simple box.
void SetLineWidth(Width_t lwidth)
Delegate to gVirtualX.
SVector< double, 2 > v
Definition: Dict.h:5
void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending)
Noop, for non-gl pad TASImage calls gVirtualX->CopyArea.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
Paint a simple line in normalized coordinates.
void SetOpacity(Int_t percent)
Delegate to gVirtualX.
unsigned int UInt_t
Definition: RtypesCore.h:42
short Short_t
Definition: RtypesCore.h:35
short Width_t
Definition: RtypesCore.h:78
void DestroyDrawable()
Close the current gVirtualX pixmap.
TPadPainter & operator=(const TPadPainter &rhs)=delete
static const double x1[5]
double Double_t
Definition: RtypesCore.h:55
void SetTextAngle(Float_t tangle)
Delegate to gVirtualX.
TText * text
void SetTextSize(Float_t tsize)
Delegate to gVirtualX.
int type
Definition: TGX11.cxx:120
Double_t y[n]
Definition: legend1.C:17
Int_t CreateDrawable(UInt_t w, UInt_t h)
Create a gVirtualX Pixmap.
void SetLineColor(Color_t lcolor)
Delegate to gVirtualX.
Color_t GetFillColor() const
Delegate to gVirtualX.
Color_t GetLineColor() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:89
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode)
Paint text in normalized coordinates.
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Paint a simple line.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y)
Paint Polyline.
Width_t GetLineWidth() const
Delegate to gVirtualX.
Implement TVirtualPadPainter which abstracts painting operations.
Definition: TPadPainter.h:28
Short_t GetTextAlign() const
Delegate to gVirtualX.
Font_t GetTextFont() const
Delegate to gVirtualX.
const Int_t n
Definition: legend1.C:16
Style_t GetFillStyle() const
Delegate to gVirtualX.
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
void SetTextFont(Font_t tfont)
Delegate to gVirtualX.
Bool_t IsTransparent() const
Delegate to gVirtualX.