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 "TPadPainterBase.h"
16
17class TVirtualPad;
18class TVirtualPS;
19
21private:
22 TVirtualPS *fPS = nullptr;
23 TVirtualPad *fPad = nullptr;
24public:
26
27 void SetOpacity(Int_t percent) override;
28
29 //Overall attributes
30 void SetAttFill(const TAttFill &att) override;
31 void SetAttLine(const TAttLine &att) override;
32 void SetAttMarker(const TAttMarker &att) override;
33 void SetAttText(const TAttText &att) override;
34
35 //Final overriders for TVirtualPadPainter pure virtual functions.
36 //1. Part, which simply delegates to TVirtualX.
37
38 //2. "Off-screen management" part.
40 void ClearDrawable() override;
41 void CopyDrawable(Int_t device, Int_t px, Int_t py) override;
42 void DestroyDrawable(Int_t device) override;
43 void SelectDrawable(Int_t device) override;
44
45
46 Bool_t HasTTFonts() const override { return kTRUE; }
47
48 void NewPage() override;
49
50 //TASImage support (noop for a non-gl pad).
51 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
52 Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override;
53
55 void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override;
56
58
59 //TPad needs double and float versions.
60 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
61 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
62
63 //TPad needs both double and float versions of DrawPolyLine.
64 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
65 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
66 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
67
68 void DrawSegments(Int_t n, Double_t *x, Double_t *y) override;
69 void DrawSegmentsNDC(Int_t n, Double_t *u, Double_t *v) override;
70
71 //TPad needs both versions.
72 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
73 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
74
75 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
76 void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
77 void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
78 void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
79
80 void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
81
82 void DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags = 0) override;
83
84 //jpg, png, bmp, gif output.
85 void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
86
87 void OnPad(TVirtualPad *pad) override { fPad = pad; }
88
89 TVirtualPS *GetPS() const override { return fPS; }
90
91
92private:
93 //Let's make this clear:
94 TPadPainterPS(const TPadPainterPS &) = delete;
98
99 ClassDefOverride(TPadPainterPS, 0) //TPad painting with TVirtualPS interface
100};
101
102#endif
#define h(i)
Definition RSha256.hxx:106
char * device
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:61
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
#define ClassDefOverride(name, id)
Definition Rtypes.h:347
Option_t Option_t DrawFillArea
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
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 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
Fill Area Attributes class.
Definition TAttFill.h:21
Line Attributes class.
Definition TAttLine.h:21
Marker Attributes class.
Definition TAttMarker.h:22
Text Attributes class.
Definition TAttText.h:21
An abstract interface to image processing library.
Definition TImage.h:30
Extends TVirtualPadPainter interface to simplify work with graphical attributes.
TPadPainterPS is an attempt to abstract pad painting operation to the TVirtualPS interface.
TPadPainterPS(const TPadPainterPS &)=delete
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
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.
void SetAttMarker(const TAttMarker &att) override
Provide marker attributes 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 SetAttText(const TAttText &att) override
Provide text attributes to gVirtualPS.
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
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 NewPage() override
Start new page on PS output.
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 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
void SetAttLine(const TAttLine &att) override
Provide line attributes to gVirtualPS.
TVirtualPS * GetPS() const override
TPadPainterPS(TPadPainterPS &&)=delete
Bool_t HasTTFonts() const override
TVirtualPad * fPad
void SetAttFill(const TAttFill &att) override
Provide fill attributes to gVirtualPS.
Int_t CreateDrawable(UInt_t w, UInt_t h) override
Create a gVirtualX Pixmap - not implemented.
void DrawImage(TImage *img, Int_t x, Int_t y, Int_t flags=0) override
Draw image on the PS output.
void DestroyDrawable(Int_t device) override
Close the current gVirtualX pixmap - not implemented.
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.
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:32
virtual void const char * fileName
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:53
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16