Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TWebPadPainter.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 10/04/2017
2
3/*************************************************************************
4 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TWebPadPainter
12#define ROOT_TWebPadPainter
13
14#include "TPadPainterBase.h"
15
16#include <string>
17
18#include "TWebPainting.h"
19
20class TWebCanvas;
21
23
24friend class TWebCanvas;
25
26protected:
27
28 TWebPainting *fPainting{nullptr}; ///<! object to store all painting, owned by TWebPS object
29
30 enum { attrLine = 0x1, attrFill = 0x2, attrMarker = 0x4, attrText = 0x8, attrAll = 0xf };
31
32 Float_t *StoreOperation(const std::string &oper, unsigned attrkind, int opersize = 0);
33
34public:
35
36 TWebPadPainter() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
37
39
40
41 void SetOpacity(Int_t percent) override;
42
43 //2. "Off-screen management" part.
44 Int_t CreateDrawable(UInt_t, UInt_t) override { return -1; }
45 void ClearDrawable() override {}
46 void CopyDrawable(Int_t, Int_t, Int_t) override {}
47 void DestroyDrawable(Int_t) override {}
48 void SelectDrawable(Int_t) override {}
49
50 //jpg, png, bmp, gif output.
51 void SaveImage(TVirtualPad *, const char *, Int_t) const 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 //TPad needs double and float versions.
62 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
63 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
64
65 //TPad needs both double and float versions of DrawPolyLine.
66 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
67 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
68 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
69
70 //TPad needs both versions.
71 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
72 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
73
74 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
75 void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
76 void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
77 void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
78
79 void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
80
81 Bool_t IsSupportAlpha() const override { return kTRUE; }
82
83private:
84 //Let's make this clear:
89
90 ClassDefOverride(TWebPadPainter, 0) //Abstract interface for painting in TPad
91};
92
93#endif
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
winID h TVirtualViewer3D TVirtualGLPainter p
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 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
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Basic TCanvasImp ABI implementation for Web-based Graphics Provides painting of main ROOT classes in ...
Definition TWebCanvas.h:35
Implement TVirtualPadPainter which abstracts painting operations.
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 DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Paint a simple box.
TWebPainting * fPainting
! object to store all painting, owned by TWebPS object
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override
Paint text in normalized coordinates.
void SelectDrawable(Int_t) override
Int_t CreateDrawable(UInt_t, UInt_t) override
Float_t * StoreOperation(const std::string &oper, unsigned attrkind, int opersize=0)
Store operation identifier with appropriate attributes.
TWebPadPainter(TWebPadPainter &&rhs)=delete
TWebPadPainter(const TWebPadPainter &rhs)=delete
void ClearDrawable() override
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Paint a simple line in normalized coordinates.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
void SetPainting(TWebPainting *p)
void SaveImage(TVirtualPad *, const char *, Int_t) const override
Produce image from WebPadPainter.
void CopyDrawable(Int_t, Int_t, Int_t) override
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Paint Polyline.
void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override
Paint text with url.
Bool_t IsSupportAlpha() const override
TWebPadPainter & operator=(const TWebPadPainter &rhs)=delete
void DestroyDrawable(Int_t) override
Object used to store paint operations and deliver them to JSROOT.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16