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 "TColor.h"
25#include "TVirtualPad.h"
26#include "TPoints.h"
27#include "TSVG.h"
28#include "TStyle.h"
29#include "TMath.h"
30#include "TObjString.h"
31#include "TObjArray.h"
32#include "snprintf.h"
33
36
37const Double_t kEpsilon = 1e-9;
38
39/** \class TSVG
40\ingroup PS
41
42\brief Interface to SVG
43
44[SVG](http://www.w3.org/Graphics/SVG/Overview.htm8)
45(Scalable Vector Graphics) is a language for describing
46two-dimensional graphics in XML. SVG allows high quality vector graphics in
47HTML pages.
48
49To print a ROOT canvas "c1" into an SVG file simply do:
50~~~ {.cpp}
51 c1->Print("c1.svg");
52~~~
53The result is the ASCII file `c1.svg`.
54
55It can be open directly using a web browser or included in a html document
56the following way:
57~~~ {.cpp}
58<embed width="95%" height="500" src="c1.svg">
59~~~
60It is best viewed with Internet Explorer and you need the
61[Adobe SVG Viewer](http://www.adobe.com/svg/viewer/install/main.html)
62
63To zoom using the Adobe SVG Viewer, position the mouse over
64the area you want to zoom and click the right button.
65
66To define the zoom area,
67use Control+drag to mark the boundaries of the zoom area.
68
69To pan, use Alt+drag.
70By clicking with the right mouse button on the SVG graphics you will get
71a pop-up menu giving other ways to interact with the image.
72
73SVG files can be used directly in compressed mode to minimize the time
74transfer over the network. Compressed SVG files should be created using
75`gzip` on a normal ASCII SVG file and should then be renamed
76using the file extension `.svgz`.
77*/
78
79////////////////////////////////////////////////////////////////////////////////
80/// Default SVG constructor
81
83{
84 fStream = nullptr;
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 fStream = nullptr;
108 SetTitle("SVG");
110 Open(fname, wtype);
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// Open a SVG file
115
116void TSVG::Open(const char *fname, Int_t wtype)
117{
118 if (fStream) {
119 Warning("Open", "SVG file already open");
120 return;
121 }
122
123 fLenBuffer = 0;
124 fType = abs(wtype);
130 if (gPad) {
131 Double_t ww = gPad->GetWw();
132 Double_t wh = gPad->GetWh();
133 ww *= gPad->GetWNDC();
134 wh *= gPad->GetHNDC();
135 Double_t ratio = wh/ww;
136 xrange = fXsize;
137 yrange = fXsize*ratio;
138 if (yrange > fYsize) { yrange = fYsize; xrange = yrange/ratio;}
140 }
141
142 // Open OS file
143 fStream = new std::ofstream(fname,std::ios::out);
144 if (!fStream || !fStream->good()) {
145 printf("ERROR in TSVG::Open: Cannot open file:%s\n",fname);
146 if (!fStream) return;
147 }
148
149 gVirtualPS = this;
150
151 for (Int_t i=0;i<fSizBuffer;i++) fBuffer[i] = ' ';
152
154
155 fRange = kFALSE;
156
157 // Set a default range
159
160 NewPage();
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Default SVG destructor
165
167{
168 Close();
169}
170
171////////////////////////////////////////////////////////////////////////////////
172/// Close a SVG file
173
175{
176 if (!gVirtualPS) return;
177 if (!fStream) return;
178 if (gPad) gPad->Update();
179 PrintStr("</svg>@");
180
181 // Close file stream
182 if (fStream) { fStream->close(); delete fStream; fStream = nullptr;}
183
184 gVirtualPS = nullptr;
185}
186
187////////////////////////////////////////////////////////////////////////////////
188/// Activate an already open SVG file
189
191{
192 // fType is used to know if the SVG file is open. Unlike TPostScript, TSVG
193 // has no "workstation type". In fact there is only one SVG type.
194
195 if (!fType) {
196 Error("On", "no SVG file open");
197 Off();
198 return;
199 }
200 gVirtualPS = this;
201}
202
203////////////////////////////////////////////////////////////////////////////////
204/// Deactivate an already open SVG file
205
207{
208 gVirtualPS = nullptr;
209}
210
211////////////////////////////////////////////////////////////////////////////////
212/// Draw a Box
213
215{
216 static Double_t x[4], y[4];
221 Int_t fillis = fFillStyle/1000;
222 Int_t fillsi = fFillStyle%1000;
223
224 if (fillis == 3 || fillis == 2) {
225 if (fillsi > 99) {
226 x[0] = x1; y[0] = y1;
227 x[1] = x2; y[1] = y1;
228 x[2] = x2; y[2] = y2;
229 x[3] = x1; y[3] = y2;
230 return;
231 }
232 if (fillsi > 0 && fillsi < 26) {
233 x[0] = x1; y[0] = y1;
234 x[1] = x2; y[1] = y1;
235 x[2] = x2; y[2] = y2;
236 x[3] = x1; y[3] = y2;
237 DrawPS(-4, &x[0], &y[0]);
238 }
239 if (fillsi == -3) {
240 PrintStr("@");
241 PrintFast(9,"<rect x=\"");
243 PrintFast(5,"\" y=\"");
245 PrintFast(9,"\" width=\"");
247 PrintFast(10,"\" height=\"");
249 PrintFast(7,"\" fill=");
250 SetColorAlpha(5);
251 PrintFast(2,"/>");
252 }
253 }
254 if (fillis == 1) {
255 PrintStr("@");
256 PrintFast(9,"<rect x=\"");
258 PrintFast(5,"\" y=\"");
260 PrintFast(9,"\" width=\"");
262 PrintFast(10,"\" height=\"");
264 PrintFast(7,"\" fill=");
266 PrintFast(2,"/>");
267 }
268 if (fillis == 0) {
269 if (fLineWidth<=0) return;
270 PrintStr("@");
271 PrintFast(9,"<rect x=\"");
273 PrintFast(5,"\" y=\"");
275 PrintFast(9,"\" width=\"");
277 PrintFast(10,"\" height=\"");
279 PrintFast(21,"\" fill=\"none\" stroke=");
281 PrintFast(2,"/>");
282 }
283}
284
285////////////////////////////////////////////////////////////////////////////////
286/// Draw a Frame around a box
287///
288/// - mode = -1 the box looks as it is behind the screen
289/// - mode = 1 the box looks as it is in front of the screen
290/// - border is the border size in already pre-computed SVG units dark is the
291/// color for the dark part of the frame light is the color for the light
292/// part of the frame
293
295 Int_t mode, Int_t border, Int_t dark, Int_t light)
296{
297 static Double_t xps[7], yps[7];
298 Int_t i;
299 Double_t ixd0, iyd0, ixdi, iydi, ix, iy;
300 Int_t idx, idy;
301
302 //- Draw top&left part of the box
303
304 xps[0] = XtoSVG(xl); yps[0] = YtoSVG(yl);
305 xps[1] = xps[0] + border; yps[1] = yps[0] - border;
306 xps[2] = xps[1]; yps[2] = YtoSVG(yt) + border;
307 xps[3] = XtoSVG(xt) - border; yps[3] = yps[2];
308 xps[4] = XtoSVG(xt); yps[4] = YtoSVG(yt);
309 xps[5] = xps[0]; yps[5] = yps[4];
310 xps[6] = xps[0]; yps[6] = yps[0];
311
312 ixd0 = xps[0];
313 iyd0 = yps[0];
314 PrintStr("@");
315 PrintFast(10,"<path d=\"M");
317 PrintFast(1,",");
319
320 idx = 0;
321 idy = 0;
322 for (i=1; i<7; i++) {
323 ixdi = xps[i];
324 iydi = yps[i];
325 ix = ixdi - ixd0;
326 iy = iydi - iyd0;
327 ixd0 = ixdi;
328 iyd0 = iydi;
329 if( ix && iy) {
330 if( idx ) { MovePS(idx,0); idx = 0; }
331 if( idy ) { MovePS(0,idy); idy = 0; }
332 MovePS(ix,iy);
333 continue;
334 }
335 if ( ix ) {
336 if( idy ) { MovePS(0,idy); idy = 0; }
337 if( !idx ) { idx = ix; continue;}
338 if( ix*idx > 0 ) {
339 idx += ix;
340 } else {
341 MovePS(idx,0);
342 idx = ix;
343 }
344 continue;
345 }
346 if( iy ) {
347 if( idx ) { MovePS(idx,0); idx = 0; }
348 if( !idy) { idy = iy; continue;}
349 if( iy*idy > 0 ) {
350 idy += iy;
351 } else {
352 MovePS(0,idy);
353 idy = iy;
354 }
355 }
356 }
357 if( idx ) MovePS(idx,0);
358 if( idy ) MovePS(0,idy);
359 PrintFast(8,"z\" fill=");
360 if (mode == -1) {
362 } else {
364 }
365 if (fgLineJoin)
366 PrintStr(TString::Format(" stroke-linejoin=\"%s\"", fgLineJoin == 1 ? "round" : "bevel"));
367 if (fgLineCap)
368 PrintStr(TString::Format(" stroke-linecap=\"%s\"", fgLineCap == 1 ? "round" : "square"));
369 PrintFast(2,"/>");
370
371 //- Draw bottom&right part of the box
372 xps[0] = XtoSVG(xl); yps[0] = YtoSVG(yl);
373 xps[1] = xps[0] + border; yps[1] = yps[0] - border;
374 xps[2] = XtoSVG(xt) - border; yps[2] = yps[1];
375 xps[3] = xps[2]; yps[3] = YtoSVG(yt) + border;
376 xps[4] = XtoSVG(xt); yps[4] = YtoSVG(yt);
377 xps[5] = xps[4]; yps[5] = yps[0];
378 xps[6] = xps[0]; yps[6] = yps[0];
379
380 ixd0 = xps[0];
381 iyd0 = yps[0];
382 PrintStr("@");
383 PrintFast(10,"<path d=\"M");
385 PrintFast(1,",");
387
388 idx = 0;
389 idy = 0;
390 for (i=1;i<7;i++) {
391 ixdi = xps[i];
392 iydi = yps[i];
393 ix = ixdi - ixd0;
394 iy = iydi - iyd0;
395 ixd0 = ixdi;
396 iyd0 = iydi;
397 if( ix && iy) {
398 if( idx ) { MovePS(idx,0); idx = 0; }
399 if( idy ) { MovePS(0,idy); idy = 0; }
400 MovePS(ix,iy);
401 continue;
402 }
403 if ( ix ) {
404 if( idy ) { MovePS(0,idy); idy = 0; }
405 if( !idx ) { idx = ix; continue;}
406 if( ix*idx > 0 ) {
407 idx += ix;
408 } else {
409 MovePS(idx,0);
410 idx = ix;
411 }
412 continue;
413 }
414 if( iy ) {
415 if( idx ) { MovePS(idx,0); idx = 0; }
416 if( !idy) { idy = iy; continue;}
417 if( iy*idy > 0 ) {
418 idy += iy;
419 } else {
420 MovePS(0,idy);
421 idy = iy;
422 }
423 }
424 }
425 if( idx ) MovePS(idx,0);
426 if( idy ) MovePS(0,idy);
427 PrintFast(8,"z\" fill=");
428 if (mode == -1) {
430 } else {
432 }
433 if (fgLineJoin)
434 PrintStr(TString::Format(" stroke-linejoin=\"%s\"", fgLineJoin == 1 ? "round" : "bevel"));
435 if (fgLineCap)
436 PrintStr(TString::Format(" stroke-linecap=\"%s\"", fgLineCap == 1 ? "round" : "square"));
437 PrintFast(2,"/>");
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Draw a PolyLine
442///
443/// Draw a polyline through the points xy.
444/// - If NN=1 moves only to point x,y.
445/// - If NN=0 the x,y are written in the SVG file
446/// according to the current transformation.
447/// - If NN>0 the line is clipped as a line.
448/// - If NN<0 the line is clipped as a fill area.
449
451{
452 Int_t n, idx, idy;
453 Double_t ixd0, iyd0, ixdi, iydi, ix, iy;
454
455 if (nn > 0) {
456 n = nn;
457 } else {
458 n = -nn;
459 }
460
461 ixd0 = XtoSVG(xy[0].GetX());
462 iyd0 = YtoSVG(xy[0].GetY());
463 if( n <= 1) return;
464
465 PrintFast(2," m");
466 idx = 0;
467 idy = 0;
468 for (Int_t i=1;i<n;i++) {
469 ixdi = XtoSVG(xy[i].GetX());
470 iydi = YtoSVG(xy[i].GetY());
471 ix = ixdi - ixd0;
472 iy = iydi - iyd0;
473 if (fCompact && (TMath::Abs(ix) < kEpsilon))
474 ix = 0;
475 if (fCompact && (TMath::Abs(iy) < kEpsilon))
476 iy = 0;
477 ixd0 = ixdi;
478 iyd0 = iydi;
479 if( ix && iy) {
480 if( idx ) { MovePS(idx,0); idx = 0; }
481 if( idy ) { MovePS(0,idy); idy = 0; }
482 MovePS(ix,iy);
483 continue;
484 }
485 if ( ix ) {
486 if( idy ) { MovePS(0,idy); idy = 0; }
487 if( !idx ) { idx = ix; continue;}
488 if( ix*idx > 0 ) {
489 idx += ix;
490 } else {
491 MovePS(idx,0);
492 idx = ix;
493 }
494 continue;
495 }
496 if( iy ) {
497 if( idx ) { MovePS(idx,0); idx = 0; }
498 if( !idy) { idy = iy; continue;}
499 if( iy*idy > 0 ) {
500 idy += iy;
501 } else {
502 MovePS(0,idy);
503 idy = iy;
504 }
505 }
506 }
507 if( idx ) MovePS(idx,0);
508 if( idy ) MovePS(0,idy);
509
510 if (nn > 0 ) {
511 } else {
512 }
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Draw a PolyLine in NDC space
517///
518/// Draw a polyline through the points xy.
519/// --If NN=1 moves only to point x,y.
520/// --If NN=0 the x,y are written in the SVG file
521/// according to the current transformation.
522/// --If NN>0 the line is clipped as a line.
523/// - If NN<0 the line is clipped as a fill area.
524
526{
527 Int_t n, idx, idy;
528 Double_t ixd0, iyd0, ixdi, iydi, ix, iy;
529
530 if (nn > 0) {
531 n = nn;
532 } else {
533 n = -nn;
534 }
535
536 ixd0 = UtoSVG(xy[0].GetX());
537 iyd0 = VtoSVG(xy[0].GetY());
538 if( n <= 1) return;
539
540 idx = 0;
541 idy = 0;
542 for (Int_t i=1;i<n;i++) {
543 ixdi = UtoSVG(xy[i].GetX());
544 iydi = VtoSVG(xy[i].GetY());
545 ix = ixdi - ixd0;
546 iy = iydi - iyd0;
547 if (fCompact && (TMath::Abs(ix) < kEpsilon))
548 ix = 0;
549 if (fCompact && (TMath::Abs(iy) < kEpsilon))
550 iy = 0;
551 ixd0 = ixdi;
552 iyd0 = iydi;
553 if( ix && iy) {
554 if( idx ) { MovePS(idx,0); idx = 0; }
555 if( idy ) { MovePS(0,idy); idy = 0; }
556 MovePS(ix,iy);
557 continue;
558 }
559 if ( ix ) {
560 if( idy ) { MovePS(0,idy); idy = 0; }
561 if( !idx ) { idx = ix; continue;}
562 if( ix*idx > 0 ) {
563 idx += ix;
564 } else {
565 MovePS(idx,0);
566 idx = ix;
567 }
568 continue;
569 }
570 if( iy ) {
571 if( idx ) { MovePS(idx,0); idx = 0; }
572 if( !idy) { idy = iy; continue;}
573 if( iy*idy > 0 ) {
574 idy += iy;
575 } else {
576 MovePS(0,idy);
577 idy = iy;
578 }
579 }
580 }
581 if( idx ) MovePS(idx,0);
582 if( idy ) MovePS(0,idy);
583
584 if (nn > 0 ) {
585 if (xy[0].GetX() == xy[n-1].GetX() && xy[0].GetY() == xy[n-1].GetY()) PrintFast(3," cl");
586 } else {
587 }
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Paint PolyMarker
592
594{
597
598 if (ms == 4)
599 ms = 24;
600 else if (ms >= 6 && ms <= 8)
601 ms = 20;
602 else if (ms >= 9 && ms <= 19)
603 ms = 1;
604
605 // Define the marker size
607 if (fMarkerStyle == 1 || (fMarkerStyle >= 9 && fMarkerStyle <= 19)) msize = 0.01;
608 if (fMarkerStyle == 6) msize = 0.02;
609 if (fMarkerStyle == 7) msize = 0.04;
610
611 const Int_t kBASEMARKER = 8;
613 Float_t s2x = sbase / Float_t(gPad->GetWw() * gPad->GetAbsWNDC());
614 msize = this->UtoSVG(s2x) - this->UtoSVG(0);
615
616 Double_t m = msize;
617 Double_t m2 = m/2.;
618 Double_t m3 = m/3.;
619 Double_t m6 = m/6.;
620 Double_t m8 = m/8.;
621 Double_t m4 = m/4.;
622 Double_t m0 = m/10.;
623
624 // Draw the marker according to the type
625 PrintStr("@");
626 if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34 ||
627 ms == 39 || ms == 41 || ms == 43 || ms == 45 ||
628 ms == 47 || ms == 48 || ms == 49) {
629 PrintStr("<g fill=");
631 PrintStr(">");
632 } else {
633 PrintStr("<g stroke=");
635 PrintStr(" stroke-width=\"");
637 PrintStr("\" fill=\"none\"");
638 if (fgLineJoin)
639 PrintStr(TString::Format(" stroke-linejoin=\"%s\"", fgLineJoin == 1 ? "round" : "bevel"));
640 if (fgLineCap)
641 PrintStr(TString::Format(" stroke-linecap=\"%s\"", fgLineCap == 1 ? "round" : "square"));
642 PrintStr(">");
643 }
644 Double_t ix,iy;
645 for (Int_t i=0;i<n;i++) {
646 ix = XtoSVG(xw[i]);
647 iy = YtoSVG(yw[i]);
648 PrintStr("@");
649 // Dot (.)
650 if (ms == 1) {
651 PrintStr("<line x1=\"");
652 WriteReal(ix-1, kFALSE);
653 PrintStr("\" y1=\"");
654 WriteReal(iy, kFALSE);
655 PrintStr("\" x2=\"");
656 WriteReal(ix, kFALSE);
657 PrintStr("\" y2=\"");
658 WriteReal(iy, kFALSE);
659 PrintStr("\"/>");
660 // Plus (+)
661 } else if (ms == 2) {
662 PrintStr("<line x1=\"");
663 WriteReal(ix-m2, kFALSE);
664 PrintStr("\" y1=\"");
665 WriteReal(iy, kFALSE);
666 PrintStr("\" x2=\"");
667 WriteReal(ix+m2, kFALSE);
668 PrintStr("\" y2=\"");
669 WriteReal(iy, kFALSE);
670 PrintStr("\"/>");
671
672 PrintStr("<line x1=\"");
673 WriteReal(ix, kFALSE);
674 PrintStr("\" y1=\"");
675 WriteReal(iy-m2, kFALSE);
676 PrintStr("\" x2=\"");
677 WriteReal(ix, kFALSE);
678 PrintStr("\" y2=\"");
679 WriteReal(iy+m2, kFALSE);
680 PrintStr("\"/>");
681 // X shape (X)
682 } else if (ms == 5) {
683 PrintStr("<line x1=\"");
684 WriteReal(ix-m2*0.707, kFALSE);
685 PrintStr("\" y1=\"");
686 WriteReal(iy-m2*0.707, kFALSE);
687 PrintStr("\" x2=\"");
688 WriteReal(ix+m2*0.707, kFALSE);
689 PrintStr("\" y2=\"");
690 WriteReal(iy+m2*0.707, kFALSE);
691 PrintStr("\"/>");
692
693 PrintStr("<line x1=\"");
694 WriteReal(ix-m2*0.707, kFALSE);
695 PrintStr("\" y1=\"");
696 WriteReal(iy+m2*0.707, kFALSE);
697 PrintStr("\" x2=\"");
698 WriteReal(ix+m2*0.707, kFALSE);
699 PrintStr("\" y2=\"");
700 WriteReal(iy-m2*0.707, kFALSE);
701 PrintStr("\"/>");
702 // Asterisk shape (*)
703 } else if (ms == 3 || ms == 31) {
704 PrintStr("<line x1=\"");
705 WriteReal(ix-m2, kFALSE);
706 PrintStr("\" y1=\"");
707 WriteReal(iy, kFALSE);
708 PrintStr("\" x2=\"");
709 WriteReal(ix+m2, kFALSE);
710 PrintStr("\" y2=\"");
711 WriteReal(iy, kFALSE);
712 PrintStr("\"/>");
713
714 PrintStr("<line x1=\"");
715 WriteReal(ix, kFALSE);
716 PrintStr("\" y1=\"");
717 WriteReal(iy-m2, kFALSE);
718 PrintStr("\" x2=\"");
719 WriteReal(ix, kFALSE);
720 PrintStr("\" y2=\"");
721 WriteReal(iy+m2, kFALSE);
722 PrintStr("\"/>");
723
724 PrintStr("<line x1=\"");
725 WriteReal(ix-m2*0.707, kFALSE);
726 PrintStr("\" y1=\"");
727 WriteReal(iy-m2*0.707, kFALSE);
728 PrintStr("\" x2=\"");
729 WriteReal(ix+m2*0.707, kFALSE);
730 PrintStr("\" y2=\"");
731 WriteReal(iy+m2*0.707, kFALSE);
732 PrintStr("\"/>");
733
734 PrintStr("<line x1=\"");
735 WriteReal(ix-m2*0.707, kFALSE);
736 PrintStr("\" y1=\"");
737 WriteReal(iy+m2*0.707, kFALSE);
738 PrintStr("\" x2=\"");
739 WriteReal(ix+m2*0.707, kFALSE);
740 PrintStr("\" y2=\"");
741 WriteReal(iy-m2*0.707, kFALSE);
742 PrintStr("\"/>");
743 // Circle
744 } else if (ms == 24 || ms == 20) {
745 PrintStr("<circle cx=\"");
746 WriteReal(ix, kFALSE);
747 PrintStr("\" cy=\"");
748 WriteReal(iy, kFALSE);
749 PrintStr("\" r=\"");
750 if (m2<=0) m2=1;
751 WriteReal(m2, kFALSE);
752 PrintStr("\" fill=\"none\"");
753 PrintStr("/>");
754 // Square
755 } else if (ms == 25 || ms == 21) {
756 PrintStr("<rect x=\"");
757 WriteReal(ix-m2, kFALSE);
758 PrintStr("\" y=\"");
759 WriteReal(iy-m2, kFALSE);
760 PrintStr("\" width=\"");
762 PrintStr("\" height=\"");
764 PrintStr("\" fill=\"none\"");
765 PrintStr("/>");
766 // Down triangle
767 } else if (ms == 26 || ms == 22) {
768 PrintStr("<polygon points=\"");
769 WriteReal(ix); PrintStr(","); WriteReal(iy-m2);
770 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
771 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
772 PrintStr("\"/>");
773 // Up triangle
774 } else if (ms == 23 || ms == 32) {
775 PrintStr("<polygon points=\"");
776 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
777 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
778 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
779 PrintStr("\"/>");
780 // Diamond
781 } else if (ms == 27 || ms == 33) {
782 PrintStr("<polygon points=\"");
783 WriteReal(ix); PrintStr(","); WriteReal(iy-m2);
784 WriteReal(ix+m3); PrintStr(","); WriteReal(iy);
785 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
786 WriteReal(ix-m3); PrintStr(","); WriteReal(iy);
787 PrintStr("\"/>");
788 // Cross
789 } else if (ms == 28 || ms == 34) {
790 PrintStr("<polygon points=\"");
791 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6);
792 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m2);
793 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m2);
794 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
795 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m6);
796 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m6);
797 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
798 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m2);
799 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m2);
800 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
801 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m6);
802 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m6);
803 PrintStr("\"/>");
804 } else if (ms == 29 || ms == 30) {
805 PrintStr("<polygon points=\"");
806 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
807 WriteReal(ix+0.112255*m); PrintStr(","); WriteReal(iy+0.15451*m);
808 WriteReal(ix+0.47552*m); PrintStr(","); WriteReal(iy+0.15451*m);
809 WriteReal(ix+0.181635*m); PrintStr(","); WriteReal(iy-0.05902*m);
810 WriteReal(ix+0.29389*m); PrintStr(","); WriteReal(iy-0.40451*m);
811 WriteReal(ix); PrintStr(","); WriteReal(iy-0.19098*m);
812 WriteReal(ix-0.29389*m); PrintStr(","); WriteReal(iy-0.40451*m);
813 WriteReal(ix-0.181635*m); PrintStr(","); WriteReal(iy-0.05902*m);
814 WriteReal(ix-0.47552*m); PrintStr(","); WriteReal(iy+0.15451*m);
815 WriteReal(ix-0.112255*m); PrintStr(","); WriteReal(iy+0.15451*m);
816 PrintStr("\"/>");
817 } else if (ms == 35) {
818 PrintStr("<polygon points=\"");
819 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
820 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
821 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
822 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
823 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
824 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
825 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
826 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
827 PrintStr("\"/>");
828 } else if (ms == 36) {
829 PrintStr("<polygon points=\"");
830 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
831 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
832 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
833 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
834 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
835 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
836 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
837 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
838 PrintStr("\"/>");
839 } else if (ms == 37 || ms == 39) {
840 PrintStr("<polygon points=\"");
841 WriteReal(ix ); PrintStr(","); WriteReal(iy );
842 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
843 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
844 WriteReal(ix ); PrintStr(","); WriteReal(iy );
845 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
846 WriteReal(ix-m2); PrintStr(","); WriteReal(iy);
847 WriteReal(ix ); PrintStr(","); WriteReal(iy );
848 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
849 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
850 WriteReal(ix ); PrintStr(","); WriteReal(iy );
851 PrintStr("\"/>");
852 } else if (ms == 38) {
853 PrintStr("<polygon points=\"");
854 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
855 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
856 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
857 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
858 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
859 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
860 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
861 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
862 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
863 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
864 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
865 WriteReal(ix ); PrintStr(","); WriteReal(iy );
866 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
867 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
868 WriteReal(ix ); PrintStr(","); WriteReal(iy);
869 PrintStr("\"/>");
870 } else if (ms == 40 || ms == 41) {
871 PrintStr("<polygon points=\"");
872 WriteReal(ix ); PrintStr(","); WriteReal(iy );
873 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
874 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
875 WriteReal(ix ); PrintStr(","); WriteReal(iy );
876 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
877 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
878 WriteReal(ix ); PrintStr(","); WriteReal(iy );
879 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
880 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
881 WriteReal(ix ); PrintStr(","); WriteReal(iy );
882 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
883 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
884 WriteReal(ix ); PrintStr(","); WriteReal(iy );
885 PrintStr("\"/>");
886 } else if (ms == 42 || ms == 43) {
887 PrintStr("<polygon points=\"");
888 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
889 WriteReal(ix-m8); PrintStr(","); WriteReal(iy+m8);
890 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
891 WriteReal(ix-m8); PrintStr(","); WriteReal(iy-m8);
892 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
893 WriteReal(ix+m8); PrintStr(","); WriteReal(iy-m8);
894 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
895 WriteReal(ix+m8); PrintStr(","); WriteReal(iy+m8);
896 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
897 PrintStr("\"/>");
898 } else if (ms == 44) {
899 PrintStr("<polygon points=\"");
900 WriteReal(ix ); PrintStr(","); WriteReal(iy );
901 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
902 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
903 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
904 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
905 WriteReal(ix ); PrintStr(","); WriteReal(iy );
906 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
907 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
908 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
909 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
910 WriteReal(ix ); PrintStr(","); WriteReal(iy );
911 PrintStr("\"/>");
912 } else if (ms == 45) {
913 PrintStr("<polygon points=\"");
914 WriteReal(ix+m0); PrintStr(","); WriteReal(iy+m0);
915 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
916 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
917 WriteReal(ix-m0); PrintStr(","); WriteReal(iy+m0);
918 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
919 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
920 WriteReal(ix-m0); PrintStr(","); WriteReal(iy-m0);
921 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
922 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
923 WriteReal(ix+m0); PrintStr(","); WriteReal(iy-m0);
924 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
925 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
926 WriteReal(ix+m0); PrintStr(","); WriteReal(iy+m0);
927 PrintStr("\"/>");
928 } else if (ms == 46 || ms == 47) {
929 PrintStr("<polygon points=\"");
930 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4);
931 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
932 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
933 WriteReal(ix-m4); PrintStr(","); WriteReal(iy );
934 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
935 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
936 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4);
937 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
938 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
939 WriteReal(ix+m4); PrintStr(","); WriteReal(iy );
940 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
941 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
942 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4);
943 PrintStr("\"/>");
944 } else if (ms == 48) {
945 PrintStr("<polygon points=\"");
946 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*1.01);
947 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
948 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
949 WriteReal(ix-m4); PrintStr(","); WriteReal(iy );
950 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
951 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
952 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4);
953 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
954 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
955 WriteReal(ix+m4); PrintStr(","); WriteReal(iy );
956 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
957 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
958 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*0.99);
959 WriteReal(ix+m4*0.99); PrintStr(","); WriteReal(iy );
960 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4*0.99);
961 WriteReal(ix-m4*0.99); PrintStr(","); WriteReal(iy );
962 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*0.99);
963 PrintStr("\"/>");
964 } else if (ms == 49) {
965 PrintStr("<polygon points=\"");
966 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6*1.01);
967 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m2);
968 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m2);
969 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
970 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m6);
971 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m6);
972 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
973 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m2);
974 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m2);
975 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
976 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m6);
977 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m6);
978 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6*0.99);
979 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
980 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
981 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
982 PrintStr("\"/>");
983 } else {
984 PrintStr("<line x1=\"");
985 WriteReal(ix-1, kFALSE);
986 PrintStr("\" y1=\"");
987 WriteReal(iy, kFALSE);
988 PrintStr("\" x2=\"");
989 WriteReal(ix, kFALSE);
990 PrintStr("\" y2=\"");
991 WriteReal(iy, kFALSE);
992 PrintStr("\"/>");
993 }
994 }
995 PrintStr("@");
996 PrintStr("</g>");
997}
998
999////////////////////////////////////////////////////////////////////////////////
1000/// Paint PolyMarker
1001
1003{
1006
1007 if (ms == 4)
1008 ms = 24;
1009 else if (ms >= 6 && ms <= 8)
1010 ms = 20;
1011 else if (ms >= 9 && ms <= 19)
1012 ms = 1;
1013
1014 // Define the marker size
1016 if (fMarkerStyle == 1 || (fMarkerStyle >= 9 && fMarkerStyle <= 19)) msize = 0.01;
1017 if (fMarkerStyle == 6) msize = 0.02;
1018 if (fMarkerStyle == 7) msize = 0.04;
1019
1020 const Int_t kBASEMARKER = 8;
1022 Float_t s2x = sbase / Float_t(gPad->GetWw() * gPad->GetAbsWNDC());
1023 msize = this->UtoSVG(s2x) - this->UtoSVG(0);
1024
1025 Double_t m = msize;
1026 Double_t m2 = m/2;
1027 Double_t m3 = m/3;
1028 Double_t m6 = m/6;
1029 Double_t m4 = m/4.;
1030 Double_t m8 = m/8.;
1031 Double_t m0 = m/10.;
1032
1033 // Draw the marker according to the type
1034 PrintStr("@");
1035 if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34 ||
1036 ms == 39 || ms == 41 || ms == 43 || ms == 45 ||
1037 ms == 47 || ms == 48 || ms == 49) {
1038 PrintStr("<g fill=");
1040 PrintStr(">");
1041 } else {
1042 PrintStr("<g stroke=");
1044 PrintStr(" stroke-width=\"");
1046 PrintStr("\" fill=\"none\"");
1047 if (fgLineJoin)
1048 PrintStr(TString::Format(" stroke-linejoin=\"%s\"", fgLineJoin == 1 ? "round" : "bevel"));
1049 if (fgLineCap)
1050 PrintStr(TString::Format(" stroke-linecap=\"%s\"", fgLineCap == 1 ? "round" : "square"));
1051 PrintStr(">");
1052 }
1053 Double_t ix,iy;
1054 for (Int_t i=0;i<n;i++) {
1055 ix = XtoSVG(xw[i]);
1056 iy = YtoSVG(yw[i]);
1057 PrintStr("@");
1058 // Dot (.)
1059 if (ms == 1) {
1060 PrintStr("<line x1=\"");
1061 WriteReal(ix-1, kFALSE);
1062 PrintStr("\" y1=\"");
1063 WriteReal(iy, kFALSE);
1064 PrintStr("\" x2=\"");
1065 WriteReal(ix, kFALSE);
1066 PrintStr("\" y2=\"");
1067 WriteReal(iy, kFALSE);
1068 PrintStr("\"/>");
1069 // Plus (+)
1070 } else if (ms == 2) {
1071 PrintStr("<line x1=\"");
1072 WriteReal(ix-m2, kFALSE);
1073 PrintStr("\" y1=\"");
1074 WriteReal(iy, kFALSE);
1075 PrintStr("\" x2=\"");
1076 WriteReal(ix+m2, kFALSE);
1077 PrintStr("\" y2=\"");
1078 WriteReal(iy, kFALSE);
1079 PrintStr("\"/>");
1080
1081 PrintStr("<line x1=\"");
1082 WriteReal(ix, kFALSE);
1083 PrintStr("\" y1=\"");
1084 WriteReal(iy-m2, kFALSE);
1085 PrintStr("\" x2=\"");
1086 WriteReal(ix, kFALSE);
1087 PrintStr("\" y2=\"");
1088 WriteReal(iy+m2, kFALSE);
1089 PrintStr("\"/>");
1090 // X shape (X)
1091 } else if (ms == 5) {
1092 PrintStr("<line x1=\"");
1093 WriteReal(ix-m2*0.707, kFALSE);
1094 PrintStr("\" y1=\"");
1095 WriteReal(iy-m2*0.707, kFALSE);
1096 PrintStr("\" x2=\"");
1097 WriteReal(ix+m2*0.707, kFALSE);
1098 PrintStr("\" y2=\"");
1099 WriteReal(iy+m2*0.707, kFALSE);
1100 PrintStr("\"/>");
1101
1102 PrintStr("<line x1=\"");
1103 WriteReal(ix-m2*0.707, kFALSE);
1104 PrintStr("\" y1=\"");
1105 WriteReal(iy+m2*0.707, kFALSE);
1106 PrintStr("\" x2=\"");
1107 WriteReal(ix+m2*0.707, kFALSE);
1108 PrintStr("\" y2=\"");
1109 WriteReal(iy-m2*0.707, kFALSE);
1110 PrintStr("\"/>");
1111 // Asterisk shape (*)
1112 } else if (ms == 3 || ms == 31) {
1113 PrintStr("<line x1=\"");
1114 WriteReal(ix-m2, kFALSE);
1115 PrintStr("\" y1=\"");
1116 WriteReal(iy, kFALSE);
1117 PrintStr("\" x2=\"");
1118 WriteReal(ix+m2, kFALSE);
1119 PrintStr("\" y2=\"");
1120 WriteReal(iy, kFALSE);
1121 PrintStr("\"/>");
1122
1123 PrintStr("<line x1=\"");
1124 WriteReal(ix, kFALSE);
1125 PrintStr("\" y1=\"");
1126 WriteReal(iy-m2, kFALSE);
1127 PrintStr("\" x2=\"");
1128 WriteReal(ix, kFALSE);
1129 PrintStr("\" y2=\"");
1130 WriteReal(iy+m2, kFALSE);
1131 PrintStr("\"/>");
1132
1133 PrintStr("<line x1=\"");
1134 WriteReal(ix-m2*0.707, kFALSE);
1135 PrintStr("\" y1=\"");
1136 WriteReal(iy-m2*0.707, kFALSE);
1137 PrintStr("\" x2=\"");
1138 WriteReal(ix+m2*0.707, kFALSE);
1139 PrintStr("\" y2=\"");
1140 WriteReal(iy+m2*0.707, kFALSE);
1141 PrintStr("\"/>");
1142
1143 PrintStr("<line x1=\"");
1144 WriteReal(ix-m2*0.707, kFALSE);
1145 PrintStr("\" y1=\"");
1146 WriteReal(iy+m2*0.707, kFALSE);
1147 PrintStr("\" x2=\"");
1148 WriteReal(ix+m2*0.707, kFALSE);
1149 PrintStr("\" y2=\"");
1150 WriteReal(iy-m2*0.707, kFALSE);
1151 PrintStr("\"/>");
1152 // Circle
1153 } else if (ms == 24 || ms == 20) {
1154 PrintStr("<circle cx=\"");
1155 WriteReal(ix, kFALSE);
1156 PrintStr("\" cy=\"");
1157 WriteReal(iy, kFALSE);
1158 PrintStr("\" r=\"");
1159 if (m2<=0) m2=1;
1160 WriteReal(m2, kFALSE);
1161 PrintStr("\"/>");
1162 // Square
1163 } else if (ms == 25 || ms == 21) {
1164 PrintStr("<rect x=\"");
1165 WriteReal(ix-m2, kFALSE);
1166 PrintStr("\" y=\"");
1167 WriteReal(iy-m2, kFALSE);
1168 PrintStr("\" width=\"");
1169 WriteReal(m, kFALSE);
1170 PrintStr("\" height=\"");
1171 WriteReal(m, kFALSE);
1172 PrintStr("\"/>");
1173 // Down triangle
1174 } else if (ms == 26 || ms == 22) {
1175 PrintStr("<polygon points=\"");
1176 WriteReal(ix); PrintStr(","); WriteReal(iy-m2);
1177 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
1178 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
1179 PrintStr("\"/>");
1180 // Up triangle
1181 } else if (ms == 23 || ms == 32) {
1182 PrintStr("<polygon points=\"");
1183 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
1184 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
1185 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
1186 PrintStr("\"/>");
1187 // Diamond
1188 } else if (ms == 27 || ms == 33) {
1189 PrintStr("<polygon points=\"");
1190 WriteReal(ix); PrintStr(","); WriteReal(iy-m2);
1191 WriteReal(ix+m3); PrintStr(","); WriteReal(iy);
1192 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
1193 WriteReal(ix-m3); PrintStr(","); WriteReal(iy);
1194 PrintStr("\"/>");
1195 // Cross
1196 } else if (ms == 28 || ms == 34) {
1197 PrintStr("<polygon points=\"");
1198 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6);
1199 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m2);
1200 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m2);
1201 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
1202 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m6);
1203 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m6);
1204 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
1205 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m2);
1206 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m2);
1207 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
1208 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m6);
1209 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m6);
1210 PrintStr("\"/>");
1211 } else if (ms == 29 || ms == 30) {
1212 PrintStr("<polygon points=\"");
1213 WriteReal(ix); PrintStr(","); WriteReal(iy+m2);
1214 WriteReal(ix+0.112255*m); PrintStr(","); WriteReal(iy+0.15451*m);
1215 WriteReal(ix+0.47552*m); PrintStr(","); WriteReal(iy+0.15451*m);
1216 WriteReal(ix+0.181635*m); PrintStr(","); WriteReal(iy-0.05902*m);
1217 WriteReal(ix+0.29389*m); PrintStr(","); WriteReal(iy-0.40451*m);
1218 WriteReal(ix); PrintStr(","); WriteReal(iy-0.19098*m);
1219 WriteReal(ix-0.29389*m); PrintStr(","); WriteReal(iy-0.40451*m);
1220 WriteReal(ix-0.181635*m); PrintStr(","); WriteReal(iy-0.05902*m);
1221 WriteReal(ix-0.47552*m); PrintStr(","); WriteReal(iy+0.15451*m);
1222 WriteReal(ix-0.112255*m); PrintStr(","); WriteReal(iy+0.15451*m);
1223 PrintStr("\"/>");
1224 } else if (ms == 35) {
1225 PrintStr("<polygon points=\"");
1226 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
1227 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
1228 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
1229 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
1230 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
1231 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
1232 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
1233 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
1234 PrintStr("\"/>");
1235 } else if (ms == 36) {
1236 PrintStr("<polygon points=\"");
1237 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
1238 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
1239 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
1240 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
1241 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m2);
1242 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m2);
1243 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m2);
1244 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m2);
1245 PrintStr("\"/>");
1246 } else if (ms == 37 || ms == 39) {
1247 PrintStr("<polygon points=\"");
1248 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1249 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1250 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1251 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1252 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1253 WriteReal(ix-m2); PrintStr(","); WriteReal(iy);
1254 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1255 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
1256 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1257 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1258 PrintStr("\"/>");
1259 } else if (ms == 38) {
1260 PrintStr("<polygon points=\"");
1261 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
1262 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
1263 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1264 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1265 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
1266 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
1267 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1268 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1269 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
1270 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
1271 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
1272 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1273 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
1274 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
1275 WriteReal(ix ); PrintStr(","); WriteReal(iy);
1276 PrintStr("\"/>");
1277 } else if (ms == 40 || ms == 41) {
1278 PrintStr("<polygon points=\"");
1279 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1280 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1281 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
1282 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1283 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
1284 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1285 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1286 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1287 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
1288 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1289 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
1290 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1291 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1292 PrintStr("\"/>");
1293 } else if (ms == 42 || ms == 43) {
1294 PrintStr("<polygon points=\"");
1295 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
1296 WriteReal(ix-m8); PrintStr(","); WriteReal(iy+m8);
1297 WriteReal(ix-m2); PrintStr(","); WriteReal(iy );
1298 WriteReal(ix-m8); PrintStr(","); WriteReal(iy-m8);
1299 WriteReal(ix ); PrintStr(","); WriteReal(iy-m2);
1300 WriteReal(ix+m8); PrintStr(","); WriteReal(iy-m8);
1301 WriteReal(ix+m2); PrintStr(","); WriteReal(iy );
1302 WriteReal(ix+m8); PrintStr(","); WriteReal(iy+m8);
1303 WriteReal(ix ); PrintStr(","); WriteReal(iy+m2);
1304 PrintStr("\"/>");
1305 } else if (ms == 44) {
1306 PrintStr("<polygon points=\"");
1307 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1308 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1309 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1310 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1311 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1312 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1313 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
1314 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
1315 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
1316 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
1317 WriteReal(ix ); PrintStr(","); WriteReal(iy );
1318 PrintStr("\"/>");
1319 } else if (ms == 45) {
1320 PrintStr("<polygon points=\"");
1321 WriteReal(ix+m0); PrintStr(","); WriteReal(iy+m0);
1322 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1323 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1324 WriteReal(ix-m0); PrintStr(","); WriteReal(iy+m0);
1325 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
1326 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
1327 WriteReal(ix-m0); PrintStr(","); WriteReal(iy-m0);
1328 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1329 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1330 WriteReal(ix+m0); PrintStr(","); WriteReal(iy-m0);
1331 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
1332 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
1333 WriteReal(ix+m0); PrintStr(","); WriteReal(iy+m0);
1334 PrintStr("\"/>");
1335 } else if (ms == 46 || ms == 47) {
1336 PrintStr("<polygon points=\"");
1337 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4);
1338 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1339 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
1340 WriteReal(ix-m4); PrintStr(","); WriteReal(iy );
1341 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
1342 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1343 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4);
1344 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1345 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
1346 WriteReal(ix+m4); PrintStr(","); WriteReal(iy );
1347 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
1348 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1349 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4);
1350 PrintStr("\"/>");
1351 } else if (ms == 48) {
1352 PrintStr("<polygon points=\"");
1353 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*1.01);
1354 WriteReal(ix-m4); PrintStr(","); WriteReal(iy+m2);
1355 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m4);
1356 WriteReal(ix-m4); PrintStr(","); WriteReal(iy );
1357 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m4);
1358 WriteReal(ix-m4); PrintStr(","); WriteReal(iy-m2);
1359 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4);
1360 WriteReal(ix+m4); PrintStr(","); WriteReal(iy-m2);
1361 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m4);
1362 WriteReal(ix+m4); PrintStr(","); WriteReal(iy );
1363 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m4);
1364 WriteReal(ix+m4); PrintStr(","); WriteReal(iy+m2);
1365 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*0.99);
1366 WriteReal(ix+m4*0.99); PrintStr(","); WriteReal(iy );
1367 WriteReal(ix ); PrintStr(","); WriteReal(iy-m4*0.99);
1368 WriteReal(ix-m4*0.99); PrintStr(","); WriteReal(iy );
1369 WriteReal(ix ); PrintStr(","); WriteReal(iy+m4*0.99);
1370 PrintStr("\"/>");
1371 } else if (ms == 49) {
1372 PrintStr("<polygon points=\"");
1373 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6*1.01);
1374 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m2);
1375 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m2);
1376 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
1377 WriteReal(ix+m2); PrintStr(","); WriteReal(iy-m6);
1378 WriteReal(ix+m2); PrintStr(","); WriteReal(iy+m6);
1379 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
1380 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m2);
1381 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m2);
1382 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
1383 WriteReal(ix-m2); PrintStr(","); WriteReal(iy+m6);
1384 WriteReal(ix-m2); PrintStr(","); WriteReal(iy-m6);
1385 WriteReal(ix-m6); PrintStr(","); WriteReal(iy-m6*0.99);
1386 WriteReal(ix-m6); PrintStr(","); WriteReal(iy+m6);
1387 WriteReal(ix+m6); PrintStr(","); WriteReal(iy+m6);
1388 WriteReal(ix+m6); PrintStr(","); WriteReal(iy-m6);
1389 PrintStr("\"/>");
1390 } else {
1391 PrintStr("<line x1=\"");
1392 WriteReal(ix-1, kFALSE);
1393 PrintStr("\" y1=\"");
1394 WriteReal(iy, kFALSE);
1395 PrintStr("\" x2=\"");
1396 WriteReal(ix, kFALSE);
1397 PrintStr("\" y2=\"");
1398 WriteReal(iy, kFALSE);
1399 PrintStr("\"/>");
1400 }
1401 }
1402 PrintStr("@");
1403 PrintStr("</g>");
1404}
1405
1406////////////////////////////////////////////////////////////////////////////////
1407/// This function defines a path with xw and yw and draw it according the
1408/// value of nn:
1409///
1410/// - If nn>0 a line is drawn.
1411/// - If nn<0 a closed polygon is drawn.
1412
1414{
1415 Int_t n, fais, fasi;
1416 Double_t ixd0, iyd0, idx, idy, ixdi, iydi, ix, iy;
1417 fais = fasi = 0;
1418
1419 if (nn > 0) {
1420 if (fLineWidth<=0) return;
1421 n = nn;
1422 } else {
1423 n = -nn;
1424 fais = fFillStyle/1000;
1425 fasi = fFillStyle%1000;
1426 if (fais == 3 || fais == 2) {
1427 if (fasi > 100 && fasi <125) {
1428 return;
1429 }
1430 if (fasi > 0 && fasi < 26) {
1431 }
1432 }
1433 }
1434
1435 if( n <= 1) {
1436 Error("DrawPS", "Two points are needed");
1437 return;
1438 }
1439
1440 ixd0 = XtoSVG(xw[0]);
1441 iyd0 = YtoSVG(yw[0]);
1442
1443 PrintStr("@");
1444 PrintFast(10,"<path d=\"M");
1446 PrintFast(1,",");
1448
1449 idx = idy = 0;
1450 for (Int_t i=1;i<n;i++) {
1451 ixdi = XtoSVG(xw[i]);
1452 iydi = YtoSVG(yw[i]);
1453 ix = ixdi - ixd0;
1454 iy = iydi - iyd0;
1455 if (fCompact && (TMath::Abs(ix) < kEpsilon))
1456 ix = 0;
1457 if (fCompact && (TMath::Abs(iy) < kEpsilon))
1458 iy = 0;
1459 ixd0 = ixdi;
1460 iyd0 = iydi;
1461 if( ix && iy) {
1462 if( idx ) { MovePS(idx,0); idx = 0; }
1463 if( idy ) { MovePS(0,idy); idy = 0; }
1464 MovePS(ix,iy);
1465 } else if ( ix ) {
1466 if( idy ) { MovePS(0,idy); idy = 0;}
1467 if( !idx ) { idx = ix;}
1468 else if( TMath::Sign(ix,idx) == ix ) idx += ix;
1469 else { MovePS(idx,0); idx = ix;}
1470 } else if( iy ) {
1471 if( idx ) { MovePS(idx,0); idx = 0;}
1472 if( !idy) { idy = iy;}
1473 else if( TMath::Sign(iy,idy) == iy) idy += iy;
1474 else { MovePS(0,idy); idy = iy;}
1475 }
1476 }
1477 if (idx) MovePS(idx,0);
1478 if (idy) MovePS(0,idy);
1479
1480 if (nn > 0 ) {
1481 if (xw[0] == xw[n-1] && yw[0] == yw[n-1]) PrintFast(1,"z");
1482 PrintFast(21,"\" fill=\"none\" stroke=");
1484 if(fLineWidth > 1.) {
1485 PrintFast(15," stroke-width=\"");
1487 PrintFast(1,"\"");
1488 }
1489 if (fLineStyle > 1) {
1490 PrintFast(19," stroke-dasharray=\"");
1492 TObjArray *tokens = st.Tokenize(" ");
1493 for (Int_t j = 0; j<tokens->GetEntries(); j++) {
1494 Int_t it;
1495 sscanf(((TObjString*)tokens->At(j))->GetName(), "%d", &it);
1496 if (j>0) PrintFast(1,",");
1497 WriteReal(it/4);
1498 }
1499 delete tokens;
1500 PrintFast(1,"\"");
1501 }
1502 } else {
1503 PrintFast(8,"z\" fill=");
1504 if (fais == 0) {
1505 PrintFast(14,"\"none\" stroke=");
1507 } else {
1509 }
1510 }
1511 if (fgLineJoin)
1512 PrintStr(TString::Format(" stroke-linejoin=\"%s\"", fgLineJoin == 1 ? "round" : "bevel"));
1513 if (fgLineCap)
1514 PrintStr(TString::Format(" stroke-linecap=\"%s\"", fgLineCap == 1 ? "round" : "square"));
1515 PrintFast(2,"/>");
1516}
1517
1518////////////////////////////////////////////////////////////////////////////////
1519/// Initialize the SVG file. The main task of the function is to output the
1520/// SVG header file which consist in `<title>`, `<desc>` and `<defs>`. The
1521/// HeaderPS provided by the user program is written in the `<defs>` part.
1522
1524{
1525 // Title
1526 PrintStr("<title>@");
1527 PrintStr(GetName());
1528 PrintStr("@");
1529 PrintStr("</title>@");
1530
1531 if (fCompact)
1532 return;
1533
1534 // Description
1535 PrintStr("<desc>@");
1536 PrintFast(22,"Creator: ROOT Version ");
1537 PrintStr(gROOT->GetVersion());
1538 PrintStr("@");
1539 PrintFast(14,"CreationDate: ");
1540 TDatime t;
1541 PrintStr(t.AsString());
1542 //Check a special header is defined in the current style
1544 if (nh) {
1546 }
1547 PrintStr("</desc>@");
1548
1549 // Definitions
1550 PrintStr("<defs>@");
1551 PrintStr("</defs>@");
1552
1553}
1554
1555////////////////////////////////////////////////////////////////////////////////
1556/// Write float value into output stream
1557/// In compact form try to store only first 2-3 significant digits
1558
1560{
1561 if (fCompact) {
1562 auto a = std::abs(r);
1563 if (a > 10)
1564 TVirtualPS::WriteInteger(std::lround(r), space);
1565 else if (a < 0.005)
1566 TVirtualPS::WriteReal(r, space);
1567 else {
1568 char str[15];
1569 snprintf(str, 15, (a > 1) ? "%3.1f" : "%5.3f", r);
1570 if(space)
1571 PrintFast(1," ");
1572 PrintStr(str);
1573 }
1574 } else
1575 TVirtualPS::WriteReal(r, space);
1576}
1577
1578////////////////////////////////////////////////////////////////////////////////
1579/// Move to a new position (ix, iy). The move is done in relative coordinates
1580/// which allows to have short numbers which decrease the size of the file.
1581/// This function use the full power of the SVG's paths by using the
1582/// horizontal and vertical move whenever it is possible.
1583
1585{
1586 if (ix != 0 && iy != 0) {
1587 PrintFast(1,"l");
1588 WriteReal(ix);
1589 PrintFast(1,",");
1590 WriteReal(iy);
1591 } else if (ix != 0) {
1592 PrintFast(1,"h");
1593 WriteReal(ix);
1594 } else if (iy != 0) {
1595 PrintFast(1,"v");
1596 WriteReal(iy);
1597 }
1598}
1599
1600////////////////////////////////////////////////////////////////////////////////
1601/// Start the SVG page. This function initialize the pad conversion
1602/// coefficients and output the `<svg>` directive which is close later in the
1603/// the function Close.
1604
1606{
1607 // Compute pad conversion coefficients
1608 if (gPad) {
1609 Double_t ww = gPad->GetWw();
1610 Double_t wh = gPad->GetWh();
1611 fYsize = fXsize*wh/ww;
1612 } else {
1613 fYsize = 27;
1614 }
1615
1616 // <svg> directive. It defines the viewBox.
1617 if(!fBoundingBox) {
1618 PrintStr("@<?xml version=\"1.0\" standalone=\"no\"?>");
1619 PrintStr("@<svg width=\"");
1621 PrintStr("\" height=\"");
1624 PrintStr("\" viewBox=\"0 0");
1627 PrintStr("\" xmlns=\"http://www.w3.org/2000/svg\" shape-rendering=\"crispEdges\">");
1628 PrintStr("@");
1629 Initialize();
1631 }
1632}
1633
1634////////////////////////////////////////////////////////////////////////////////
1635/// Set the range for the paper in centimetres
1636
1638{
1639 fXsize = xsize;
1640 fYsize = ysize;
1641 fRange = kTRUE;
1642}
1643
1644////////////////////////////////////////////////////////////////////////////////
1645/// Set color index for fill areas
1646
1651
1652////////////////////////////////////////////////////////////////////////////////
1653/// Set color index for lines
1654
1659
1660////////////////////////////////////////////////////////////////////////////////
1661/// Set the value of the global parameter TSVG::fgLineJoin.
1662/// This parameter determines the appearance of joining lines in a SVG
1663/// output.
1664/// It takes one argument which may be:
1665/// - 0 (miter join)
1666/// - 1 (round join)
1667/// - 2 (bevel join)
1668/// The default value is 0 (miter join).
1669///
1670/// \image html postscript_1.png
1671///
1672/// To change the line join behaviour just do:
1673/// ~~~ {.cpp}
1674/// gStyle->SetJoinLinePS(2); // Set the PS line join to bevel.
1675/// ~~~
1676
1678{
1680 if (fgLineJoin<0) fgLineJoin=0;
1681 if (fgLineJoin>2) fgLineJoin=2;
1682}
1683
1684////////////////////////////////////////////////////////////////////////////////
1685/// Set the value of the global parameter TSVG::fgLineCap.
1686/// This parameter determines the appearance of line caps in a SVG
1687/// output.
1688/// It takes one argument which may be:
1689/// - 0 (butt caps)
1690/// - 1 (round caps)
1691/// - 2 (projecting caps)
1692/// The default value is 0 (butt caps).
1693///
1694/// \image html postscript_2.png
1695///
1696/// To change the line cap behaviour just do:
1697/// ~~~ {.cpp}
1698/// gStyle->SetCapLinePS(2); // Set the PS line cap to projecting.
1699/// ~~~
1700
1702{
1704 if (fgLineCap<0) fgLineCap=0;
1705 if (fgLineCap>2) fgLineCap=2;
1706}
1707
1708////////////////////////////////////////////////////////////////////////////////
1709/// Change the line style
1710///
1711/// - linestyle = 2 dashed
1712/// - linestyle = 3 dotted
1713/// - linestyle = 4 dash-dotted
1714/// - linestyle = else solid (1 in is used most of the time)
1715
1720
1721////////////////////////////////////////////////////////////////////////////////
1722/// Set the lines width.
1723
1728
1729////////////////////////////////////////////////////////////////////////////////
1730/// Set color index for markers.
1731
1736
1737////////////////////////////////////////////////////////////////////////////////
1738/// Set RGBa color with its color index
1739
1741{
1742 if (color < 0) color = 0;
1743 TColor *col = gROOT->GetColor(color);
1744 if (col) {
1745 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
1746 Float_t a = col->GetAlpha();
1747 if (a<1.) PrintStr(TString::Format(" fill-opacity=\"%3.2f\" stroke-opacity=\"%3.2f\"",a,a));
1748 } else {
1749 SetColor(1., 1., 1.);
1750 }
1751}
1752
1753////////////////////////////////////////////////////////////////////////////////
1754/// Set RGB (without alpha channel) color with its color index
1755
1757{
1758 if (color < 0) color = 0;
1759 TColor *col = gROOT->GetColor(color);
1760 if (col) {
1761 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
1762 } else {
1763 SetColor(1., 1., 1.);
1764 }
1765}
1766
1767////////////////////////////////////////////////////////////////////////////////
1768/// Set color with its R G B components
1769///
1770/// - r: % of red in [0,1]
1771/// --g: % of green in [0,1]
1772/// - b: % of blue in [0,1]
1773
1775{
1776 if (r <= 0. && g <= 0. && b <= 0. ) {
1777 PrintFast(7,"\"black\"");
1778 } else if (r >= 1. && g >= 1. && b >= 1. ) {
1779 PrintFast(7,"\"white\"");
1780 } else {
1781 char str[12];
1782 snprintf(str,12,"\"#%2.2x%2.2x%2.2x\"",Int_t(255.*r)
1783 ,Int_t(255.*g)
1784 ,Int_t(255.*b));
1785 PrintStr(str);
1786 }
1787}
1788
1789////////////////////////////////////////////////////////////////////////////////
1790/// Set color index for text
1791
1796
1797////////////////////////////////////////////////////////////////////////////////
1798/// Draw text
1799///
1800/// - xx: x position of the text
1801/// - yy: y position of the text
1802/// - chars: text to be drawn
1803
1805{
1806 static const char *fontFamily[] = {
1807 "Times" , "Times" , "Times",
1808 "Helvetica", "Helvetica", "Helvetica" , "Helvetica",
1809 "Courier" , "Courier" , "Courier" , "Courier",
1810 "Times" ,"Times" , "ZapfDingbats", "Times"};
1811
1812 static const char *fontWeight[] = {
1813 "normal", "bold", "bold",
1814 "normal", "normal", "bold" , "bold",
1815 "normal", "normal", "bold" , "bold",
1816 "normal", "normal", "normal", "normal"};
1817
1818 static const char *fontStyle[] = {
1819 "italic", "normal" , "italic",
1820 "normal", "oblique", "normal", "oblique",
1821 "normal", "oblique", "normal", "oblique",
1822 "normal", "normal" , "normal", "italic"};
1823
1824 Double_t ix = XtoSVG(xx);
1825 Double_t iy = YtoSVG(yy);
1827 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
1829 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
1830
1831 Double_t wh = (Double_t)gPad->XtoPixel(gPad->GetX2());
1832 Double_t hh = (Double_t)gPad->YtoPixel(gPad->GetY1());
1833 Float_t fontrap = 1.09; //scale down compared to X11
1835
1836 Int_t font = abs(fTextFont)/10;
1837 if (font > 15 || font < 1)
1838 font = 1;
1839 if (wh < hh) {
1840 ftsize = fTextSize*fXsize*gPad->GetAbsWNDC();
1841 } else {
1842 ftsize = fTextSize*fYsize*gPad->GetAbsHNDC();
1843 }
1844 Int_t ifont = font-1;
1845
1847 if( fontsize <= 0) return;
1848
1849 if (txalv == 3) iy = iy+fontsize;
1850 if (txalv == 2) iy = iy+(fontsize/2);
1851
1852 if (fTextAngle != 0.) {
1853 PrintStr("@");
1854 PrintFast(21,"<g transform=\"rotate(");
1856 PrintFast(1,",");
1857 WriteReal(ix, kFALSE);
1858 PrintFast(1,",");
1859 WriteReal(iy, kFALSE);
1860 PrintFast(3,")\">");
1861 }
1862
1863 PrintStr("@");
1864 PrintFast(30,"<text xml:space=\"preserve\" x=\"");
1865 WriteReal(ix, kFALSE);
1866 PrintFast(5,"\" y=\"");
1867 WriteReal(iy, kFALSE);
1868 PrintFast(1,"\"");
1869 if (txalh == 2) {
1870 PrintFast(21," text-anchor=\"middle\"");
1871 } else if (txalh == 3) {
1872 PrintFast(18," text-anchor=\"end\"");
1873 }
1874 PrintFast(6," fill=");
1876 PrintFast(12," font-size=\"");
1878 PrintFast(15,"\" font-family=\"");
1880 if (strcmp(fontWeight[ifont],"normal")) {
1881 PrintFast(15,"\" font-weight=\"");
1883 }
1884 if (strcmp(fontStyle[ifont],"normal")) {
1885 PrintFast(14,"\" font-style=\"");
1887 }
1888 PrintFast(2,"\">");
1889
1890 if (font == 12 || font == 15) {
1891 Int_t ichar = chars[0]+848;
1892 Int_t ic = ichar;
1893
1894 // Math Symbols (cf: http://www.fileformat.info/info/unicode/category/Sm/list.htm)
1895 if (ic == 755) ichar = 8804;
1896 if (ic == 759) ichar = 9827;
1897 if (ic == 760) ichar = 9830;
1898 if (ic == 761) ichar = 9829;
1899 if (ic == 762) ichar = 9824;
1900 if (ic == 766) ichar = 8594;
1901 if (ic == 776) ichar = 247;
1902 if (ic == 757) ichar = 8734;
1903 if (ic == 758) ichar = 402;
1904 if (ic == 771) ichar = 8805;
1905 if (ic == 774) ichar = 8706;
1906 if (ic == 775) ichar = 8226;
1907 if (ic == 779) ichar = 8776;
1908 if (ic == 805) ichar = 8719;
1909 if (ic == 821) ichar = 8721;
1910 if (ic == 834) ichar = 8747;
1911 if (ic == 769) ichar = 177;
1912 if (ic == 772) ichar = 215;
1913 if (ic == 768) ichar = 176;
1914 if (ic == 791) ichar = 8745;
1915 if (ic == 793) ichar = 8835; // SUPERSET OF
1916 if (ic == 794) ichar = 8839; // SUPERSET OF OR EQUAL TO
1917 if (ic == 795) ichar = 8836; // NOT A SUBSET OF
1918 if (ic == 796) ichar = 8834;
1919 if (ic == 893) ichar = 8722;
1920 if (ic == 803) ichar = 169; // COPYRIGHT SIGN
1921 if (ic == 819) ichar = 169; // COPYRIGHT SIGN
1922 if (ic == 804) ichar = 8482;
1923 if (ic == 770) ichar = 34;
1924 if (ic == 823) ichar = 10072;
1925 if (ic == 781) ichar = 10072;
1926 if (ic == 824) ichar = 9117; // LEFT PARENTHESIS LOWER HOOK
1927 if (ic == 822) ichar = 9115; // LEFT PARENTHESIS UPPER HOOK
1928 if (ic == 767) ichar = 8595; // DOWNWARDS ARROW
1929 if (ic == 763) ichar = 8596; // LEFT RIGHT ARROW
1930 if (ic == 764) ichar = 8592; // LEFTWARDS ARROW
1931 if (ic == 788) ichar = 8855; // CIRCLED TIMES
1932 if (ic == 784) ichar = 8501;
1933 if (ic == 777) ichar = 8800;
1934 if (ic == 797) ichar = 8838;
1935 if (ic == 800) ichar = 8736;
1936 if (ic == 812) ichar = 8656; // LEFTWARDS DOUBLE ARROW
1937 if (ic == 817) ichar = 60; // LESS-THAN SIGN
1938 if (ic == 833) ichar = 62; // GREATER-THAN SIGN
1939 if (ic == 778) ichar = 8803; // STRICTLY EQUIVALENT TO
1940 if (ic == 809) ichar = 8743; // LOGICAL AND
1941 if (ic == 802) ichar = 9415; // CIRCLED LATIN CAPITAL LETTER R
1942 if (ic == 780) ichar = 8230; // HORIZONTAL ELLIPSIS
1943 if (ic == 801) ichar = 8711; // NABLA
1944 if (ic == 783) ichar = 8629; // DOWNWARDS ARROW WITH CORNER LEFTWARDS
1945 if (ic == 782) ichar = 8213;
1946 if (ic == 799) ichar = 8713;
1947 if (ic == 792) ichar = 8746;
1948 if (ic == 828) ichar = 9127;
1949 if (ic == 765) ichar = 8593; // UPWARDS ARROW
1950 if (ic == 789) ichar = 8853; // CIRCLED PLUS
1951 if (ic == 813) ichar = 8657; // UPWARDS DOUBLE ARROW
1952 if (ic == 773) ichar = 8733; // PROPORTIONAL TO
1953 if (ic == 790) ichar = 8709; // EMPTY SET
1954 if (ic == 810) ichar = 8744;
1955 if (ic == 756) ichar = 8260;
1956 if (ic == 807) ichar = 8231;
1957 if (ic == 808) ichar = 8989; // TOP RIGHT CORNER
1958 if (ic == 814) ichar = 8658; // RIGHTWARDS DOUBLE ARROW
1959 if (ic == 806) ichar = 8730; // SQUARE ROOT
1960 if (ic == 827) ichar = 9123;
1961 if (ic == 829) ichar = 9128;
1962 if (ic == 786) ichar = 8476;
1963 if (ic == 785) ichar = 8465;
1964 if (ic == 787) ichar = 8472;
1965
1966 // Greek characters
1967 if (ic == 918) ichar = 934;
1968 if (ic == 919) ichar = 915;
1969 if (ic == 920) ichar = 919;
1970 if (ic == 923) ichar = 922;
1971 if (ic == 924) ichar = 923;
1972 if (ic == 925) ichar = 924;
1973 if (ic == 926) ichar = 925;
1974 if (ic == 929) ichar = 920;
1975 if (ic == 930) ichar = 929;
1976 if (ic == 936) ichar = 926;
1977 if (ic == 915) ichar = 935;
1978 if (ic == 937) ichar = 936;
1979 if (ic == 935) ichar = 937;
1980 if (ic == 938) ichar = 918;
1981 if (ic == 951) ichar = 947;
1982 if (ic == 798) ichar = 949;
1983 if (ic == 970) ichar = 950;
1984 if (ic == 952) ichar = 951;
1985 if (ic == 961) ichar = 952;
1986 if (ic == 955) ichar = 954;
1987 if (ic == 956) ichar = 955;
1988 if (ic == 957) ichar = 956;
1989 if (ic == 958) ichar = 957;
1990 if (ic == 968) ichar = 958;
1991 if (ic == 934) ichar = 962;
1992 if (ic == 962) ichar = 961;
1993 if (ic == 966) ichar = 969;
1994 if (ic == 950) ichar = 966;
1995 if (ic == 947) ichar = 967;
1996 if (ic == 969) ichar = 968;
1997 if (ic == 967) ichar = 969;
1998 if (ic == 954) ichar = 966;
1999 if (ic == 922) ichar = 952;
2000 if (ic == 753) ichar = 965;
2001 PrintStr(Form("&#%4.4d;",ichar));
2002 } else {
2004 for (Int_t i=0; i<len;i++) {
2005 if (chars[i]!='\n') {
2006 if (chars[i]=='<') {
2007 PrintFast(4,"&lt;");
2008 } else if (chars[i]=='>') {
2009 PrintFast(4,"&gt;");
2010 } else if (chars[i]=='\305') {
2011 PrintFast(7,"&#8491;"); // ANGSTROM SIGN
2012 } else if (chars[i]=='\345') {
2013 PrintFast(6,"&#229;");
2014 } else if (chars[i]=='&') {
2015 PrintFast(5,"&amp;");
2016 } else {
2017 PrintFast(1,&chars[i]);
2018 }
2019 }
2020 }
2021 }
2022
2023 PrintStr("@");
2024 PrintFast(7,"</text>");
2025
2026 if (fTextAngle != 0.) {
2027 PrintStr("@");
2028 PrintFast(4,"</g>");
2029 }
2030}
2031
2032////////////////////////////////////////////////////////////////////////////////
2033/// Write a string of characters in NDC
2034
2036{
2037 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
2038 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
2039 Text(x, y, chars);
2040}
2041
2042////////////////////////////////////////////////////////////////////////////////
2043/// Convert U from NDC coordinate to SVG
2044
2046{
2047 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
2048 return 0.5 + 72*cm/2.54;
2049}
2050
2051////////////////////////////////////////////////////////////////////////////////
2052/// Convert V from NDC coordinate to SVG
2053
2055{
2056 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
2057 return 0.5 + 72*cm/2.54;
2058}
2059
2060////////////////////////////////////////////////////////////////////////////////
2061/// Convert X from world coordinate to SVG
2062
2064{
2065 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
2066 return UtoSVG(u);
2067}
2068
2069////////////////////////////////////////////////////////////////////////////////
2070/// Convert Y from world coordinate to SVG
2071
2073{
2074 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
2075 return fYsizeSVG-VtoSVG(v);
2076}
2077
2078////////////////////////////////////////////////////////////////////////////////
2079/// Begin the Cell Array painting
2080
2082 Double_t)
2083{
2084 Warning("TSVG::CellArrayBegin", "not yet implemented");
2085}
2086
2087////////////////////////////////////////////////////////////////////////////////
2088/// Paint the Cell Array
2089
2091{
2092 Warning("TSVG::CellArrayFill", "not yet implemented");
2093}
2094
2095////////////////////////////////////////////////////////////////////////////////
2096/// End the Cell Array painting
2097
2099{
2100 Warning("TSVG::CellArrayEnd", "not yet implemented");
2101}
2102
2103////////////////////////////////////////////////////////////////////////////////
2104/// Not needed in SVG case
2105
2107{
2108 Warning("TSVG::DrawPS", "not yet implemented");
2109}
#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
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 xy
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:411
const Double_t kEpsilon
Definition TSVG.cxx:37
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:81
#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
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:1057
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
2-D graphics point (world coordinates).
Definition TPoints.h:19
static Int_t fgLineJoin
Appearance of joining lines.
Definition TSVG.h:31
Double_t UtoSVG(Double_t u)
Convert U from NDC coordinate to SVG.
Definition TSVG.cxx:2045
void MovePS(Double_t x, Double_t y)
Move to a new position (ix, iy).
Definition TSVG.cxx:1584
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:294
Double_t fYsizeSVG
Page's Y size in SVG units.
Definition TSVG.h:29
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override
Paint PolyMarker.
Definition TSVG.cxx:593
void Close(Option_t *opt="") override
Close a SVG file.
Definition TSVG.cxx:174
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TSVG.cxx:214
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition TSVG.cxx:450
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:1804
Double_t YtoSVG(Double_t y)
Convert Y from world coordinate to SVG.
Definition TSVG.cxx:2072
void SetFillColor(Color_t cindex=1) override
Set color index for fill areas.
Definition TSVG.cxx:1647
void SetLineWidth(Width_t linewidth=1) override
Set the lines width.
Definition TSVG.cxx:1724
void Initialize()
Initialize the SVG file.
Definition TSVG.cxx:1523
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Not needed in SVG case.
Definition TSVG.cxx:2106
void CellArrayEnd() override
End the Cell Array painting.
Definition TSVG.cxx:2098
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TSVG.cxx:2090
void NewPage() override
Start the SVG page.
Definition TSVG.cxx:1605
void SetColor(Int_t color=1)
Set RGB (without alpha channel) color with its color index.
Definition TSVG.cxx:1756
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:1701
void Off()
Deactivate an already open SVG file.
Definition TSVG.cxx:206
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TSVG.cxx:1637
void SetLineScale(Float_t=3)
Definition TSVG.h:70
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:2081
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TSVG.cxx:1716
void On()
Activate an already open SVG file.
Definition TSVG.cxx:190
TSVG()
Default SVG constructor.
Definition TSVG.cxx:82
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TSVG.cxx:1792
Double_t CMtoSVG(Double_t u)
Definition TSVG.h:43
Double_t XtoSVG(Double_t x)
Convert X from world coordinate to SVG.
Definition TSVG.cxx:2063
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:1732
Float_t fYsize
Page size along Y.
Definition TSVG.h:24
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition TSVG.cxx:525
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition TSVG.cxx:2035
~TSVG() override
Default SVG destructor.
Definition TSVG.cxx:166
void SetColorAlpha(Int_t color=1)
Set RGBa color with its color index.
Definition TSVG.cxx:1740
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TSVG.cxx:1655
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TSVG::fgLineJoin.
Definition TSVG.cxx:1677
void Open(const char *filename, Int_t type=-111) override
Open a SVG file.
Definition TSVG.cxx:116
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:1559
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:2054
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:251
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Definition TMath.h:691
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Definition TMathBase.h:176
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124
TMarker m
Definition textangle.C:8