Logo ROOT  
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 #include "TVirtualPadPainter.h"
16 
17 /*
18 TVirtualPadPainter is an attempt to abstract
19 painting operation furthermore. gVirtualX can
20 be X11 or GDI, but pad painter can be gVirtualX (X11 or GDI),
21 or gl pad painter.
22 */
23 
24 class TVirtualPad;
25 
27 public:
28  TPadPainter();
29  //Final overriders for TVirtualPadPainter pure virtual functions.
30  //1. Part, which simply delegates to TVirtualX.
31  //Line attributes.
32  Color_t GetLineColor() const;
33  Style_t GetLineStyle() const;
34  Width_t GetLineWidth() const;
35 
36  void SetLineColor(Color_t lcolor);
37  void SetLineStyle(Style_t lstyle);
38  void SetLineWidth(Width_t lwidth);
39  //Fill attributes.
40  Color_t GetFillColor() const;
41  Style_t GetFillStyle() const;
42  Bool_t IsTransparent() const;
43 
44  void SetFillColor(Color_t fcolor);
45  void SetFillStyle(Style_t fstyle);
46  void SetOpacity(Int_t percent);
47  //Text attributes.
48  Short_t GetTextAlign() const;
49  Float_t GetTextAngle() const;
50  Color_t GetTextColor() const;
51  Font_t GetTextFont() const;
52  Float_t GetTextSize() const;
53  Float_t GetTextMagnitude() const;
54 
55  void SetTextAlign(Short_t align);
56  void SetTextAngle(Float_t tangle);
57  void SetTextColor(Color_t tcolor);
58  void SetTextFont(Font_t tfont);
59  void SetTextSize(Float_t tsize);
60  void SetTextSizePixels(Int_t npixels);
61  //2. "Off-screen management" part.
63  void ClearDrawable();
64  void CopyDrawable(Int_t device, Int_t px, Int_t py);
65  void DestroyDrawable(Int_t device);
66  void SelectDrawable(Int_t device);
67 
68  //TASImage support (noop for a non-gl pad).
69  void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
70  Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending);
71 
72 
75 
76  void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode);
77  //TPad needs double and float versions.
78  void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y);
79  void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y);
80 
81  //TPad needs both double and float versions of DrawPolyLine.
82  void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y);
83  void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y);
84  void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v);
85 
86  //TPad needs both versions.
87  void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y);
88  void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y);
89 
90  void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode);
91  void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode);
92  void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode);
93  void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode);
94 
95  //jpg, png, bmp, gif output.
96  void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const;
97 
98 private:
99  //Let's make this clear:
100  TPadPainter(const TPadPainter &rhs) = delete;
101  TPadPainter(TPadPainter && rhs) = delete;
102  TPadPainter & operator = (const TPadPainter &rhs) = delete;
103  TPadPainter & operator = (TPadPainter && rhs) = delete;
104 
105  ClassDef(TPadPainter, 0) //Abstract interface for painting in TPad
106 };
107 
108 #endif
n
const Int_t n
Definition: legend1.C:16
TPadPainter::SetLineStyle
void SetLineStyle(Style_t lstyle)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:125
Style_t
short Style_t
Definition: RtypesCore.h:80
TPadPainter::SetTextColor
void SetTextColor(Color_t tcolor)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:270
TPadPainter::DrawPolyLineNDC
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v)
Paint polyline in normalized coordinates.
Definition: TPadPainter.cxx:470
TVirtualPadPainter::EBoxMode
EBoxMode
Definition: TVirtualPadPainter.h:21
TPadPainter::DestroyDrawable
void DestroyDrawable(Int_t device)
Close the current gVirtualX pixmap.
Definition: TPadPainter.cxx:333
TPadPainter::SetTextFont
void SetTextFont(Font_t tfont)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:279
TPadPainter::SetFillStyle
void SetFillStyle(Style_t fstyle)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:180
TPadPainter::GetTextAngle
Float_t GetTextAngle() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:207
TPadPainter::SelectDrawable
void SelectDrawable(Int_t device)
Select the window in which the graphics will go.
Definition: TPadPainter.cxx:343
TPadPainter::GetTextSize
Float_t GetTextSize() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:234
Float_t
float Float_t
Definition: RtypesCore.h:57
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TPadPainter::TPadPainter
TPadPainter()
Empty ctor. We need it only because of explicit copy ctor.
Definition: TPadPainter.cxx:72
Font_t
short Font_t
Definition: RtypesCore.h:79
TPadPainter::CopyDrawable
void CopyDrawable(Int_t device, Int_t px, Int_t py)
Copy a gVirtualX pixmap.
Definition: TPadPainter.cxx:324
x
Double_t x[n]
Definition: legend1.C:17
TPadPainter::SetTextSizePixels
void SetTextSizePixels(Int_t npixels)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:297
Color_t
short Color_t
Definition: RtypesCore.h:83
TPadPainter::GetTextAlign
Short_t GetTextAlign() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:198
v
@ v
Definition: rootcling_impl.cxx:3635
text
TText * text
Definition: entrylist_figure1.C:10
bool
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TPadPainter::DrawText
void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode)
Paint text.
Definition: TPadPainter.cxx:521
TPadPainter::SetTextAlign
void SetTextAlign(Short_t align)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:252
TPadPainter::DrawFillArea
void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y)
Paint filled area.
Definition: TPadPainter.cxx:411
h
#define h(i)
Definition: RSha256.hxx:124
TPadPainter::GetLineWidth
Width_t GetLineWidth() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:107
Width_t
short Width_t
Definition: RtypesCore.h:82
TPadPainter
Definition: TPadPainter.h:26
TPadPainter::SetLineWidth
void SetLineWidth(Width_t lwidth)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:134
TPadPainter::ClearDrawable
void ClearDrawable()
Clear the current gVirtualX window.
Definition: TPadPainter.cxx:315
TPadPainter::DrawLineNDC
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
Paint a simple line in normalized coordinates.
Definition: TPadPainter.cxx:375
y
Double_t y[n]
Definition: legend1.C:17
TPadPainter::SaveImage
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.
Definition: TPadPainter.cxx:560
Short_t
short Short_t
Definition: RtypesCore.h:39
TPadPainter::SetFillColor
void SetFillColor(Color_t fcolor)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:171
unsigned int
TPadPainter::DrawBox
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode)
Paint a simple box.
Definition: TPadPainter.cxx:390
TPadPainter::CreateDrawable
Int_t CreateDrawable(UInt_t w, UInt_t h)
Create a gVirtualX Pixmap.
Definition: TPadPainter.cxx:306
TPadPainter::GetTextColor
Color_t GetTextColor() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:216
TPadPainter::DrawPixels
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.
Definition: TPadPainter.cxx:351
TPadPainter::GetFillColor
Color_t GetFillColor() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:143
TPadPainter::GetTextMagnitude
Float_t GetTextMagnitude() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:243
TPadPainter::SetOpacity
void SetOpacity(Int_t percent)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:189
TPadPainter::GetTextFont
Font_t GetTextFont() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:225
v1
@ v1
Definition: rootcling_impl.cxx:3637
Double_t
double Double_t
Definition: RtypesCore.h:59
TVirtualPad
Definition: TVirtualPad.h:50
TPadPainter::operator=
TPadPainter & operator=(const TPadPainter &rhs)=delete
TPadPainter::GetFillStyle
Style_t GetFillStyle() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:152
TPadPainter::DrawTextNDC
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode)
Paint text in normalized coordinates.
Definition: TPadPainter.cxx:547
v2
@ v2
Definition: rootcling_impl.cxx:3638
TPadPainter::GetLineColor
Color_t GetLineColor() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:89
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TPadPainter::IsTransparent
Bool_t IsTransparent() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:161
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TPadPainter::SetTextAngle
void SetTextAngle(Float_t tangle)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:261
TPadPainter::SetTextSize
void SetTextSize(Float_t tsize)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:288
TVirtualPadPainter.h
TVirtualPadPainter
Definition: TVirtualPadPainter.h:19
type
int type
Definition: TGX11.cxx:121
TPadPainter::DrawPolyLine
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y)
Paint Polyline.
Definition: TPadPainter.cxx:438
TVirtualPadPainter::ETextMode
ETextMode
Definition: TVirtualPadPainter.h:22
TPadPainter::GetLineStyle
Style_t GetLineStyle() const
Delegate to gVirtualX.
Definition: TPadPainter.cxx:98
TPadPainter::SetLineColor
void SetLineColor(Color_t lcolor)
Delegate to gVirtualX.
Definition: TPadPainter.cxx:116
TPadPainter::DrawPolyMarker
void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y)
Paint polymarker.
Definition: TPadPainter.cxx:493
int
TPadPainter::DrawLine
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Paint a simple line.
Definition: TPadPainter.cxx:360