Logo ROOT  
Reference Guide
TWebPainting.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 10/04/2017
2
3/*************************************************************************
4 * Copyright (C) 1995-2018, 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_TWebPainting
12#define ROOT_TWebPainting
13
14#include "TObject.h"
15#include "TAttLine.h"
16#include "TAttFill.h"
17#include "TAttText.h"
18#include "TAttMarker.h"
19#include "TArrayF.h"
20
21class TColor;
22
23#include <string>
24
25class TWebPainting : public TObject {
26
27 protected:
28 std::string fOper; /// list of operations, separated by semicolons
29 Int_t fSize{0}; ///<! filled buffer size
30 TArrayF fBuf; /// array of points for all operations
31 TAttLine fLastLine; ///<! last line attributes
32 TAttFill fLastFill; ///<! last fill attributes
33 TAttMarker fLastMarker; ///<! last marker attributes
34
35 public:
36
38 virtual ~TWebPainting() = default;
39
40 Bool_t IsEmpty() const { return fOper.empty() && (fBuf.GetSize() == 0); }
41
42 void AddOper(const std::string &oper);
43
44 void AddLineAttr(const TAttLine &attr);
45 void AddFillAttr(const TAttFill &attr);
46 void AddTextAttr(const TAttText &attr);
47 void AddMarkerAttr(const TAttMarker &attr);
48
50
51 void AddColor(Int_t indx, TColor *col);
52
53 // Set actual filled size
54 void FixSize() { fBuf.Set(fSize); }
55
56 static std::string MakeTextOper(const char *str);
57
58
59 ClassDef(TWebPainting, 1) // store for all paint operation of TVirtualPadPainter
60};
61
62#endif
int Int_t
Definition: RtypesCore.h:45
bool Bool_t
Definition: RtypesCore.h:63
float Float_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:325
Array of floats (32 bits per element).
Definition: TArrayF.h:27
void Set(Int_t n)
Set size of this array to n floats.
Definition: TArrayF.cxx:105
Int_t GetSize() const
Definition: TArray.h:47
Fill Area Attributes class.
Definition: TAttFill.h:19
Line Attributes class.
Definition: TAttLine.h:18
Marker Attributes class.
Definition: TAttMarker.h:19
Text Attributes class.
Definition: TAttText.h:18
The color creation and management class.
Definition: TColor.h:19
Mother of all ROOT objects.
Definition: TObject.h:37
Object used to store paint operations and deliver them to JSROOT.
Definition: TWebPainting.h:25
void AddColor(Int_t indx, TColor *col)
Add custom color to operations.
virtual ~TWebPainting()=default
TWebPainting()
Constructor.
void AddTextAttr(const TAttText &attr)
Store text attributes If attributes were not changed - ignore operation.
TAttMarker fLastMarker
! last marker attributes
Definition: TWebPainting.h:33
void AddMarkerAttr(const TAttMarker &attr)
Store marker attributes If attributes were not changed - ignore operation.
void FixSize()
Definition: TWebPainting.h:54
void AddLineAttr(const TAttLine &attr)
Store line attributes If attributes were not changed - ignore operation.
static std::string MakeTextOper(const char *str)
Create text operation If text include special symbols - use simple hex coding.
Int_t fSize
list of operations, separated by semicolons
Definition: TWebPainting.h:29
TAttFill fLastFill
! last fill attributes
Definition: TWebPainting.h:32
std::string fOper
Definition: TWebPainting.h:28
void AddOper(const std::string &oper)
Add next custom operator to painting Operations are separated by semicolons Following operations are ...
Float_t * Reserve(Int_t sz)
Reserve place in the float buffer Returns pointer on first element in reserved area.
TArrayF fBuf
Definition: TWebPainting.h:30
TAttLine fLastLine
array of points for all operations
Definition: TWebPainting.h:31
void AddFillAttr(const TAttFill &attr)
Store fill attributes If attributes were not changed - ignore operation.
Bool_t IsEmpty() const
Definition: TWebPainting.h:40