Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/*
18TVirtualPadPainter is an attempt to abstract
19painting operation furthermore. gVirtualX can
20be X11 or GDI, but pad painter can be gVirtualX (X11 or GDI),
21or gl pad painter.
22*/
23
24class TVirtualPad;
25
27public:
29 //Final overriders for TVirtualPadPainter pure virtual functions.
30 //1. Part, which simply delegates to TVirtualX.
31
32 //Line attributes.
33 Color_t GetLineColor() const override;
34 Style_t GetLineStyle() const override;
35 Width_t GetLineWidth() const override;
36
37 void SetLineColor(Color_t lcolor) override;
38 void SetLineStyle(Style_t lstyle) override;
39 void SetLineWidth(Width_t lwidth) override;
40
41 //Fill attributes.
42 Color_t GetFillColor() const override;
43 Style_t GetFillStyle() const override;
44 Bool_t IsTransparent() const override;
45
46 void SetFillColor(Color_t fcolor) override;
47 void SetFillStyle(Style_t fstyle) override;
48 void SetOpacity(Int_t percent) override;
49
50 //Text attributes.
51 Short_t GetTextAlign() const override;
52 Float_t GetTextAngle() const override;
53 Color_t GetTextColor() const override;
54 Font_t GetTextFont() const override;
55 Float_t GetTextSize() const override;
56 Float_t GetTextMagnitude() const override;
57
58 void SetTextAlign(Short_t align) override;
59 void SetTextAngle(Float_t tangle) override;
60 void SetTextColor(Color_t tcolor) override;
61 void SetTextFont(Font_t tfont) override;
62 void SetTextSize(Float_t tsize) override;
63 void SetTextSizePixels(Int_t npixels) override;
64
65 //2. "Off-screen management" part.
67 void ClearDrawable() override;
68 void CopyDrawable(Int_t device, Int_t px, Int_t py) override;
69 void DestroyDrawable(Int_t device) override;
70 void SelectDrawable(Int_t device) override;
71
72 //TASImage support (noop for a non-gl pad).
73 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
74 Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override;
75
77 void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
78
80
81 //TPad needs double and float versions.
82 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
83 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
84
85 //TPad needs both double and float versions of DrawPolyLine.
86 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
87 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
88 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
89
90 //TPad needs both versions.
91 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
92 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
93
94 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
95 void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
96 void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
97 void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
98
99 //jpg, png, bmp, gif output.
100 void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
101
102private:
103 //Let's make this clear:
104 TPadPainter(const TPadPainter &) = delete;
108
109 ClassDefOverride(TPadPainter, 0) //TPad painting
110};
111
112#endif
#define h(i)
Definition RSha256.hxx:106
short Style_t
Definition RtypesCore.h:82
short Color_t
Definition RtypesCore.h:85
short Width_t
Definition RtypesCore.h:84
float Float_t
Definition RtypesCore.h:57
short Font_t
Definition RtypesCore.h:81
short Short_t
Definition RtypesCore.h:39
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t SetLineWidth
Option_t Option_t SetFillStyle
Option_t Option_t SetTextSize
Option_t Option_t DrawFillArea
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t SetTextFont
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint DrawPolyMarker
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char DrawLine
Option_t Option_t width
Option_t Option_t TPoint TPoint percent
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint DrawText
Option_t Option_t TPoint TPoint SetOpacity
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Implement TVirtualPadPainter which abstracts painting operations.
Definition TPadPainter.h:26
TPadPainter()
Empty ctor. We need it only because of explicit copy ctor.
Color_t GetFillColor() const override
Delegate to gVirtualX.
void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override
Noop, for non-gl pad TASImage calls gVirtualX->CopyArea.
Float_t GetTextAngle() const override
Delegate to gVirtualX.
void CopyDrawable(Int_t device, Int_t px, Int_t py) override
Copy a gVirtualX pixmap.
TPadPainter & operator=(TPadPainter &&)=delete
Float_t GetTextSize() const override
Delegate to gVirtualX.
Style_t GetFillStyle() const override
Delegate to gVirtualX.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Paint Polyline.
Short_t GetTextAlign() const override
Delegate to gVirtualX.
Style_t GetLineStyle() const override
Delegate to gVirtualX.
Bool_t IsTransparent() const override
Delegate to gVirtualX.
Float_t GetTextMagnitude() const override
Delegate to gVirtualX.
Color_t GetTextColor() const override
Delegate to gVirtualX.
Int_t CreateDrawable(UInt_t w, UInt_t h) override
Create a gVirtualX Pixmap.
void SetTextAlign(Short_t align) override
Delegate to gVirtualX.
void SetTextAngle(Float_t tangle) override
Delegate to gVirtualX.
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override
Paint text in normalized coordinates.
void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override
Save the image displayed in the canvas pointed by "pad" into a binary file.
void SetLineStyle(Style_t lstyle) override
Delegate to gVirtualX.
TPadPainter(const TPadPainter &)=delete
Font_t GetTextFont() const override
Delegate to gVirtualX.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
void ClearDrawable() override
Clear the current gVirtualX window.
void DestroyDrawable(Int_t device) override
Close the current gVirtualX pixmap.
Width_t GetLineWidth() const override
Delegate to gVirtualX.
void SetTextColor(Color_t tcolor) override
Delegate to gVirtualX.
void SetTextSizePixels(Int_t npixels) override
Delegate to gVirtualX.
void SelectDrawable(Int_t device) override
Select the window in which the graphics will go.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Paint a simple box.
Color_t GetLineColor() const override
Delegate to gVirtualX.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Paint a simple line in normalized coordinates.
TPadPainter(TPadPainter &&)=delete
TPadPainter & operator=(const TPadPainter &)=delete
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16