Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTeXDump.cxx
Go to the documentation of this file.
1// @(#)root/postscript:$Id$
2// Author: Olivier Couet, Sergey Linev
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#ifdef WIN32
13#pragma optimize("",off)
14#endif
15
16#include <cstdlib>
17#include <cstring>
18#include <cctype>
19#include <fstream>
20
21#include "TROOT.h"
22#include "TColor.h"
23#include "TVirtualPad.h"
24#include "TPoint.h"
25#include "TPoints.h"
26#include "TTeXDump.h"
27#include "TStyle.h"
28#include "TMath.h"
29
30
31/** \class TTeXDump
32\ingroup PS
33
34\brief Interface to TeX.
35
36This class allow to generate <b>PGF/TikZ</b> vector graphics output
37which can be included in TeX and LaTeX documents.
38
39PGF is a TeX macro package for generating graphics. It is platform
40and format-independent and works together with the most important TeX
41backend drivers, including pdftex and dvips. It comes with a
42user-friendly syntax layer called TikZ.
43
44To generate a such file it is enough to do:
45~~~ {.cpp}
46 gStyle->SetPaperSize(10.,10.);
47 hpx->Draw();
48 gPad->Print("hpx.tex");
49~~~
50
51Then, the generated file (`hpx.tex`) can be included in a
52LaTeX document (`simple.tex`) in the following way:
53~~~ {.cpp}
54\documentclass{article}
55\usepackage{tikz}
56\usepackage{changepage}
57\usetikzlibrary{patterns}
58\usetikzlibrary{plotmarks}
59\title{A simple LaTeX example}
60\date{August 2026}
61\begin{document}
62\maketitle
63The following image as been generated using the TTeXDump class:
64\par
65\begin{adjustwidth}{-4cm}{-4cm}
66\input{hpx.tex}
67\end{adjustwidth}
68\end{document}
69~~~
70
71Note the four directives needed at the top of the LaTeX file:
72~~~ {.cpp}
73\usepackage{tikz}
74\usepackage{changepage}
75\usetikzlibrary{patterns}
76\usetikzlibrary{plotmarks}
77~~~
78
79Then including the picture in the document is done with the
80`\input` directive.
81
82The command `pdflatex simple.tex` will generate the
83corresponding pdf file `simple.pdf`.
84*/
85
86////////////////////////////////////////////////////////////////////////////////
87/// Default TeX constructor
88
90{
91 gVirtualPS = this;
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// Initialize the TeX interface
96///
97/// --fname : TeX file name
98/// - wtype : TeX workstation type. Not used in the TeX driver. But as TTeXDump
99/// inherits from TVirtualPS it should be kept. Anyway it is not
100/// necessary to specify this parameter at creation time because it
101/// has a default value (which is ignore in the TeX case).
102
104{
105 gVirtualPS = this;
106
107 Open(fname, wtype);
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// Open a TeX file
112
113void TTeXDump::Open(const char *fname, Int_t wtype)
114{
115 if (fStream) {
116 Warning("Open", "TeX file already open");
117 return;
118 }
119
121 fLenBuffer = 0;
122 fType = abs(wtype);
123
125
127 if (gPad) {
128 Double_t ww = gPad->GetWw();
129 Double_t wh = gPad->GetWh();
130 ww *= gPad->GetWNDC();
131 wh *= gPad->GetHNDC();
132 Double_t ratio = wh/ww;
133 xrange = fXsize;
134 yrange = fXsize*ratio;
135 if (yrange > fYsize) { yrange = fYsize; xrange = yrange/ratio;}
137 }
138
139 // Open OS file
140 if (!OpenStream(fname)) {
141 Error("Open", "Cannot open file:%s", fname);
142 return;
143 }
144
145 gVirtualPS = this;
146
147 ClearBuffer();
148
150 fRange = kFALSE;
152
153 // Set a default range
155
156 if (strstr(GetTitle(),"Standalone"))
158 if (fStandalone) {
159 PrintStr("\\documentclass{standalone}@");
160 PrintStr("\\usepackage{tikz}@");
161 PrintStr("\\usetikzlibrary{patterns,plotmarks}@");
162 PrintStr("\\begin{document}@");
163 } else {
164 PrintStr("%\\documentclass{standalone}@");
165 PrintStr("%\\usepackage{tikz}@");
166 PrintStr("%\\usetikzlibrary{patterns,plotmarks}@");
167 PrintStr("%\\begin{document}@");
168 }
169
170 NewPage();
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Default TeX destructor
175
177{
178 Close();
179}
180
181////////////////////////////////////////////////////////////////////////////////
182/// Close a TeX file
183
185{
186 if (!gVirtualPS || !fStream)
187 return;
188 if (gPad)
189 gPad->Update();
190 PrintStr("@");
191 PrintStr("\\end{tikzpicture}@");
192 if (fStandalone) {
193 PrintStr("\\end{document}@");
194 } else {
195 PrintStr("%\\end{document}@");
196 }
197
198 // Close file stream
199 CloseStream();
200
201 gVirtualPS = nullptr;
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Activate an already open TeX file
206
208{
209 // fType is used to know if the TeX file is open. Unlike TPostScript, TTeXDump
210 // has no "workstation type". In fact there is only one TeX type.
211
212 if (!fType) {
213 Error("On", "no TeX file open");
214 Off();
215 return;
216 }
217 gVirtualPS = this;
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Deactivate an already open TeX file
222
224{
225 gVirtualPS = nullptr;
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Draw a Box
230
232{
233 Float_t x1c = XtoTeX(x1);
234 Float_t y1c = YtoTeX(y1);
235 Float_t x2c = XtoTeX(x2);
236 Float_t y2c = YtoTeX(y2);
237
238 Int_t fillis = fFillStyle/1000;
239 Int_t fillsi = fFillStyle%1000;
240
241 if (fillis==1) {
243 PrintStr("@");
244 if (fCurrentAlpha != 1.) {
245 PrintStr("\\fill [c");
246 PrintStr(", fill opacity=");
248 }
249 else {
250 PrintStr("\\draw [color=c, fill=c");
251 }
252 PrintStr("] (");
254 PrintFast(1,",");
256 PrintStr(") rectangle (");
258 PrintFast(1,",");
260 PrintStr(");");
261 }
262 if (fillis>1 && fillis<4) {
264 PrintStr("@");
265 PrintStr("\\draw [pattern=");
266 switch (fillsi) {
267 case 1 :
268 PrintStr("crosshatch dots");
269 break;
270 case 2 :
271 case 3 :
272 PrintStr("dots");
273 break;
274 case 4 :
275 PrintStr("north east lines");
276 break;
277 case 5 :
278 PrintStr("north west lines");
279 break;
280 case 6 :
281 PrintStr("vertical lines");
282 break;
283 case 7 :
284 PrintStr("horizontal lines");
285 break;
286 case 10 :
287 PrintStr("bricks");
288 break;
289 case 13 :
290 PrintStr("crosshatch");
291 break;
292 }
293 PrintStr(", draw=none, pattern color=c");
294 if (fCurrentAlpha != 1.) {
295 PrintStr(", fill opacity=");
297 }
298 PrintStr("] (");
300 PrintFast(1,",");
302 PrintStr(") rectangle (");
304 PrintFast(1,",");
306 PrintStr(");");
307 }
308 if (fillis == 0) {
309 if (fLineWidth<=0) return;
311 PrintStr("@");
312 PrintStr("\\draw [c");
313 PrintStr(",line width=");
315 if (fCurrentAlpha != 1.) {
316 PrintStr(", opacity=");
318 }
319 PrintStr("] (");
321 PrintFast(1,",");
323 PrintStr(") -- (");
325 PrintFast(1,",");
327 PrintStr(") -- (");
329 PrintFast(1,",");
331 PrintStr(") -- (");
333 PrintFast(1,",");
335 PrintStr(") -- (");
337 PrintFast(1,",");
339 PrintStr(");");
340 }
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Draw a Frame around a box
345///
346/// mode = -1 the box looks as it is behind the screen
347/// mode = 1 the box looks as it is in front of the screen
348/// border is the border size in already pre-computed TeX units dark is the
349/// color for the dark part of the frame light is the color for the light
350/// part of the frame
351
354{
355 Warning("DrawFrame", "not yet implemented");
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Draw a PolyLine
360///
361/// Draw a polyline through the points xy.
362/// - If NN=1 moves only to point x,y.
363/// - If NN=0 the x,y are written in the TeX file
364/// according to the current transformation.
365/// - If NN>0 the line is clipped as a line.
366/// - If NN<0 the line is clipped as a fill area.
367
369{
370 Warning("DrawPolyLine", "not yet implemented");
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Draw a PolyLine in NDC space
375///
376/// Draw a polyline through the points xy.
377/// - If NN=1 moves only to point x,y.
378/// - If NN=0 the x,y are written in the TeX file
379/// according to the current transformation.
380/// - If NN>0 the line is clipped as a line.
381/// - If NN<0 the line is clipped as a fill area.
382
384{
385 Warning("DrawPolyLineNDC", "not yet implemented");
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// Paint PolyMarker
390
391template<typename T>
393{
394 Int_t markerSize = 0;
395 std::vector<TPoint> points;
396 auto shape = GetMarkerShape(markerSize, points, 1., kDotAsCircle | kUsePSWidthScale);
397 if ((shape == kShapeDot) && (markerSize > 1))
398 shape = kShapeFilledCircle;
399 auto markerLineWidth = TAttMarker::GetMarkerLineWidth(GetMarkerStyle());
400 Bool_t do_fill = (shape == kShapeFilledCircle) || (shape == kShapeFilledArea) || (shape == kShapeTriangles);
401
402 TString name = TString::Format("root_marker%d", (Int_t) GetMarkerStyle());
403 if ((shape == kShapeDot) || (shape == kShapeFilledCircle)) {
404 name = "*";
405 fMarkers[GetMarkerStyle()] = true;
406 } else if (shape == kShapeCircle) {
407 name = "o";
408 fMarkers[GetMarkerStyle()] = true;
409 }
410 if (!fMarkers[GetMarkerStyle()]) {
411 // define marker once
412 fMarkers[GetMarkerStyle()] = true;
413 Int_t sz0 = 0;
414 // get shape for normal marker size to avoid rounding problems
416 // select coefficient so that relative movements are -1 .. 1
417 Float_t k = sz0 > 0 ? 2. / sz0 : 0.02;
418
419 PrintStr(TString::Format("@\\pgfdeclareplotmark{%s} {@", name.Data()));
420 switch(shape) {
421 case kShapePolyLine:
422 case kShapeFilledArea:
423 for (std::size_t i = 0; i < points.size(); i++)
424 PrintStr(TString::Format("\\pgfpath%s{\\pgfpoint{%4.2f\\pgfplotmarksize}{%4.2f\\pgfplotmarksize}}@",
425 i == 0 ? "moveto" : "lineto", k * points[i].fX, -k * points[i].fY ));
426 PrintStr("\\pgfpathclose@");
427
428 if (shape == kShapePolyLine)
429 PrintStr("\\pgfusepathqstroke@");
430 else
431 PrintStr("\\pgfusepathqfillstroke@");
432 break;
433 case kShapeSegments:
434 for (std::size_t i = 0; i < points.size(); i++)
435 PrintStr(TString::Format("\\pgfpath%s{\\pgfpoint{%4.2f\\pgfplotmarksize}{%4.2f\\pgfplotmarksize}}@",
436 i % 2 == 0 ? "moveto" : "lineto", k * points[i].fX, -k * points[i].fY ));
437 PrintStr("\\pgfpathclose@");
438 PrintStr("\\pgfusepathqstroke@");
439 break;
440 case kShapeTriangles:
441 for (std::size_t i = 0; i < points.size(); i++)
442 PrintStr(TString::Format("\\pgfpath%s{\\pgfpoint{%4.2f\\pgfplotmarksize}{%4.2f\\pgfplotmarksize}}@",
443 i % 3 == 0 ? "moveto" : "lineto", k * points[i].fX, -k * points[i].fY ));
444 PrintStr("\\pgfpathclose@");
445 PrintStr("\\pgfusepathqfillstroke@");
446 break;
447 default:
448 // all other shapes handled already
449 break;
450 }
451 PrintStr("}@");
452 }
453
455
456 PrintStr("@");
457 PrintStr("\\foreach \\P in {");
458
459 for (Int_t i = 0; i < n; i++) {
460 auto x = XtoTeX(xw[i]);
461 auto y = YtoTeX(yw[i]);
462 if (i == 0)
463 PrintFast(1, "(");
464 else
465 PrintFast(3, ", (");
467 PrintFast(1, ",");
469 PrintFast(1, ")");
470 }
471
472 PrintStr("}{\\draw[mark options={color=c");
473
474 if (do_fill)
475 PrintStr(",fill=c");
476
477 if (fCurrentAlpha != 1.) {
478 PrintStr(",opacity=");
480 }
481
482 PrintStr(TString::Format("}, mark size=%4.2fpt", 0.3 * markerSize));
483 // intentionally default line width is 0, only large widths scale differently
484 if (!do_fill && (markerLineWidth > 0))
485 PrintStr(TString::Format(", line width=%4.2fpt", markerLineWidth > 1 ? 0.2 * gStyle->GetLineScalePS() * markerLineWidth : 0.));
486 PrintStr(", mark=");
487 PrintStr(name);
488 PrintStr("] plot coordinates {\\P};}");
489}
490
491
492////////////////////////////////////////////////////////////////////////////////
493/// Paint PolyMarker
494
499
500////////////////////////////////////////////////////////////////////////////////
501/// Paint PolyMarker
502
507
508////////////////////////////////////////////////////////////////////////////////
509/// This function defines a path with xw and yw and draw it according the
510/// value of nn:
511///
512/// - If nn>0 a line is drawn.
513/// - If nn<0 a closed polygon is drawn.
514
516{
517 Int_t n = TMath::Abs(nn);
518 Float_t x, y;
519
520 if( n <= 1) {
521 Error("DrawPS", "Two points are needed");
522 return;
523 }
524
525 x = XtoTeX(xw[0]);
526 y = YtoTeX(yw[0]);
527
528 Int_t fillis = fFillStyle/1000;
529 Int_t fillsi = fFillStyle%1000;
530
531 if (nn>0) {
532 if (fLineWidth<=0) return;
534 PrintStr("@");
535 PrintStr("\\draw [c");
539 if (stripped.Length()) {
540 tikzSpec.Append(",dash pattern=");
541 Ssiz_t i{0}, j{0};
542 bool on{true}, iterate{true};
543
544 while (iterate){
545 j = stripped.Index(" ", 1, i, TString::kExact);
546 if (j == kNPOS){
547 iterate = false;
548 j = stripped.Length();
549 }
550
551 if (on) {
552 tikzSpec.Append("on ");
553 on = false;
554 } else {
555 tikzSpec.Append("off ");
556 on = true;
557 }
558 int num = TString{stripped(i, j - i)}.Atoi();
559 float pt = 0.2*num;
560 tikzSpec.Append(TString::Format("%.2fpt ", pt));
561 i = j + 1;
562 }
563 PrintStr(tikzSpec.Data());
564 }
565 PrintStr(",line width=");
567 if (fCurrentAlpha != 1.) {
568 PrintStr(",opacity=");
570 }
571 } else {
573 if (fillis==1) {
574 PrintStr("@");
575 PrintStr("\\draw [c, fill=c");
576 } else if (fillis==0) {
577 PrintStr("@");
578 PrintStr("\\draw [c");
579 } else {
580 PrintStr("\\draw [pattern=");
581 switch (fillsi) {
582 case 1 :
583 PrintStr("crosshatch dots");
584 break;
585 case 2 :
586 case 3 :
587 PrintStr("dots");
588 break;
589 case 4 :
590 PrintStr("north east lines");
591 break;
592 case 5 :
593 PrintStr("north west lines");
594 break;
595 case 6 :
596 PrintStr("vertical lines");
597 break;
598 case 7 :
599 PrintStr("horizontal lines");
600 break;
601 case 10 :
602 PrintStr("bricks");
603 break;
604 case 13 :
605 PrintStr("crosshatch");
606 break;
607 }
608 PrintStr(", draw=none, pattern color=c");
609 }
610 if (fCurrentAlpha != 1.) {
611 PrintStr(", fill opacity=");
613 }
614 }
615 PrintStr("] (");
617 PrintFast(1,",");
619 PrintStr(") -- ");
620
621 for (Int_t i=1;i<n;i++) {
622 x = XtoTeX(xw[i]);
623 y = YtoTeX(yw[i]);
624 PrintFast(1,"(");
626 PrintFast(1,",");
628 PrintFast(1,")");
629 if (i<n-1) PrintStr(" -- ");
630 else PrintStr(";@");
631 }
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Start the TeX page. This function starts the tikzpicture environment
636
638{
639 // Compute pad conversion coefficients
640 if (gPad) {
641 Double_t ww = gPad->GetWw();
642 Double_t wh = gPad->GetWh();
643 fYsize = fXsize*wh/ww;
644 } else {
645 fYsize = 27;
646 }
647
648 if(!fBoundingBox) {
649 PrintStr("\\begin{tikzpicture}@");
650 PrintStr("\\def\\CheckTikzLibraryLoaded#1{ \\ifcsname tikz@library@#1@loaded\\endcsname \\else \\PackageWarning{tikz}{usetikzlibrary{#1} is missing in the preamble.} \\fi }@");
651 PrintStr("\\CheckTikzLibraryLoaded{patterns}@");
652 PrintStr("\\CheckTikzLibraryLoaded{plotmarks}@");
654 }
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// Set the range for the paper in centimetres
659
661{
662 fXsize = xsize;
663 fYsize = ysize;
664
665 fRange = kTRUE;
666}
667
668////////////////////////////////////////////////////////////////////////////////
669/// Set color index for fill areas
670
675
676////////////////////////////////////////////////////////////////////////////////
677/// Set color index for lines
678
683
684////////////////////////////////////////////////////////////////////////////////
685/// Change the line style
686///
687/// - linestyle = 2 dashed
688/// - linestyle = 3 dotted
689/// - linestyle = 4 dash-dotted
690/// - linestyle = else solid (1 in is used most of the time)
691
696
697////////////////////////////////////////////////////////////////////////////////
698/// Set the lines width.
699
704
705////////////////////////////////////////////////////////////////////////////////
706/// Set size for markers.
707
712
713////////////////////////////////////////////////////////////////////////////////
714/// Set color index for markers.
715
720
721////////////////////////////////////////////////////////////////////////////////
722/// Set color with its color index
723
725{
726 if (color < 0) color = 0;
727 TColor *col = gROOT->GetColor(color);
728
729 if (col) {
730 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
731 fCurrentAlpha = col->GetAlpha();
732 } else {
733 SetColor(1., 1., 1.);
734 fCurrentAlpha = 1.;
735 }
736}
737
738////////////////////////////////////////////////////////////////////////////////
739/// Set color with its R G B components
740///
741/// - r: % of red in [0,1]
742/// - g: % of green in [0,1]
743/// - b: % of blue in [0,1]
744
746{
747 if (fCurrentRed == r && fCurrentGreen == g && fCurrentBlue == b) return;
748
749 fCurrentRed = r;
751 fCurrentBlue = b;
752 PrintStr("@");
753 PrintStr("\\definecolor{c}{rgb}{");
755 PrintFast(1,",");
757 PrintFast(1,",");
759 PrintFast(2,"};");
760}
761
762////////////////////////////////////////////////////////////////////////////////
763/// Set color index for text
764
769
770////////////////////////////////////////////////////////////////////////////////
771/// Draw text
772///
773/// - xx: x position of the text
774/// - yy: y position of the text
775/// - chars: text to be drawn
776
778{
779 Double_t wh = (Double_t)gPad->GetPadWidth();
780 Double_t hh = (Double_t)gPad->GetPadHeight();
782 if (wh < hh) {
784 Int_t sizeTTF = (Int_t)(tsize+0.5);
785 ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
786 } else {
788 Int_t sizeTTF = (Int_t)(tsize+0.5);
789 ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
790 }
791 ftsize *= 2.22097;
792 if (ftsize <= 0) return;
793
794 TString t(chars);
795 if (t.Index("\\")>=0 || t.Index("^{")>=0 || t.Index("_{")>=0) {
796 t.Prepend("$");
797 t.Append("$");
798 } else {
799 t.ReplaceAll("<","$<$");
800 t.ReplaceAll(">","$>$");
801 t.ReplaceAll("_","\\_");
802 }
803 t.ReplaceAll("&","\\&");
804 t.ReplaceAll("#","\\#");
805 t.ReplaceAll("%","\\%");
806
808 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
810 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
812 PrintStr("@");
813 PrintStr("\\draw");
814 if (txalh!=2 || txalv!=2) {
815 PrintStr(" [anchor=");
816 if (txalv==1) PrintStr("base");
817 if (txalv==3) PrintStr("north");
818 if (txalh==1) PrintStr(" west");
819 if (txalh==3) PrintStr(" east");
820 PrintFast(1,"]");
821 }
822 PrintFast(2," (");
824 PrintFast(1,",");
826 PrintStr(") node[scale=");
828 PrintStr(", color=c");
829 if (fCurrentAlpha != 1.) {
830 PrintStr(",opacity=");
832 }
833 PrintStr(", rotate=");
835 PrintFast(2,"]{");
836 PrintStr(t.Data());
837 PrintFast(2,"};");
838}
839
840////////////////////////////////////////////////////////////////////////////////
841/// Draw text with URL. Same as Text.
842///
843
844void TTeXDump::TextUrl(Double_t x, Double_t y, const char *chars, const char *)
845{
846 Text(x, y, chars);
847}
848
849////////////////////////////////////////////////////////////////////////////////
850/// Write a string of characters in NDC
851
853{
854 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
855 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
856 Text(x, y, chars);
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Convert U from NDC coordinate to TeX
861
863{
864 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
865 return cm;
866}
867
868////////////////////////////////////////////////////////////////////////////////
869/// Convert V from NDC coordinate to TeX
870
872{
873 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
874 return cm;
875}
876
877////////////////////////////////////////////////////////////////////////////////
878/// Convert X from world coordinate to TeX
879
881{
882 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
883 return UtoTeX(u);
884}
885
886////////////////////////////////////////////////////////////////////////////////
887/// Convert Y from world coordinate to TeX
888
890{
891 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
892 return VtoTeX(v);
893}
894
895////////////////////////////////////////////////////////////////////////////////
896/// Begin the Cell Array painting
897
899 Double_t)
900{
901 Warning("CellArrayBegin", "not yet implemented");
902}
903
904////////////////////////////////////////////////////////////////////////////////
905/// Paint the Cell Array
906
908{
909 Warning("CellArrayFill", "not yet implemented");
910}
911
912////////////////////////////////////////////////////////////////////////////////
913/// End the Cell Array painting
914
916{
917 Warning("CellArrayEnd", "not yet implemented");
918}
919
920////////////////////////////////////////////////////////////////////////////////
921/// Not needed in TeX case
922
924{
925 Warning("DrawPS", "not yet implemented");
926}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Style number (short)
Definition RtypesCore.h:97
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Size_t
Attribute size (float)
Definition RtypesCore.h:104
short Width_t
Line width (short)
Definition RtypesCore.h:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:132
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t cindex
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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
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 y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Option_t Option_t TPoint TPoint const char y1
char name[80]
Definition TGX11.cxx:148
#define gROOT
Definition TROOT.h:417
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TVirtualPS * gVirtualPS
Definition TVirtualPS.h:88
#define gPad
Style_t fFillStyle
Fill area style.
Definition TAttFill.h:25
Color_t fFillColor
Fill area color.
Definition TAttFill.h:24
Width_t fLineWidth
Line width.
Definition TAttLine.h:26
Style_t fLineStyle
Line style.
Definition TAttLine.h:25
Color_t fLineColor
Line color.
Definition TAttLine.h:24
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition TAttMarker.h:35
virtual Color_t GetMarkerColor() const
Return the marker color.
Definition TAttMarker.h:34
Color_t fMarkerColor
Marker color.
Definition TAttMarker.h:25
@ kUsePSWidthScale
Definition TAttMarker.h:53
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition TAttMarker.h:36
EMarkerShape GetMarkerShape(Int_t &sz, std::vector< TPoint > &points, Float_t scale=1., UInt_t flags=0) const
Return marker shape.
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
TAttMarker()
TAttMarker default constructor.
Size_t fMarkerSize
Marker size.
Definition TAttMarker.h:27
@ kShapeTriangles
Definition TAttMarker.h:48
@ kShapeFilledArea
Definition TAttMarker.h:48
@ kShapeFilledCircle
Definition TAttMarker.h:48
Color_t fTextColor
Text color.
Definition TAttText.h:27
Float_t fTextAngle
Text angle.
Definition TAttText.h:24
Short_t fTextAlign
Text alignment.
Definition TAttText.h:26
Float_t fTextSize
Text size.
Definition TAttText.h:25
The color creation and management class.
Definition TColor.h:22
Float_t GetRed() const
Definition TColor.h:61
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1939
Float_t GetAlpha() const
Definition TColor.h:67
Float_t GetBlue() const
Definition TColor.h:63
Float_t GetGreen() const
Definition TColor.h:62
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1082
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1096
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
2-D graphics point (world coordinates).
Definition TPoints.h:19
Basic string class.
Definition TString.h:138
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:2068
const char * Data() const
Definition TString.h:386
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:715
@ kBoth
Definition TString.h:284
@ kExact
Definition TString.h:285
TString & Prepend(const char *cs)
Definition TString.h:684
TString & Append(const char *cs)
Definition TString.h:583
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2459
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:662
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1167
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
Definition TStyle.cxx:1184
Float_t GetLineScalePS() const
Definition TStyle.h:291
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TTeXDump.cxx:907
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TTeXDump.cxx:692
void SetLineScale(Float_t scale=1)
Definition TTeXDump.h:72
std::map< Style_t, bool > fMarkers
map of already defined markers
Definition TTeXDump.h:37
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Not needed in TeX case.
Definition TTeXDump.cxx:923
void Close(Option_t *opt="") override
Close a TeX file.
Definition TTeXDump.cxx:184
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition TTeXDump.cxx:383
void On()
Activate an already open TeX file.
Definition TTeXDump.cxx:207
void Open(const char *filename, Int_t type=-111) override
Open a TeX file.
Definition TTeXDump.cxx:113
Bool_t fStandalone
True when a TeX file should be standalone.
Definition TTeXDump.h:30
Bool_t fBoundingBox
True when the TeX header is printed.
Definition TTeXDump.h:28
Float_t fCurrentRed
Current Red component.
Definition TTeXDump.h:31
void TextUrl(Double_t x, Double_t y, const char *string, const char *url) override
Draw text with URL.
Definition TTeXDump.cxx:844
Float_t fXsize
Page size along X.
Definition TTeXDump.h:25
void SetLineWidth(Width_t linewidth=1) override
Set the lines width.
Definition TTeXDump.cxx:700
Float_t VtoTeX(Double_t v)
Convert V from NDC coordinate to TeX.
Definition TTeXDump.cxx:871
void NewPage() override
Start the TeX page. This function starts the tikzpicture environment.
Definition TTeXDump.cxx:637
Bool_t fRange
True when a range has been defined.
Definition TTeXDump.h:29
void SetFillColor(Color_t cindex=1) override
Set color index for fill areas.
Definition TTeXDump.cxx:671
~TTeXDump() override
Default TeX destructor.
Definition TTeXDump.cxx:176
void DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt, Int_t mode, Int_t border, Int_t dark, Int_t light) override
Draw a Frame around a box.
Definition TTeXDump.cxx:352
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override
Paint PolyMarker.
Definition TTeXDump.cxx:495
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TTeXDump.cxx:660
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TTeXDump.cxx:231
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override
Begin the Cell Array painting.
Definition TTeXDump.cxx:898
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TTeXDump.cxx:765
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TTeXDump.cxx:679
Float_t fCurrentAlpha
Current Alpha value.
Definition TTeXDump.h:34
void CellArrayEnd() override
End the Cell Array painting.
Definition TTeXDump.cxx:915
Float_t fLineScale
Line width scale factor.
Definition TTeXDump.h:35
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition TTeXDump.cxx:852
Int_t fType
Workstation type used to know if the Tex is open.
Definition TTeXDump.h:27
void DrawPolyMarkerShape(Int_t n, T *xw, T *yw)
Paint PolyMarker.
Definition TTeXDump.cxx:392
Float_t UtoTeX(Double_t u)
Convert U from NDC coordinate to TeX.
Definition TTeXDump.cxx:862
Float_t YtoTeX(Double_t y)
Convert Y from world coordinate to TeX.
Definition TTeXDump.cxx:889
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition TTeXDump.cxx:368
void Off()
Deactivate an already open TeX file.
Definition TTeXDump.cxx:223
TTeXDump()
Default TeX constructor.
Definition TTeXDump.cxx:89
Float_t fCurrentGreen
Current Green component.
Definition TTeXDump.h:32
Float_t fYsize
Page size along Y.
Definition TTeXDump.h:26
void Text(Double_t x, Double_t y, const char *string) override
Draw text.
Definition TTeXDump.cxx:777
void SetMarkerSize(Size_t msize=1) override
Set size for markers.
Definition TTeXDump.cxx:708
void SetColor(Int_t color=1)
Set color with its color index.
Definition TTeXDump.cxx:724
Float_t fCurrentBlue
Current Blue component.
Definition TTeXDump.h:33
Float_t XtoTeX(Double_t x)
Convert X from world coordinate to TeX.
Definition TTeXDump.cxx:880
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TTeXDump.cxx:716
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition TVirtualPS.h:30
Int_t fLenBuffer
Definition TVirtualPS.h:38
void CloseStream()
Close existing stream.
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
virtual void PrintFast(Int_t nch, const char *string="")
Fast version of Print.
std::ofstream * fStream
Definition TVirtualPS.h:41
Bool_t OpenStream(const char *fname, Bool_t binary=kFALSE)
Open output stream.
void ClearBuffer()
Clear content of internal buffer.
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
TPaveText * pt
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
int iterate(rng_state_t *X)
Definition mixmax.icc:34
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122