Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPadPainterPS.h
Go to the documentation of this file.
1// @(#)root/gpad:$Id$
2// Author: Sergey Linev 04/03/2026
3
4/*************************************************************************
5 * Copyright (C) 1995-2026, 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_TPadPainterPS
13#define ROOT_TPadPainterPS
14
15#include "TVirtualPadPainter.h"
16
17/*
18TPadPainterPS is an attempt to abstract
19pad painting operation to the TVirtualPS interface.
20So using same API as for normal object drawing on interactive canvas,
21one also will be able to produce vector-based and binary images */
22
23class TVirtualPad;
24class TVirtualPS;
25
27private:
28 TVirtualPS *fPS = nullptr;
29 TVirtualPad *fPad = nullptr;
30public:
32
33 //Final overriders for TVirtualPadPainter pure virtual functions.
34 //1. Part, which simply delegates to TVirtualX.
35
36 //Line attributes.
37 Color_t GetLineColor() const override;
38 Style_t GetLineStyle() const override;
39 Width_t GetLineWidth() const override;
40
41 void SetLineColor(Color_t lcolor) override;
42 void SetLineStyle(Style_t lstyle) override;
43 void SetLineWidth(Width_t lwidth) override;
44
45 //Fill attributes.
46 Color_t GetFillColor() const override;
47 Style_t GetFillStyle() const override;
48 Bool_t IsTransparent() const override;
49
50 void SetFillColor(Color_t fcolor) override;
51 void SetFillStyle(Style_t fstyle) override;
52 void SetOpacity(Int_t percent) override;
53
54 //Text attributes.
55 Short_t GetTextAlign() const override;
56 Float_t GetTextAngle() const override;
57 Color_t GetTextColor() const override;
58 Font_t GetTextFont() const override;
59 Float_t GetTextSize() const override;
60 Float_t GetTextMagnitude() const override;
61
62 void SetTextAlign(Short_t align) override;
63 void SetTextAngle(Float_t tangle) override;
64 void SetTextColor(Color_t tcolor) override;
65 void SetTextFont(Font_t tfont) override;
66 void SetTextSize(Float_t tsize) override;
67 void SetTextSizePixels(Int_t npixels) override;
68
69 //Marker attributes
70 Color_t GetMarkerColor() const override;
71 Style_t GetMarkerStyle() const override;
72 Size_t GetMarkerSize() const override;
73
74 void SetMarkerColor(Color_t mcolor) override;
75 void SetMarkerStyle(Style_t mstyle) override;
76 void SetMarkerSize(Size_t msize) override;
77
78 //2. "Off-screen management" part.
80 void ClearDrawable() override;
81 void CopyDrawable(Int_t device, Int_t px, Int_t py) override;
82 void DestroyDrawable(Int_t device) override;
83 void SelectDrawable(Int_t device) override;
84
85 void NewPage() override;
86
87 //TASImage support (noop for a non-gl pad).
88 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
90
93
95
96 //TPad needs double and float versions.
97 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
98 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
99
100 //TPad needs both double and float versions of DrawPolyLine.
101 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
102 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
103 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
104
105 void DrawSegments(Int_t n, Double_t *x, Double_t *y) override;
106 void DrawSegmentsNDC(Int_t n, Double_t *u, Double_t *v) override;
107
108 //TPad needs both versions.
109 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
110 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
111
112 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
113 void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
114 void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
115 void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
116
117 void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
118
119 //jpg, png, bmp, gif output.
120 void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
121
122 void OnPad(TVirtualPad *pad) override { fPad = pad; }
123
124private:
125 //Let's make this clear:
126 TPadPainterPS(const TPadPainterPS &) = delete;
130
131 ClassDefOverride(TPadPainterPS, 0) //TPad painting with TVirtualPS interface
132};
133
134#endif
#define h(i)
Definition RSha256.hxx:106
short Style_t
Style number (short)
Definition RtypesCore.h:96
short Color_t
Color number (short)
Definition RtypesCore.h:99
float Size_t
Attribute size (float)
Definition RtypesCore.h:103
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
short Font_t
Font number (short)
Definition RtypesCore.h:95
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 SetMarkerStyle
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
TPadPainterPS(const TPadPainterPS &)=delete
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
Font_t GetTextFont() const override
Delegate to gVirtualPS.
Float_t GetTextSize() const override
Delegate to gVirtualPS.
Color_t GetTextColor() const override
Delegate to gVirtualPS.
Style_t GetMarkerStyle() const override
Delegate to gVirtualPS.
Style_t GetFillStyle() const override
Delegate to gVirtualPS.
void DrawSegments(Int_t n, Double_t *x, Double_t *y) override
Paint N segments on the pad.
void ClearDrawable() override
Clear the current gVirtualX window - noop for PS.
Color_t GetFillColor() const override
Delegate to gVirtualPS.
Color_t GetMarkerColor() const override
Delegate to gVirtualPS.
TVirtualPS * fPS
void DrawSegmentsNDC(Int_t n, Double_t *u, Double_t *v) override
Paint N segments in normalized coordinates on the pad.
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.
TPadPainterPS & operator=(const TPadPainterPS &)=delete
TPadPainterPS & operator=(TPadPainterPS &&)=delete
Style_t GetLineStyle() const override
Delegate to gVirtualPS.
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override
Paint text in normalized coordinates.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Paint a simple line in normalized coordinates.
TPadPainterPS(TVirtualPS *ps)
Consructor Assigns TVirtualPS instance which will be used by the painter.
void SetTextAlign(Short_t align) override
Delegate to gVirtualPS.
void SetMarkerSize(Size_t msize) override
Delegate to gVirtualPS.
void NewPage() override
Start new page on PS output.
Width_t GetLineWidth() const override
Delegate to gVirtualPS.
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.
void SetTextColor(Color_t tcolor) override
Delegate to gVirtualPS.
void SetMarkerColor(Color_t mcolor) override
Delegate to gVirtualPS.
void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override
Drawint text with url link.
void SelectDrawable(Int_t device) override
Select the window in which the graphics will go - not implemented.
void OnPad(TVirtualPad *pad) override
Float_t GetTextAngle() const override
Delegate to gVirtualPS.
void SetLineStyle(Style_t lstyle) override
Delegate to gVirtualPS.
Float_t GetTextMagnitude() const override
Delegate to gVirtualPS.
TPadPainterPS(TPadPainterPS &&)=delete
TVirtualPad * fPad
Size_t GetMarkerSize() const override
Delegate to gVirtualPS.
Color_t GetLineColor() const override
Delegate to gVirtualPS.
void SetTextAngle(Float_t tangle) override
Delegate to gVirtualPS.
Short_t GetTextAlign() const override
Delegate to gVirtualPS.
Int_t CreateDrawable(UInt_t w, UInt_t h) override
Create a gVirtualX Pixmap - not implemented.
void DestroyDrawable(Int_t device) override
Close the current gVirtualX pixmap - not implemented.
void SetTextSizePixels(Int_t npixels) override
Delegate to gVirtualPS.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Paint a simple box.
void CopyDrawable(Int_t device, Int_t px, Int_t py) override
Copy a gVirtualX pixmap - not implemented.
Bool_t IsTransparent() const override
Delegate to gVirtualPS.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Paint Polyline.
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition TVirtualPS.h:30
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