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