Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSVG.cxx
Go to the documentation of this file.
1// @(#)root/postscript:$Id$
2// Author: Olivier Couet
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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 <cmath>
20#include <fstream>
21
22#include "TROOT.h"
23#include "TDatime.h"
24#include "TBase64.h"
25#include "TColor.h"
26#include "TVirtualPad.h"
27#include "TPoints.h"
28#include "TSVG.h"
29#include "TStyle.h"
30#include "TMath.h"
31#include "TObjString.h"
32#include "TObjArray.h"
33#include "snprintf.h"
34
37
38const Double_t kEpsilon = 1e-9;
39
40/** \class TSVG
41\ingroup PS
42
43\brief Interface to SVG
44
45[SVG](http://www.w3.org/Graphics/SVG/Overview.htm8)
46(Scalable Vector Graphics) is a language for describing
47two-dimensional graphics in XML. SVG allows high quality vector graphics in
48HTML pages.
49
50To print a ROOT canvas "c1" into an SVG file simply do:
51~~~ {.cpp}
52 c1->Print("c1.svg");
53~~~
54The result is the ASCII file `c1.svg`.
55
56It can be open directly using a web browser or included in a html document
57the following way:
58~~~ {.cpp}
59<embed width="95%" height="500" src="c1.svg">
60~~~
61It is best viewed with Internet Explorer and you need the
62[Adobe SVG Viewer](http://www.adobe.com/svg/viewer/install/main.html)
63
64To zoom using the Adobe SVG Viewer, position the mouse over
65the area you want to zoom and click the right button.
66
67To define the zoom area,
68use Control+drag to mark the boundaries of the zoom area.
69
70To pan, use Alt+drag.
71By clicking with the right mouse button on the SVG graphics you will get
72a pop-up menu giving other ways to interact with the image.
73
74SVG files can be used directly in compressed mode to minimize the time
75transfer over the network. Compressed SVG files should be created using
76`gzip` on a normal ASCII SVG file and should then be renamed
77using the file extension `.svgz`.
78*/
79
80////////////////////////////////////////////////////////////////////////////////
81/// Default SVG constructor
82
84{
85 fStream = nullptr;
86 fType = 0;
88 gVirtualPS = this;
90 fRange = kFALSE;
91 fXsize = 0.;
92 fYsize = 0.;
93 fYsizeSVG = 0;
94 SetTitle("SVG");
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Initialize the SVG interface
99///
100/// - fname : SVG file name
101/// - wtype : SVG workstation type. Not used in the SVG driver. But as TSVG
102/// inherits from TVirtualPS it should be kept. Anyway it is not
103/// necessary to specify this parameter at creation time because it
104/// has a default value (which is ignore in the SVG case).
105
107{
108 fStream = nullptr;
109 SetTitle("SVG");
111 Open(fname, wtype);
112}
113
114////////////////////////////////////////////////////////////////////////////////
115/// Open a SVG file
116
117void TSVG::Open(const char *fname, Int_t wtype)
118{
119 if (fStream) {
120 Warning("Open", "SVG file already open");
121 return;
122 }
123
124 fLenBuffer = 0;
125 fType = abs(wtype);
131 if (gPad) {
132 Double_t ww = gPad->GetWw();
133 Double_t wh = gPad->GetWh();
134 ww *= gPad->GetWNDC();
135 wh *= gPad->GetHNDC();
136 Double_t ratio = wh/ww;
137 xrange = fXsize;
138 yrange = fXsize*ratio;
139 if (yrange > fYsize) { yrange = fYsize; xrange = yrange/ratio;}
141 }
142
143 // Open OS file
144 fStream = new std::ofstream(fname,std::ios::out);
145 if (!fStream || !fStream->good()) {
146 printf("ERROR in TSVG::Open: Cannot open file:%s\n",fname);
147 if (!fStream) return;
148 }
149
150 gVirtualPS = this;
151
152 for (Int_t i=0;i<fSizBuffer;i++) fBuffer[i] = ' ';
153
155
156 fRange = kFALSE;
157
158 // Set a default range
160
161 NewPage();
162}
163
164////////////////////////////////////////////////////////////////////////////////
165/// Default SVG destructor
166
168{
169 Close();
170}
171
172////////////////////////////////////////////////////////////////////////////////
173/// Close a SVG file
174
176{
177 if (!gVirtualPS) return;
178 if (!fStream) return;
179 if (gPad) gPad->Update();
180 PrintStr("</svg>@");
181
182 // Close file stream
183 if (fStream) { fStream->close(); delete fStream; fStream = nullptr;}
184
185 gVirtualPS = nullptr;
186}
187
188////////////////////////////////////////////////////////////////////////////////
189/// Activate an already open SVG file
190
192{
193 // fType is used to know if the SVG file is open. Unlike TPostScript, TSVG
194 // has no "workstation type". In fact there is only one SVG type.
195
196 if (!fType) {
197 Error("On", "no SVG file open");
198 Off();
199 return;
200 }
201 gVirtualPS = this;
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Deactivate an already open SVG file
206
208{
209 gVirtualPS = nullptr;
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Draw a Box
214
216{
217 static Double_t x[4], y[4];
222 Int_t fillis = fFillStyle/1000;
223 Int_t fillsi = fFillStyle%1000;
224
225 if (fillis == 3 || fillis == 2) {
226 if (fillsi > 99) {
227 x[0] = x1; y[0] = y1;
228 x[1] = x2; y[1] = y1;
229 x[2] = x2; y[2] = y2;
230 x[3] = x1; y[3] = y2;
231 return;
232 }
233 if (fillsi > 0 && fillsi < 26) {
234 x[0] = x1; y[0] = y1;
235 x[1] = x2; y[1] = y1;
236 x[2] = x2; y[2] = y2;
237 x[3] = x1; y[3] = y2;
238 DrawPS(-4, &x[0], &y[0]);
239 }
240 if (fillsi == -3) {
241 PrintStr("@");
242 PrintFast(9,"<rect x=\"");
244 PrintFast(5,"\" y=\"");
246 PrintFast(9,"\" width=\"");
248 PrintFast(10,"\" height=\"");
250 PrintFast(7,"\" fill=");
252 PrintFast(2,"/>");
253 }
254 }
255 if (fillis == 1) {
256 PrintStr("@");
257 PrintFast(9,"<rect x=\"");
259 PrintFast(5,"\" y=\"");
261 PrintFast(9,"\" width=\"");
263 PrintFast(10,"\" height=\"");
265 PrintFast(7,"\" fill=");
267 PrintFast(2,"/>");
268 }
269 if (fillis == 0) {
270 if (fLineWidth<=0) return;
271 PrintStr("@");
272 PrintFast(9,"<rect x=\"");
274 PrintFast(5,"\" y=\"");
276 PrintFast(9,"\" width=\"");
278 PrintFast(10,"\" height=\"");
280 PrintFast(21,"\" fill=\"none\" stroke=");
282 PrintFast(2,"/>");
283 }
284}
285
286////////////////////////////////////////////////////////////////////////////////
287/// Print a svg path statement for specified points
288
290{
291 Double_t idx = 0, idy = 0;
292
293 Double_t ixd0 = convert ? XtoSVG(xps[0]) : xps[0];
294 Double_t iyd0 = convert ? YtoSVG(yps[0]) : yps[0];
296
297 PrintFast(1,"M");
299 PrintFast(1,",");
301
302 for (Int_t i = 1; i < n; i++) {
303 Double_t ixdi = convert ? XtoSVG(xps[i]) : xps[i];
304 Double_t iydi = convert ? YtoSVG(yps[i]) : yps[i];
305
306 Double_t ix = ixdi - ixd0;
307 Double_t iy = iydi - iyd0;
308
309 if (fCompact && (TMath::Abs(ix) < kEpsilon))
310 ix = 0;
311 if (fCompact && (TMath::Abs(iy) < kEpsilon))
312 iy = 0;
313
314 ixd0 = ixdi;
315 iyd0 = iydi;
316 if(ix && iy) {
317 if(idx) {
318 MovePS(idx, 0);
319 idx = 0;
320 }
321 if(idy) {
322 MovePS(0, idy);
323 idy = 0;
324 }
325 MovePS(ix, iy);
326 continue;
327 }
328 if (ix) {
329 if(idy) {
330 MovePS(0, idy);
331 idy = 0;
332 }
333 if(!idx || (ix*idx > 0)) {
334 idx += ix;
335 } else {
336 MovePS(idx, 0);
337 idx = ix;
338 }
339 continue;
340 }
341 if(iy) {
342 if(idx) {
343 MovePS(idx, 0);
344 idx = 0;
345 }
346 if(!idy || (iy*idy > 0)) {
347 idy += iy;
348 } else {
349 MovePS(0, idy);
350 idy = iy;
351 }
352 }
353 }
354 if(idx)
355 MovePS(idx, 0);
356 if(idy)
357 MovePS(0, idy);
358
360 PrintFast(1, "z");
361}
362
363////////////////////////////////////////////////////////////////////////////////
364/// Draw a Frame around a box
365///
366/// - mode = -1 the box looks as it is behind the screen
367/// - mode = 1 the box looks as it is in front of the screen
368/// - border is the border size in already pre-computed SVG units dark is the
369/// color for the dark part of the frame light is the color for the light
370/// part of the frame
371
373 Int_t mode, Int_t border, Int_t dark, Int_t light)
374{
375 Double_t xps[7], yps[7];
376
377 //- Draw top&left part of the box
378 xps[0] = XtoSVG(xl); yps[0] = YtoSVG(yl);
379 xps[1] = xps[0] + border; yps[1] = yps[0] - border;
380 xps[2] = xps[1]; yps[2] = YtoSVG(yt) + border;
381 xps[3] = XtoSVG(xt) - border; yps[3] = yps[2];
382 xps[4] = XtoSVG(xt); yps[4] = YtoSVG(yt);
383 xps[5] = xps[0]; yps[5] = yps[4];
384 xps[6] = xps[0]; yps[6] = yps[0];
385
386 PrintStr("@");
387 PrintFast(9,"<path d=\"");
388 PrintPath(kFALSE, 7, xps, yps);
389 PrintFast(7,"\" fill=");
390 SetColorAlpha(mode == -1 ? dark : light);
392 PrintFast(2,"/>");
393
394 //- Draw bottom&right part of the box
395 xps[0] = XtoSVG(xl); yps[0] = YtoSVG(yl);
396 xps[1] = xps[0] + border; yps[1] = yps[0] - border;
397 xps[2] = XtoSVG(xt) - border; yps[2] = yps[1];
398 xps[3] = xps[2]; yps[3] = YtoSVG(yt) + border;
399 xps[4] = XtoSVG(xt); yps[4] = YtoSVG(yt);
400 xps[5] = xps[4]; yps[5] = yps[0];
401 xps[6] = xps[0]; yps[6] = yps[0];
402
403 PrintStr("@");
404 PrintFast(9,"<path d=\"");
405 PrintPath(kFALSE, 7, xps, yps);
406 PrintFast(7,"\" fill=");
407 SetColorAlpha(mode == -1 ? light : dark);
409 PrintFast(2,"/>");
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Draw a PolyLine
414///
415/// Draw a polyline through the points xy.
416/// - If NN=1 moves only to point x,y.
417/// - If NN=0 the x,y are written in the SVG file
418/// according to the current transformation.
419/// - If NN>0 the line is clipped as a line.
420/// - If NN<0 the line is clipped as a fill area.
421
423{
424 Warning("DrawPolyLine", "not implemented");
425}
426
427////////////////////////////////////////////////////////////////////////////////
428/// Draw a PolyLine in NDC space
429///
430/// Draw a polyline through the points xy.
431/// --If NN=1 moves only to point x,y.
432/// --If NN=0 the x,y are written in the SVG file
433/// according to the current transformation.
434/// --If NN>0 the line is clipped as a line.
435/// - If NN<0 the line is clipped as a fill area.
436
438{
439 Warning("DrawPolyLineNDC", "not implemented");
440}
441
442////////////////////////////////////////////////////////////////////////////////
443/// Implementation of polymarker printing
444
445template<class T>
447{
450
451 if (ms == 4)
452 ms = 24;
453 else if (ms >= 6 && ms <= 8)
454 ms = 20;
455 else if (ms >= 9 && ms <= 19)
456 ms = 1;
457
458 // Define the marker size
460 if (fMarkerStyle == 1 || (fMarkerStyle >= 9 && fMarkerStyle <= 19)) msize = 0.01;
461 if (fMarkerStyle == 6) msize = 0.02;
462 if (fMarkerStyle == 7) msize = 0.04;
463
464 const Int_t kBASEMARKER = 8;
466 Float_t s2x = sbase / Float_t(gPad->GetWw() * gPad->GetAbsWNDC());
467 msize = this->UtoSVG(s2x) - this->UtoSVG(0);
468
469 Double_t m = msize;
470 Double_t m2 = m/2;
471 Double_t m3 = m/3;
472 Double_t m6 = m/6;
473 Double_t m4 = m/4.;
474 Double_t m8 = m/8.;
475 Double_t m0 = m/10.;
476
477 // Draw the marker according to the type
478 PrintStr("@");
479 if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34 ||
480 ms == 39 || ms == 41 || ms == 43 || ms == 45 ||
481 ms == 47 || ms == 48 || ms == 49) {
482 PrintStr("<g fill=");
484 PrintStr(">");
485 } else {
486 PrintStr("<g stroke=");
488 PrintStr(" stroke-width=\"");
490 PrintStr("\" fill=\"none\"");
492 PrintStr(">");
493 }
494 for (Int_t i = 0; i < n; i++) {
495 Double_t ix = XtoSVG(xw[i]);
496 Double_t iy = YtoSVG(yw[i]);
497 PrintStr("@");
498 // Dot (.)
499 if (ms == 1) {
500 PrintStr("<line x1=\"");
501 WriteReal(ix-1, kFALSE);
502 PrintStr("\" y1=\"");
503 WriteReal(iy, kFALSE);
504 PrintStr("\" x2=\"");
505 WriteReal(ix, kFALSE);
506 PrintStr("\" y2=\"");
507 WriteReal(iy, kFALSE);
508 PrintStr("\"/>");
509 // Plus (+)
510 } else if (ms == 2) {
511 PrintStr("<line x1=\"");
512 WriteReal(ix-m2, kFALSE);
513 PrintStr("\" y1=\"");
514 WriteReal(iy, kFALSE);
515 PrintStr("\" x2=\"");
516 WriteReal(ix+m2, kFALSE);
517 PrintStr("\" y2=\"");
518 WriteReal(iy, kFALSE);
519 PrintStr("\"/>");
520
521 PrintStr("<line x1=\"");
522 WriteReal(ix, kFALSE);
523 PrintStr("\" y1=\"");
524 WriteReal(iy-m2, kFALSE);
525 PrintStr("\" x2=\"");
526 WriteReal(ix, kFALSE);
527 PrintStr("\" y2=\"");
528 WriteReal(iy+m2, kFALSE);
529 PrintStr("\"/>");
530 // X shape (X)
531 } else if (ms == 5) {
532 PrintStr("<line x1=\"");
533 WriteReal(ix-m2*0.707, kFALSE);
534 PrintStr("\" y1=\"");
535 WriteReal(iy-m2*0.707, kFALSE);
536 PrintStr("\" x2=\"");
537 WriteReal(ix+m2*0.707, kFALSE);
538 PrintStr("\" y2=\"");
539 WriteReal(iy+m2*0.707, kFALSE);
540 PrintStr("\"/>");
541
542 PrintStr("<line x1=\"");
543 WriteReal(ix-m2*0.707, kFALSE);
544 PrintStr("\" y1=\"");
545 WriteReal(iy+m2*0.707, kFALSE);
546 PrintStr("\" x2=\"");
547 WriteReal(ix+m2*0.707, kFALSE);
548 PrintStr("\" y2=\"");
549 WriteReal(iy-m2*0.707, kFALSE);
550 PrintStr("\"/>");
551 // Asterisk shape (*)
552 } else if (ms == 3 || ms == 31) {
553 PrintStr("<line x1=\"");
554 WriteReal(ix-m2, kFALSE);
555 PrintStr("\" y1=\"");
556 WriteReal(iy, kFALSE);
557 PrintStr("\" x2=\"");
558 WriteReal(ix+m2, kFALSE);
559 PrintStr("\" y2=\"");
560 WriteReal(iy, kFALSE);
561 PrintStr("\"/>");
562
563 PrintStr("<line x1=\"");
564 WriteReal(ix, kFALSE);
565 PrintStr("\" y1=\"");
566 WriteReal(iy-m2, kFALSE);
567 PrintStr("\" x2=\"");
568 WriteReal(ix, kFALSE);
569 PrintStr("\" y2=\"");
570 WriteReal(iy+m2, kFALSE);
571 PrintStr("\"/>");
572
573 PrintStr("<line x1=\"");
574 WriteReal(ix-m2*0.707, kFALSE);
575 PrintStr("\" y1=\"");
576 WriteReal(iy-m2*0.707, kFALSE);
577 PrintStr("\" x2=\"");
578 WriteReal(ix+m2*0.707, kFALSE);
579 PrintStr("\" y2=\"");
580 WriteReal(iy+m2*0.707, kFALSE);
581 PrintStr("\"/>");
582
583 PrintStr("<line x1=\"");
584 WriteReal(ix-m2*0.707, kFALSE);
585 PrintStr("\" y1=\"");
586 WriteReal(iy+m2*0.707, kFALSE);
587 PrintStr("\" x2=\"");
588 WriteReal(ix+m2*0.707, kFALSE);
589 PrintStr("\" y2=\"");
590 WriteReal(iy-m2*0.707, kFALSE);
591 PrintStr("\"/>");
592 // Circle
593 } else if (ms == 24 || ms == 20) {
594 PrintStr("<circle cx=\"");
595 WriteReal(ix, kFALSE);
596 PrintStr("\" cy=\"");
597 WriteReal(iy, kFALSE);
598 PrintStr("\" r=\"");
599 if (m2<=0) m2=1;
600 WriteReal(m2, kFALSE);
601 PrintStr("\"/>");
602 // Square
603 } else if (ms == 25 || ms == 21) {
604 PrintStr("<rect x=\"");
605 WriteReal(ix-m2, kFALSE);
606 PrintStr("\" y=\"");
607 WriteReal(iy-m2, kFALSE);
608 PrintStr("\" width=\"");
610 PrintStr("\" height=\"");
612 PrintStr("\"/>");
613 // Down triangle
614 } else if (ms == 26 || ms == 22) {
615 PrintStr("<polygon points=\"");
616 WriteReal(ix); PrintStr(","); WriteReal(iy-m2);
617 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
618 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
619 PrintStr("\"/>");
620 // Up triangle
621 } else if (ms == 23 || ms == 32) {
622 PrintStr("<polygon points=\"");
623 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
624 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
625 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
626 PrintStr("\"/>");
627 // Diamond
628 } else if (ms == 27 || ms == 33) {
629 PrintStr("<polygon points=\"");
630 WriteReal(ix); PrintStr(","); WriteReal(iy-m2);
631 WriteReal(ix+m3); PrintStr(","); WriteReal(iy);
632 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
633 WriteReal(ix-m3); PrintStr(","); WriteReal(iy);
634 PrintStr("\"/>");
635 // Cross
636 } else if (ms == 28 || ms == 34) {
637 PrintStr("<polygon points=\"");
638 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6);
639 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m2);
640 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m2);
641 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
642 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m6);
643 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m6);
644 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
645 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m2);
646 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m2);
647 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
648 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m6);
649 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m6);
650 PrintStr("\"/>");
651 } else if (ms == 29 || ms == 30) {
652 PrintStr("<polygon points=\"");
653 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
654 WriteReal(ix+0.112255*m); PrintStr(","); WriteReal(iy+0.15451*m);
655 WriteReal(ix+0.47552*m); PrintStr(","); WriteReal(iy+0.15451*m);
656 WriteReal(ix+0.181635*m); PrintStr(","); WriteReal(iy-0.05902*m);
657 WriteReal(ix+0.29389*m); PrintStr(","); WriteReal(iy-0.40451*m);
658 WriteReal(ix); PrintStr(","); WriteReal(iy-0.19098*m);
659 WriteReal(ix-0.29389*m); PrintStr(","); WriteReal(iy-0.40451*m);
660 WriteReal(ix-0.181635*m); PrintStr(","); WriteReal(iy-0.05902*m);
661 WriteReal(ix-0.47552*m); PrintStr(","); WriteReal(iy+0.15451*m);
662 WriteReal(ix-0.112255*m); PrintStr(","); WriteReal(iy+0.15451*m);
663 PrintStr("\"/>");
664 } else if (ms == 35) {
665 PrintStr("<polygon points=\"");
666 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
667 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
668 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
669 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
670 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
671 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
672 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
673 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
674 PrintStr("\"/>");
675 } else if (ms == 36) {
676 PrintStr("<polygon points=\"");
677 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
678 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
679 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
680 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
681 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
682 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
683 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
684 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
685 PrintStr("\"/>");
686 } else if (ms == 37 || ms == 39) {
687 PrintStr("<polygon points=\"");
688 WriteReal(ix ); PrintStr(","); WriteReal(iy );
689 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
690 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
691 WriteReal(ix ); PrintStr(","); WriteReal(iy );
692 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
693 WriteReal(ix-m2); PrintStr(","); WriteReal(iy);
694 WriteReal(ix ); PrintStr(","); WriteReal(iy );
695 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
696 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
697 WriteReal(ix ); PrintStr(","); WriteReal(iy );
698 PrintStr("\"/>");
699 } else if (ms == 38) {
700 PrintStr("<polygon points=\"");
701 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
702 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
703 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
704 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
705 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
706 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
707 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
708 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
709 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
710 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
711 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
712 WriteReal(ix ); PrintStr(","); WriteReal(iy );
713 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
714 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
715 WriteReal(ix ); PrintStr(","); WriteReal(iy);
716 PrintStr("\"/>");
717 } else if (ms == 40 || ms == 41) {
718 PrintStr("<polygon points=\"");
719 WriteReal(ix ); PrintStr(","); WriteReal(iy );
720 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
721 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
722 WriteReal(ix ); PrintStr(","); WriteReal(iy );
723 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
724 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
725 WriteReal(ix ); PrintStr(","); WriteReal(iy );
726 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
727 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
728 WriteReal(ix ); PrintStr(","); WriteReal(iy );
729 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
730 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
731 WriteReal(ix ); PrintStr(","); WriteReal(iy );
732 PrintStr("\"/>");
733 } else if (ms == 42 || ms == 43) {
734 PrintStr("<polygon points=\"");
735 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
736 WriteReal(ix-m8); PrintStr(","); WriteReal(iy+m8);
737 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
738 WriteReal(ix-m8); PrintStr(","); WriteReal(iy-m8);
739 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
740 WriteReal(ix+m8); PrintStr(","); WriteReal(iy-m8);
741 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
742 WriteReal(ix+m8); PrintStr(","); WriteReal(iy+m8);
743 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
744 PrintStr("\"/>");
745 } else if (ms == 44) {
746 PrintStr("<polygon points=\"");
747 WriteReal(ix ); PrintStr(","); WriteReal(iy );
748 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
749 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
750 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
751 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
752 WriteReal(ix ); PrintStr(","); WriteReal(iy );
753 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
754 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
755 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
756 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
757 WriteReal(ix ); PrintStr(","); WriteReal(iy );
758 PrintStr("\"/>");
759 } else if (ms == 45) {
760 PrintStr("<polygon points=\"");
761 WriteReal(ix+m0); PrintStr(","); WriteReal(iy+m0);
762 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
763 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
764 WriteReal(ix-m0); PrintStr(","); WriteReal(iy+m0);
765 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
766 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
767 WriteReal(ix-m0); PrintStr(","); WriteReal(iy-m0);
768 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
769 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
770 WriteReal(ix+m0); PrintStr(","); WriteReal(iy-m0);
771 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
772 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
773 WriteReal(ix+m0); PrintStr(","); WriteReal(iy+m0);
774 PrintStr("\"/>");
775 } else if (ms == 46 || ms == 47) {
776 PrintStr("<polygon points=\"");
777 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4);
778 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
779 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
780 WriteReal(ix-m4); PrintStr(","); WriteReal(iy );
781 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
782 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
783 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4);
784 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
785 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
786 WriteReal(ix+m4); PrintStr(","); WriteReal(iy );
787 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
788 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
789 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4);
790 PrintStr("\"/>");
791 } else if (ms == 48) {
792 PrintStr("<polygon points=\"");
793 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*1.01);
794 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
795 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
796 WriteReal(ix-m4); PrintStr(","); WriteReal(iy );
797 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
798 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
799 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4);
800 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
801 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
802 WriteReal(ix+m4); PrintStr(","); WriteReal(iy );
803 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
804 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
805 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*0.99);
806 WriteReal(ix+m4*0.99); PrintStr(","); WriteReal(iy );
807 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4*0.99);
808 WriteReal(ix-m4*0.99); PrintStr(","); WriteReal(iy );
809 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*0.99);
810 PrintStr("\"/>");
811 } else if (ms == 49) {
812 PrintStr("<polygon points=\"");
813 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6*1.01);
814 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m2);
815 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m2);
816 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
817 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m6);
818 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m6);
819 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
820 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m2);
821 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m2);
822 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
823 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m6);
824 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m6);
825 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6*0.99);
826 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
827 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
828 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
829 PrintStr("\"/>");
830 } else {
831 PrintStr("<line x1=\"");
832 WriteReal(ix-1, kFALSE);
833 PrintStr("\" y1=\"");
834 WriteReal(iy, kFALSE);
835 PrintStr("\" x2=\"");
836 WriteReal(ix, kFALSE);
837 PrintStr("\" y2=\"");
838 WriteReal(iy, kFALSE);
839 PrintStr("\"/>");
840 }
841 }
842 PrintStr("@");
843 PrintStr("</g>");
844}
845
846////////////////////////////////////////////////////////////////////////////////
847/// Paint PolyMarker
848
853
854
855////////////////////////////////////////////////////////////////////////////////
856/// Paint PolyMarker
857
862
863
864////////////////////////////////////////////////////////////////////////////////
865/// Print line style attributes on the end of "path" string
866
868{
869 PrintFast(21,"\" fill=\"none\" stroke=");
871 if(fLineWidth > 1.) {
872 PrintFast(15," stroke-width=\"");
874 PrintFast(1,"\"");
875 }
876 if (fLineStyle > 1) {
877 PrintFast(19," stroke-dasharray=\"");
879 TObjArray *tokens = st.Tokenize(" ");
880 for (Int_t j = 0; j<tokens->GetEntries(); j++) {
881 Int_t it;
882 sscanf(((TObjString*)tokens->At(j))->GetName(), "%d", &it);
883 if (j>0) PrintFast(1,",");
884 WriteReal(it/4);
885 }
886 delete tokens;
887 PrintFast(1,"\"");
888 }
889}
890
891////////////////////////////////////////////////////////////////////////////////
892/// Print line join attributes - if present
893
895{
896 if (fgLineJoin)
897 PrintStr(TString::Format(" stroke-linejoin=\"%s\"", fgLineJoin == 1 ? "round" : "bevel"));
898 if (fgLineCap)
899 PrintStr(TString::Format(" stroke-linecap=\"%s\"", fgLineCap == 1 ? "round" : "square"));
900}
901
902
903////////////////////////////////////////////////////////////////////////////////
904/// This function defines a path with xw and yw and draw it according the
905/// value of nn:
906///
907/// - If nn>0 a line is drawn.
908/// - If nn<0 a closed polygon is drawn.
909
911{
912 Int_t n, fais = 0, fasi = 0;
913
914 if (nn > 0) {
915 if (fLineWidth <= 0)
916 return;
917 n = nn;
918 } else {
919 n = -nn;
920 fais = fFillStyle/1000;
921 fasi = fFillStyle%1000;
922 if (fais == 3 || fais == 2) {
923 if (fasi > 100 && fasi <125) {
924 return;
925 }
926 if (fasi > 0 && fasi < 26) {
927 }
928 }
929 }
930
931 if(n <= 1) {
932 Error("DrawPS", "Two points are needed");
933 return;
934 }
935
936 PrintStr("@");
937 PrintFast(9,"<path d=\"");
938
939 PrintPath(kTRUE, n, xw, yw, nn < 0);
940
941 if (nn > 0)
943 else {
944 PrintFast(7,"\" fill=");
945 if (fais == 0) {
946 PrintFast(14,"\"none\" stroke=");
948 } else {
950 }
951 }
953 PrintFast(2,"/>");
954}
955
956////////////////////////////////////////////////////////////////////////////////
957/// This method draw N segments
959{
960 if (fLineWidth < 0)
961 return;
962
963 if(n < 1) {
964 Error("DrawSegments", "At least one segment has to be provided");
965 return;
966 }
967
968 PrintStr("@");
969 PrintFast(9,"<path d=\"");
970
971 for(Int_t i = 0; i < 2*n; i += 2) {
972 Double_t ixd0 = XtoSVG(xw[i]);
973 Double_t iyd0 = YtoSVG(yw[i]);
974 Double_t ixd1 = XtoSVG(xw[i+1]);
975 Double_t iyd1 = YtoSVG(yw[i+1]);
976
977 Double_t dx = ixd1 - ixd0;
978 Double_t dy = iyd1 - iyd0;
979
980 if (fCompact && (TMath::Abs(dx) < kEpsilon))
981 dx = 0;
982 if (fCompact && (TMath::Abs(dy) < kEpsilon))
983 dy = 0;
984
985 if (dx || dy) {
986 PrintFast(1,"M");
988 PrintFast(1,",");
990 MovePS(dx, dy);
991 }
992 }
993
996 PrintFast(2,"/>");
997}
998
999
1000////////////////////////////////////////////////////////////////////////////////
1001/// Begin the Cell Array painting
1002
1004{
1006 Double_t svgx2 = XtoSVG(x1 + (x2 - x1) * width);
1008 Double_t svgy2 = YtoSVG(y1 - (y2 - y1) * height);
1009
1010 PrintStr("@<g transform=\"translate(");
1013 PrintStr(") scale(");
1016 PrintStr(")\">@");
1017 PrintStr(TString::Format("<image width=\"%d\" height=\"%d\" href=\"data:image/png;base64,", width, height));
1018}
1019
1020////////////////////////////////////////////////////////////////////////////////
1021/// Paint the Cell Array as single pixel
1022
1024{
1025 Warning("CellArrayFill", "not implemented");
1026}
1027
1028////////////////////////////////////////////////////////////////////////////////
1029/// Paint the Cell Array as png image
1030/// Disabled in compact mode to avoid creation of large SVG files
1031
1032void TSVG::CellArrayPng(char *buffer, int size)
1033{
1034 if (!fCompact) {
1035 TString base64 = TBase64::Encode(reinterpret_cast<char *>(buffer), size);
1036 PrintFast(base64.Length(), base64.Data());
1037 }
1038}
1039
1040////////////////////////////////////////////////////////////////////////////////
1041/// End the Cell Array painting
1042
1044{
1045 PrintStr("\"></image>@");
1046 PrintStr("</g>@");
1047}
1048
1049////////////////////////////////////////////////////////////////////////////////
1050/// Initialize the SVG file. The main task of the function is to output the
1051/// SVG header file which consist in `<title>`, `<desc>` and `<defs>`. The
1052/// HeaderPS provided by the user program is written in the `<defs>` part.
1053
1055{
1056 // Title
1057 PrintStr("<title>@");
1058 PrintStr(GetName());
1059 PrintStr("@");
1060 PrintStr("</title>@");
1061
1062 if (fCompact)
1063 return;
1064
1065 // Description
1066 PrintStr("<desc>@");
1067 PrintFast(22,"Creator: ROOT Version ");
1068 PrintStr(gROOT->GetVersion());
1069 PrintStr("@");
1070 PrintFast(14,"CreationDate: ");
1071 TDatime t;
1072 PrintStr(t.AsString());
1073 //Check a special header is defined in the current style
1075 if (nh) {
1077 }
1078 PrintStr("</desc>@");
1079
1080 // Definitions
1081 PrintStr("<defs>@");
1082 PrintStr("</defs>@");
1083
1084}
1085
1086////////////////////////////////////////////////////////////////////////////////
1087/// Write float value into output stream
1088/// In compact form try to store only first 2-3 significant digits
1089
1091{
1092 if (fCompact) {
1093 auto a = std::abs(r);
1094 if (a > 10)
1095 TVirtualPS::WriteInteger(std::lround(r), space);
1096 else if (a < 0.005)
1097 TVirtualPS::WriteReal(r, space);
1098 else {
1099 char str[15];
1100 snprintf(str, 15, (a > 1) ? "%3.1f" : "%5.3f", r);
1101 if(space)
1102 PrintFast(1," ");
1103 PrintStr(str);
1104 }
1105 } else
1106 TVirtualPS::WriteReal(r, space);
1107}
1108
1109////////////////////////////////////////////////////////////////////////////////
1110/// Move to a new position (ix, iy). The move is done in relative coordinates
1111/// which allows to have short numbers which decrease the size of the file.
1112/// This function use the full power of the SVG's paths by using the
1113/// horizontal and vertical move whenever it is possible.
1114
1116{
1117 if (ix != 0 && iy != 0) {
1118 PrintFast(1,"l");
1119 WriteReal(ix);
1120 PrintFast(1,",");
1121 WriteReal(iy);
1122 } else if (ix != 0) {
1123 PrintFast(1,"h");
1124 WriteReal(ix);
1125 } else if (iy != 0) {
1126 PrintFast(1,"v");
1127 WriteReal(iy);
1128 }
1129}
1130
1131////////////////////////////////////////////////////////////////////////////////
1132/// Start the SVG page. This function initialize the pad conversion
1133/// coefficients and output the `<svg>` directive which is close later in the
1134/// the function Close.
1135
1137{
1138 // Compute pad conversion coefficients
1139 if (gPad) {
1140 Double_t ww = gPad->GetWw();
1141 Double_t wh = gPad->GetWh();
1142 fYsize = fXsize*wh/ww;
1143 } else {
1144 fYsize = 27;
1145 }
1146
1147 // <svg> directive. It defines the viewBox.
1148 if(!fBoundingBox) {
1149 PrintStr("@<?xml version=\"1.0\" standalone=\"no\"?>");
1150 PrintStr("@<svg width=\"");
1152 PrintStr("\" height=\"");
1155 PrintStr("\" viewBox=\"0 0");
1158 PrintStr("\" xmlns=\"http://www.w3.org/2000/svg\" shape-rendering=\"crispEdges\">");
1159 PrintStr("@");
1160 Initialize();
1162 }
1163}
1164
1165////////////////////////////////////////////////////////////////////////////////
1166/// Set the range for the paper in centimetres
1167
1169{
1170 fXsize = xsize;
1171 fYsize = ysize;
1172 fRange = kTRUE;
1173}
1174
1175////////////////////////////////////////////////////////////////////////////////
1176/// Set color index for fill areas
1177
1182
1183////////////////////////////////////////////////////////////////////////////////
1184/// Set color index for lines
1185
1190
1191////////////////////////////////////////////////////////////////////////////////
1192/// Set the value of the global parameter TSVG::fgLineJoin.
1193/// This parameter determines the appearance of joining lines in a SVG
1194/// output.
1195/// It takes one argument which may be:
1196/// - 0 (miter join)
1197/// - 1 (round join)
1198/// - 2 (bevel join)
1199/// The default value is 0 (miter join).
1200///
1201/// \image html postscript_1.png
1202///
1203/// To change the line join behaviour just do:
1204/// ~~~ {.cpp}
1205/// gStyle->SetJoinLinePS(2); // Set the PS line join to bevel.
1206/// ~~~
1207
1209{
1211 if (fgLineJoin<0) fgLineJoin=0;
1212 if (fgLineJoin>2) fgLineJoin=2;
1213}
1214
1215////////////////////////////////////////////////////////////////////////////////
1216/// Set the value of the global parameter TSVG::fgLineCap.
1217/// This parameter determines the appearance of line caps in a SVG
1218/// output.
1219/// It takes one argument which may be:
1220/// - 0 (butt caps)
1221/// - 1 (round caps)
1222/// - 2 (projecting caps)
1223/// The default value is 0 (butt caps).
1224///
1225/// \image html postscript_2.png
1226///
1227/// To change the line cap behaviour just do:
1228/// ~~~ {.cpp}
1229/// gStyle->SetCapLinePS(2); // Set the PS line cap to projecting.
1230/// ~~~
1231
1233{
1235 if (fgLineCap<0) fgLineCap=0;
1236 if (fgLineCap>2) fgLineCap=2;
1237}
1238
1239////////////////////////////////////////////////////////////////////////////////
1240/// Change the line style
1241///
1242/// - linestyle = 2 dashed
1243/// - linestyle = 3 dotted
1244/// - linestyle = 4 dash-dotted
1245/// - linestyle = else solid (1 in is used most of the time)
1246
1251
1252////////////////////////////////////////////////////////////////////////////////
1253/// Set the lines width.
1254
1259
1260////////////////////////////////////////////////////////////////////////////////
1261/// Set color index for markers.
1262
1267
1268////////////////////////////////////////////////////////////////////////////////
1269/// Set RGBa color with its color index
1270
1272{
1273 if (color < 0)
1274 color = 0;
1275 TColor *col = gROOT->GetColor(color);
1276 if (col) {
1277 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
1278 Float_t a = col->GetAlpha();
1279 if ((a < 1.) && fill)
1280 PrintStr(TString::Format(" fill-opacity=\"%3.2f\"",a));
1281 if ((a < 1.) && stroke)
1282 PrintStr(TString::Format(" stroke-opacity=\"%3.2f\"",a));
1283 } else {
1284 SetColor(1., 1., 1.);
1285 }
1286}
1287
1288////////////////////////////////////////////////////////////////////////////////
1289/// Set RGB (without alpha channel) color with its color index
1290
1292{
1293 if (color < 0) color = 0;
1294 TColor *col = gROOT->GetColor(color);
1295 if (col) {
1296 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
1297 } else {
1298 SetColor(1., 1., 1.);
1299 }
1300}
1301
1302////////////////////////////////////////////////////////////////////////////////
1303/// Set color with its R G B components
1304///
1305/// - r: % of red in [0,1]
1306/// --g: % of green in [0,1]
1307/// - b: % of blue in [0,1]
1308
1310{
1311 if (r <= 0. && g <= 0. && b <= 0. ) {
1312 PrintFast(7,"\"black\"");
1313 } else if (r >= 1. && g >= 1. && b >= 1. ) {
1314 PrintFast(7,"\"white\"");
1315 } else {
1316 char str[12];
1317 snprintf(str,12,"\"#%2.2x%2.2x%2.2x\"",Int_t(255.*r)
1318 ,Int_t(255.*g)
1319 ,Int_t(255.*b));
1320 PrintStr(str);
1321 }
1322}
1323
1324////////////////////////////////////////////////////////////////////////////////
1325/// Set color index for text
1326
1331
1332////////////////////////////////////////////////////////////////////////////////
1333/// Draw text
1334///
1335/// - xx: x position of the text
1336/// - yy: y position of the text
1337/// - chars: text to be drawn
1338
1340{
1341 static const char *fontFamily[] = {
1342 "Times" , "Times" , "Times",
1343 "Helvetica", "Helvetica", "Helvetica" , "Helvetica",
1344 "Courier" , "Courier" , "Courier" , "Courier",
1345 "Times" ,"Times" , "ZapfDingbats", "Times"};
1346
1347 static const char *fontWeight[] = {
1348 "normal", "bold", "bold",
1349 "normal", "normal", "bold" , "bold",
1350 "normal", "normal", "bold" , "bold",
1351 "normal", "normal", "normal", "normal"};
1352
1353 static const char *fontStyle[] = {
1354 "italic", "normal" , "italic",
1355 "normal", "oblique", "normal", "oblique",
1356 "normal", "oblique", "normal", "oblique",
1357 "normal", "normal" , "normal", "italic"};
1358
1359 Double_t ix = XtoSVG(xx);
1360 Double_t iy = YtoSVG(yy);
1362 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
1364 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
1365
1366 Double_t wh = (Double_t)gPad->XtoPixel(gPad->GetX2());
1367 Double_t hh = (Double_t)gPad->YtoPixel(gPad->GetY1());
1368 Float_t fontrap = 1.09; //scale down compared to X11
1370
1371 Int_t font = abs(fTextFont)/10;
1372 if (font > 15 || font < 1)
1373 font = 1;
1374 if (wh < hh) {
1375 ftsize = fTextSize*fXsize*gPad->GetAbsWNDC();
1376 } else {
1377 ftsize = fTextSize*fYsize*gPad->GetAbsHNDC();
1378 }
1379 Int_t ifont = font-1;
1380
1382 if( fontsize <= 0) return;
1383
1384 if (txalv == 3) iy = iy+fontsize;
1385 if (txalv == 2) iy = iy+(fontsize/2);
1386
1387 if (fTextAngle != 0.) {
1388 PrintStr("@");
1389 PrintFast(21,"<g transform=\"rotate(");
1391 PrintFast(1,",");
1392 WriteReal(ix, kFALSE);
1393 PrintFast(1,",");
1394 WriteReal(iy, kFALSE);
1395 PrintFast(3,")\">");
1396 }
1397
1398 PrintStr("@");
1399 PrintFast(30,"<text xml:space=\"preserve\" x=\"");
1400 WriteReal(ix, kFALSE);
1401 PrintFast(5,"\" y=\"");
1402 WriteReal(iy, kFALSE);
1403 PrintFast(1,"\"");
1404 if (txalh == 2) {
1405 PrintFast(21," text-anchor=\"middle\"");
1406 } else if (txalh == 3) {
1407 PrintFast(18," text-anchor=\"end\"");
1408 }
1409 PrintFast(6," fill=");
1411 PrintFast(12," font-size=\"");
1413 PrintFast(15,"\" font-family=\"");
1415 if (strcmp(fontWeight[ifont],"normal")) {
1416 PrintFast(15,"\" font-weight=\"");
1418 }
1419 if (strcmp(fontStyle[ifont],"normal")) {
1420 PrintFast(14,"\" font-style=\"");
1422 }
1423 PrintFast(2,"\">");
1424
1425 if (font == 12 || font == 15) {
1426 Int_t ichar = chars[0]+848;
1427 Int_t ic = ichar;
1428
1429 // Math Symbols (cf: http://www.fileformat.info/info/unicode/category/Sm/list.htm)
1430 if (ic == 755) ichar = 8804;
1431 if (ic == 759) ichar = 9827;
1432 if (ic == 760) ichar = 9830;
1433 if (ic == 761) ichar = 9829;
1434 if (ic == 762) ichar = 9824;
1435 if (ic == 766) ichar = 8594;
1436 if (ic == 776) ichar = 247;
1437 if (ic == 757) ichar = 8734;
1438 if (ic == 758) ichar = 402;
1439 if (ic == 771) ichar = 8805;
1440 if (ic == 774) ichar = 8706;
1441 if (ic == 775) ichar = 8226;
1442 if (ic == 779) ichar = 8776;
1443 if (ic == 805) ichar = 8719;
1444 if (ic == 821) ichar = 8721;
1445 if (ic == 834) ichar = 8747;
1446 if (ic == 769) ichar = 177;
1447 if (ic == 772) ichar = 215;
1448 if (ic == 768) ichar = 176;
1449 if (ic == 791) ichar = 8745;
1450 if (ic == 793) ichar = 8835; // SUPERSET OF
1451 if (ic == 794) ichar = 8839; // SUPERSET OF OR EQUAL TO
1452 if (ic == 795) ichar = 8836; // NOT A SUBSET OF
1453 if (ic == 796) ichar = 8834;
1454 if (ic == 893) ichar = 8722;
1455 if (ic == 803) ichar = 169; // COPYRIGHT SIGN
1456 if (ic == 819) ichar = 169; // COPYRIGHT SIGN
1457 if (ic == 804) ichar = 8482;
1458 if (ic == 770) ichar = 34;
1459 if (ic == 823) ichar = 10072;
1460 if (ic == 781) ichar = 10072;
1461 if (ic == 824) ichar = 9117; // LEFT PARENTHESIS LOWER HOOK
1462 if (ic == 822) ichar = 9115; // LEFT PARENTHESIS UPPER HOOK
1463 if (ic == 767) ichar = 8595; // DOWNWARDS ARROW
1464 if (ic == 763) ichar = 8596; // LEFT RIGHT ARROW
1465 if (ic == 764) ichar = 8592; // LEFTWARDS ARROW
1466 if (ic == 788) ichar = 8855; // CIRCLED TIMES
1467 if (ic == 784) ichar = 8501;
1468 if (ic == 777) ichar = 8800;
1469 if (ic == 797) ichar = 8838;
1470 if (ic == 800) ichar = 8736;
1471 if (ic == 812) ichar = 8656; // LEFTWARDS DOUBLE ARROW
1472 if (ic == 817) ichar = 60; // LESS-THAN SIGN
1473 if (ic == 833) ichar = 62; // GREATER-THAN SIGN
1474 if (ic == 778) ichar = 8803; // STRICTLY EQUIVALENT TO
1475 if (ic == 809) ichar = 8743; // LOGICAL AND
1476 if (ic == 802) ichar = 9415; // CIRCLED LATIN CAPITAL LETTER R
1477 if (ic == 780) ichar = 8230; // HORIZONTAL ELLIPSIS
1478 if (ic == 801) ichar = 8711; // NABLA
1479 if (ic == 783) ichar = 8629; // DOWNWARDS ARROW WITH CORNER LEFTWARDS
1480 if (ic == 782) ichar = 8213;
1481 if (ic == 799) ichar = 8713;
1482 if (ic == 792) ichar = 8746;
1483 if (ic == 828) ichar = 9127;
1484 if (ic == 765) ichar = 8593; // UPWARDS ARROW
1485 if (ic == 789) ichar = 8853; // CIRCLED PLUS
1486 if (ic == 813) ichar = 8657; // UPWARDS DOUBLE ARROW
1487 if (ic == 773) ichar = 8733; // PROPORTIONAL TO
1488 if (ic == 790) ichar = 8709; // EMPTY SET
1489 if (ic == 810) ichar = 8744;
1490 if (ic == 756) ichar = 8260;
1491 if (ic == 807) ichar = 8231;
1492 if (ic == 808) ichar = 8989; // TOP RIGHT CORNER
1493 if (ic == 814) ichar = 8658; // RIGHTWARDS DOUBLE ARROW
1494 if (ic == 806) ichar = 8730; // SQUARE ROOT
1495 if (ic == 827) ichar = 9123;
1496 if (ic == 829) ichar = 9128;
1497 if (ic == 786) ichar = 8476;
1498 if (ic == 785) ichar = 8465;
1499 if (ic == 787) ichar = 8472;
1500
1501 // Greek characters
1502 if (ic == 918) ichar = 934;
1503 if (ic == 919) ichar = 915;
1504 if (ic == 920) ichar = 919;
1505 if (ic == 923) ichar = 922;
1506 if (ic == 924) ichar = 923;
1507 if (ic == 925) ichar = 924;
1508 if (ic == 926) ichar = 925;
1509 if (ic == 929) ichar = 920;
1510 if (ic == 930) ichar = 929;
1511 if (ic == 936) ichar = 926;
1512 if (ic == 915) ichar = 935;
1513 if (ic == 937) ichar = 936;
1514 if (ic == 935) ichar = 937;
1515 if (ic == 938) ichar = 918;
1516 if (ic == 951) ichar = 947;
1517 if (ic == 798) ichar = 949;
1518 if (ic == 970) ichar = 950;
1519 if (ic == 952) ichar = 951;
1520 if (ic == 961) ichar = 952;
1521 if (ic == 955) ichar = 954;
1522 if (ic == 956) ichar = 955;
1523 if (ic == 957) ichar = 956;
1524 if (ic == 958) ichar = 957;
1525 if (ic == 968) ichar = 958;
1526 if (ic == 934) ichar = 962;
1527 if (ic == 962) ichar = 961;
1528 if (ic == 966) ichar = 969;
1529 if (ic == 950) ichar = 966;
1530 if (ic == 947) ichar = 967;
1531 if (ic == 969) ichar = 968;
1532 if (ic == 967) ichar = 969;
1533 if (ic == 954) ichar = 966;
1534 if (ic == 922) ichar = 952;
1535 if (ic == 753) ichar = 965;
1536 PrintStr(Form("&#%4.4d;",ichar));
1537 } else {
1539 for (Int_t i=0; i<len;i++) {
1540 if (chars[i]!='\n') {
1541 if (chars[i]=='<') {
1542 PrintFast(4,"&lt;");
1543 } else if (chars[i]=='>') {
1544 PrintFast(4,"&gt;");
1545 } else if (chars[i]=='\305') {
1546 PrintFast(7,"&#8491;"); // ANGSTROM SIGN
1547 } else if (chars[i]=='\345') {
1548 PrintFast(6,"&#229;");
1549 } else if (chars[i]=='&') {
1550 PrintFast(5,"&amp;");
1551 } else {
1552 PrintFast(1,&chars[i]);
1553 }
1554 }
1555 }
1556 }
1557
1558 PrintStr("@");
1559 PrintFast(7,"</text>");
1560
1561 if (fTextAngle != 0.) {
1562 PrintStr("@");
1563 PrintFast(4,"</g>");
1564 }
1565}
1566
1567////////////////////////////////////////////////////////////////////////////////
1568/// Draw text with URL.
1569///
1570
1571void TSVG::TextUrl(Double_t x, Double_t y, const char *chars, const char *url)
1572{
1573 PrintStr("@");
1574 PrintFast(9,"<a href=\"");
1575 PrintStr(url);
1576 PrintFast(2,"\">");
1577 PrintStr("@");
1578 Text(x, y, chars);
1579 PrintStr("@");
1580 PrintFast(4,"</a>");
1581 PrintStr("@");
1582}
1583
1584////////////////////////////////////////////////////////////////////////////////
1585/// Write a string of characters in NDC
1586
1588{
1589 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
1590 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
1591 Text(x, y, chars);
1592}
1593
1594////////////////////////////////////////////////////////////////////////////////
1595/// Convert U from NDC coordinate to SVG
1596
1598{
1599 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
1600 return 0.5 + 72*cm/2.54;
1601}
1602
1603////////////////////////////////////////////////////////////////////////////////
1604/// Convert V from NDC coordinate to SVG
1605
1607{
1608 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
1609 return 0.5 + 72*cm/2.54;
1610}
1611
1612////////////////////////////////////////////////////////////////////////////////
1613/// Convert X from world coordinate to SVG
1614
1616{
1617 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
1618 return UtoSVG(u);
1619}
1620
1621////////////////////////////////////////////////////////////////////////////////
1622/// Convert Y from world coordinate to SVG
1623
1625{
1626 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
1627 return fYsizeSVG-VtoSVG(v);
1628}
1629
1630////////////////////////////////////////////////////////////////////////////////
1631/// Not needed in SVG case
1632
1634{
1635 Warning("TSVG::DrawPS", "not yet implemented");
1636}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
#define a(i)
Definition RSha256.hxx:99
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Style_t
Style number (short)
Definition RtypesCore.h:96
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
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 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 UChar_t len
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 width
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 y1
#define gROOT
Definition TROOT.h:414
const Double_t kEpsilon
Definition TSVG.cxx:38
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2495
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TVirtualPS * gVirtualPS
Definition TVirtualPS.h:84
#define gPad
#define snprintf
Definition civetweb.c:1579
Style_t fFillStyle
Fill area style.
Definition TAttFill.h:24
Color_t fFillColor
Fill area color.
Definition TAttFill.h:23
Width_t fLineWidth
Line width.
Definition TAttLine.h:25
Style_t fLineStyle
Line style.
Definition TAttLine.h:24
Color_t fLineColor
Line color.
Definition TAttLine.h:23
Color_t fMarkerColor
Marker color.
Definition TAttMarker.h:23
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
Size_t fMarkerSize
Marker size.
Definition TAttMarker.h:25
Style_t fMarkerStyle
Marker style.
Definition TAttMarker.h:24
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
Color_t fTextColor
Text color.
Definition TAttText.h:26
Float_t fTextAngle
Text angle.
Definition TAttText.h:23
Font_t fTextFont
Text font.
Definition TAttText.h:27
Short_t fTextAlign
Text alignment.
Definition TAttText.h:25
Float_t fTextSize
Text size.
Definition TAttText.h:24
static TString Encode(const char *data)
Transform data into a null terminated base64 string.
Definition TBase64.cxx:106
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:1926
Float_t GetAlpha() const
Definition TColor.h:67
Float_t GetBlue() const
Definition TColor.h:63
Float_t GetGreen() const
Definition TColor.h:62
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
const char * AsString() const
Return the date & time as a string (ctime() format).
Definition TDatime.cxx:101
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
An array of TObjects.
Definition TObjArray.h:31
Collectable string class.
Definition TObjString.h:28
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1075
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1089
2-D graphics point (world coordinates).
Definition TPoints.h:19
static Int_t fgLineJoin
Appearance of joining lines.
Definition TSVG.h:31
void PrintPolyMarker(Int_t n, T *x, T *y)
Implementation of polymarker printing.
Definition TSVG.cxx:446
Double_t UtoSVG(Double_t u)
Convert U from NDC coordinate to SVG.
Definition TSVG.cxx:1597
void MovePS(Double_t x, Double_t y)
Move to a new position (ix, iy).
Definition TSVG.cxx:1115
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 TSVG.cxx:372
void DrawPolyLineNDC(Int_t, TPoints *)
Draw a PolyLine in NDC space.
Definition TSVG.cxx:437
Double_t fYsizeSVG
Page's Y size in SVG units.
Definition TSVG.h:29
void CellArrayPng(char *buffer, int size) override
Paint the Cell Array as png image Disabled in compact mode to avoid creation of large SVG files.
Definition TSVG.cxx:1032
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override
Paint PolyMarker.
Definition TSVG.cxx:849
void TextUrl(Double_t x, Double_t y, const char *string, const char *url) override
Draw text with URL.
Definition TSVG.cxx:1571
void Close(Option_t *opt="") override
Close a SVG file.
Definition TSVG.cxx:175
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TSVG.cxx:215
Bool_t fRange
True when a range has been defined.
Definition TSVG.h:28
void Text(Double_t x, Double_t y, const char *string) override
Draw text.
Definition TSVG.cxx:1339
Double_t YtoSVG(Double_t y)
Convert Y from world coordinate to SVG.
Definition TSVG.cxx:1624
void PrintLineJointAttributes()
Print line join attributes - if present.
Definition TSVG.cxx:894
void SetFillColor(Color_t cindex=1) override
Set color index for fill areas.
Definition TSVG.cxx:1178
void SetLineWidth(Width_t linewidth=1) override
Set the lines width.
Definition TSVG.cxx:1255
void Initialize()
Initialize the SVG file.
Definition TSVG.cxx:1054
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Not needed in SVG case.
Definition TSVG.cxx:1633
void CellArrayEnd() override
End the Cell Array painting.
Definition TSVG.cxx:1043
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array as single pixel.
Definition TSVG.cxx:1023
void NewPage() override
Start the SVG page.
Definition TSVG.cxx:1136
void PrintLineStyleOnEndOfPath()
Print line style attributes on the end of "path" string.
Definition TSVG.cxx:867
void SetColor(Int_t color=1)
Set RGB (without alpha channel) color with its color index.
Definition TSVG.cxx:1291
Int_t fType
Workstation type used to know if the SVG is open.
Definition TSVG.h:25
void SetLineCap(Int_t linecap=0)
Set the value of the global parameter TSVG::fgLineCap.
Definition TSVG.cxx:1232
void DrawPolyLine(Int_t, TPoints *)
Draw a PolyLine.
Definition TSVG.cxx:422
void Off()
Deactivate an already open SVG file.
Definition TSVG.cxx:207
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TSVG.cxx:1168
void SetLineScale(Float_t=3)
Definition TSVG.h:78
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 TSVG.cxx:1003
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TSVG.cxx:1247
void On()
Activate an already open SVG file.
Definition TSVG.cxx:191
TSVG()
Default SVG constructor.
Definition TSVG.cxx:83
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TSVG.cxx:1327
Double_t CMtoSVG(Double_t u)
Definition TSVG.h:50
Double_t XtoSVG(Double_t x)
Convert X from world coordinate to SVG.
Definition TSVG.cxx:1615
Bool_t fCompact
True when the SVG header is printed.
Definition TSVG.h:26
Bool_t fBoundingBox
True when the SVG header is printed.
Definition TSVG.h:27
Float_t fXsize
Page size along X.
Definition TSVG.h:23
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TSVG.cxx:1263
Float_t fYsize
Page size along Y.
Definition TSVG.h:24
void DrawSegments(Int_t n, Double_t *xw, Double_t *yw) override
This method draw N segments.
Definition TSVG.cxx:958
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition TSVG.cxx:1587
~TSVG() override
Default SVG destructor.
Definition TSVG.cxx:167
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TSVG.cxx:1186
void SetColorAlpha(Int_t color=1, Bool_t fill=kTRUE, Bool_t stroke=kTRUE)
Set RGBa color with its color index.
Definition TSVG.cxx:1271
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TSVG::fgLineJoin.
Definition TSVG.cxx:1208
void PrintPath(Bool_t convert, Int_t n, Double_t *xs, Double_t *ys, Bool_t close_path=kTRUE)
Print a svg path statement for specified points.
Definition TSVG.cxx:289
void Open(const char *filename, Int_t type=-111) override
Open a SVG file.
Definition TSVG.cxx:117
void WriteReal(Float_t r, Bool_t space=kTRUE) override
Write float value into output stream In compact form try to store only first 2-3 significant digits.
Definition TSVG.cxx:1090
static Int_t fgLineCap
Appearance of line caps.
Definition TSVG.h:32
Double_t VtoSVG(Double_t v)
Convert V from NDC coordinate to SVG.
Definition TSVG.cxx:1606
Basic string class.
Definition TString.h:138
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:2384
Int_t GetJoinLinePS() const
Returns the line join method used for PostScript, PDF and SVG output. See TPostScript::SetLineJoin fo...
Definition TStyle.h:289
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1167
Int_t GetCapLinePS() const
Returns the line cap method used for PostScript, PDF and SVG output. See TPostScript::SetLineCap for ...
Definition TStyle.h:290
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
Definition TStyle.cxx:1184
const char * GetHeaderPS() const
Definition TStyle.h:286
Float_t GetLineScalePS() const
Definition TStyle.h:291
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition TVirtualPS.h:30
Int_t fSizBuffer
Definition TVirtualPS.h:39
Int_t fLenBuffer
Definition TVirtualPS.h:38
virtual void WriteInteger(Int_t i, Bool_t space=kTRUE)
Write one Integer to the file.
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
char * fBuffer
Definition TVirtualPS.h:42
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Definition TMath.h:691
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
TMarker m
Definition textangle.C:8