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