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
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 void SetOpacity(Int_t percent) override;
34
35 //Overall attributes
36 void SetAttFill(const TAttFill &att) override;
37 void SetAttLine(const TAttLine &att) override;
38 void SetAttMarker(const TAttMarker &att) override;
39 void SetAttText(const TAttText &att) override;
40
41 //Final overriders for TVirtualPadPainter pure virtual functions.
42 //1. Part, which simply delegates to TVirtualX.
43
44 //2. "Off-screen management" part.
46 void ClearDrawable() override;
47 void CopyDrawable(Int_t device, Int_t px, Int_t py) override;
48 void DestroyDrawable(Int_t device) override;
49 void SelectDrawable(Int_t device) override;
50
51 void NewPage() override;
52
53 //TASImage support (noop for a non-gl pad).
54 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
56
59
61
62 //TPad needs double and float versions.
63 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
64 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
65
66 //TPad needs both double and float versions of DrawPolyLine.
67 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
68 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
69 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
70
71 void DrawSegments(Int_t n, Double_t *x, Double_t *y) override;
72 void DrawSegmentsNDC(Int_t n, Double_t *u, Double_t *v) override;
73
74 //TPad needs both versions.
75 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
76 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
77
78 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
79 void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
80 void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
81 void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
82
83 void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
84
85 //jpg, png, bmp, gif output.
86 void SaveImage(TVirtualPad *pad, const char *fileName, Int_t type) const override;
87
88 void OnPad(TVirtualPad *pad) override { fPad = pad; }
89
90 TVirtualPS *GetPS() const override { return fPS; }
91
92
93private:
94 //Let's make this clear:
95 TPadPainterPS(const TPadPainterPS &) = delete;
99
100 ClassDefOverride(TPadPainterPS, 0) //TPad painting with TVirtualPS interface
101};
102
103#endif
#define h(i)
Definition RSha256.hxx:106
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
#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 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:21
Text Attributes class.
Definition TAttText.h:21
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
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 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:30
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