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