Logo ROOT  
Reference Guide
TPDF.cxx
Go to the documentation of this file.
1 // @(#)root/postscript:$Id: TPDF.cxx,v 1.0
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 /** \class TPDF
13 \ingroup PS
14 
15 \brief Interface to PDF.
16 
17 Like PostScript, PDF is a vector graphics output format allowing a very high
18 graphics output quality. The functionalities provided by this class are very
19 similar to those provided by `TPostScript`.
20 
21 Compare to PostScript output, the PDF files are usually smaller because some
22 parts of them can be compressed.
23 
24 PDF also allows to define table of contents. This facility can be used in ROOT.
25 The following example shows how to proceed:
26 ~~~ {.cpp}
27 {
28  TCanvas* canvas = new TCanvas("canvas");
29  TH1F* histo = new TH1F("histo","test 1",10,0.,10.);
30  histo->SetFillColor(2);
31  histo->Fill(2.);
32  histo->Draw();
33  canvas->Print("plots.pdf(","Title:One bin filled");
34  histo->Fill(4.);
35  histo->Draw();
36  canvas->Print("plots.pdf","Title:Two bins filled");
37  histo->Fill(6.);
38  histo->Draw();
39  canvas->Print("plots.pdf","Title:Three bins filled");
40  histo->Fill(8.);
41  histo->Draw();
42  canvas->Print("plots.pdf","Title:Four bins filled");
43  histo->Fill(8.);
44  histo->Draw();
45  canvas->Print("plots.pdf)","Title:The fourth bin content is 2");
46 }
47 ~~~
48 Each character string following the keyword "Title:" makes a new entry in
49 the table of contents.
50 */
51 
52 #ifdef WIN32
53 #pragma optimize("",off)
54 #endif
55 
56 #include <stdlib.h>
57 #include <string.h>
58 #include <ctype.h>
59 
60 #include "Riostream.h"
61 #include "TROOT.h"
62 #include "TDatime.h"
63 #include "TColor.h"
64 #include "TVirtualPad.h"
65 #include "TPoints.h"
66 #include "TPDF.h"
67 #include "TStyle.h"
68 #include "TMath.h"
69 #include "TStorage.h"
70 #include "TText.h"
71 #include "zlib.h"
72 #include "TObjString.h"
73 #include "TClass.h"
74 #include "TObjArray.h"
75 
76 // To scale fonts to the same size as the old TT version
77 const Float_t kScale = 0.93376068;
78 
79 // Objects numbers
80 const Int_t kObjRoot = 1; // Root object
81 const Int_t kObjInfo = 2; // Info object
82 const Int_t kObjOutlines = 3; // Outlines object
83 const Int_t kObjPages = 4; // Pages object (pages index)
84 const Int_t kObjPageResources = 5; // Pages Resources object
85 const Int_t kObjContents = 6; // Table of content
86 const Int_t kObjFont = 7; // First Font object (14 in total)
87 const Int_t kObjColorSpace = 22; // ColorSpace object
88 const Int_t kObjPatternResourses = 23; // Pattern Resources object
89 const Int_t kObjPatternList = 24; // Pattern list object
90 const Int_t kObjTransList = 25; // List of transparencies
91 const Int_t kObjPattern = 26; // First pattern object (25 in total)
92 const Int_t kObjFirstPage = 51; // First page object
93 
94 // Number of fonts
95 const Int_t kNumberOfFonts = 15;
96 
99 
100 ClassImp(TPDF);
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// Default PDF constructor
104 
106 {
107  fStream = 0;
108  fCompress = kFALSE;
110  gVirtualPS = this;
111  fRed = 0.;
112  fGreen = 0.;
113  fBlue = 0.;
114  fAlpha = 1.;
115  fXsize = 0.;
116  fYsize = 0.;
117  fType = 0;
118  fPageFormat = 0;
119  fPageOrientation = 0;
120  fStartStream = 0;
121  fLineScale = 0.;
122  fObjPosSize = 0;
123  fObjPos = 0;
124  fNbObj = 0;
125  fNbPage = 0;
126  fRange = kFALSE;
127  SetTitle("PDF");
128 }
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 /// Initialize the PDF interface
132 ///
133 /// - fname : PDF file name
134 /// - wtype : PDF workstation type. Not used in the PDF driver. But as TPDF
135 /// inherits from TVirtualPS it should be kept. Anyway it is not
136 /// necessary to specify this parameter at creation time because it
137 /// has a default value (which is ignore in the PDF case).
138 
139 TPDF::TPDF(const char *fname, Int_t wtype) : TVirtualPS(fname, wtype)
140 {
141  fStream = 0;
142  fCompress = kFALSE;
144  fRed = 0.;
145  fGreen = 0.;
146  fBlue = 0.;
147  fAlpha = 1.;
148  fXsize = 0.;
149  fYsize = 0.;
150  fType = 0;
151  fPageFormat = 0;
152  fPageOrientation = 0;
153  fStartStream = 0;
154  fLineScale = 0.;
155  fObjPosSize = 0;
156  fNbObj = 0;
157  fNbPage = 0;
158  fRange = kFALSE;
159  SetTitle("PDF");
160  Open(fname, wtype);
161 }
162 
163 ////////////////////////////////////////////////////////////////////////////////
164 /// Default PDF destructor
165 
167 {
168  Close();
169 
170  if (fObjPos) delete [] fObjPos;
171 }
172 
173 ////////////////////////////////////////////////////////////////////////////////
174 /// Begin the Cell Array painting
175 
177  Double_t)
178 {
179  Warning("TPDF::CellArrayBegin", "not yet implemented");
180 }
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Paint the Cell Array
184 
186 {
187  Warning("TPDF::CellArrayFill", "not yet implemented");
188 }
189 
190 ////////////////////////////////////////////////////////////////////////////////
191 /// End the Cell Array painting
192 
194 {
195  Warning("TPDF::CellArrayEnd", "not yet implemented");
196 }
197 
198 ////////////////////////////////////////////////////////////////////////////////
199 /// Close a PDF file
200 
202 {
203  Int_t i;
204 
205  if (!gVirtualPS) return;
206  if (!fStream) return;
207  if (gPad) gPad->Update();
208 
209  // Close the currently opened page
211  PrintStr("endstream@");
212  Int_t streamLength = fNByte-fStartStream-10;
213  PrintStr("endobj@");
215  WriteInteger(streamLength, 0);
216  PrintStr("@");
217  PrintStr("endobj@");
219  PrintStr("<<@");
220  if (!strstr(GetTitle(),"PDF")) {
221  PrintStr("/Title (");
222  PrintStr(GetTitle());
223  PrintStr(")@");
224  } else {
225  PrintStr("/Title (Page");
227  PrintStr(")@");
228  }
229  PrintStr("/Dest [");
231  PrintStr(" 0 R /XYZ null null 0]@");
232  PrintStr("/Parent");
234  PrintStr(" 0 R");
235  PrintStr("@");
236  if (fNbPage > 1) {
237  PrintStr("/Prev");
239  PrintStr(" 0 R");
240  PrintStr("@");
241  }
242  PrintStr(">>@");
243 
245  PrintStr("<<@");
246  PrintStr("/Type /Outlines@");
247  PrintStr("/Count");
249  PrintStr("@");
250  PrintStr("/First");
252  PrintStr(" 0 R");
253  PrintStr("@");
254  PrintStr("/Last");
256  PrintStr(" 0 R");
257  PrintStr("@");
258  PrintStr(">>@");
259  PrintStr("endobj@");
260 
262  PrintStr("<<@");
263  PrintStr("/Title (Contents)@");
264  PrintStr("/Dest [");
266  PrintStr(" 0 R /XYZ null null 0]@");
267  PrintStr("/Count");
269  PrintStr("@");
270  PrintStr("/Parent");
272  PrintStr(" 0 R");
273  PrintStr("@");
274  PrintStr("/First");
276  PrintStr(" 0 R");
277  PrintStr("@");
278  PrintStr("/Last");
280  PrintStr(" 0 R");
281  PrintStr("@");
282  PrintStr(">>@");
283 
284  // List of all the pages
286  PrintStr("<<@");
287  PrintStr("/Type /Pages@");
288  PrintStr("/Count");
290  PrintStr("@");
291  PrintStr("/Kids [");
292  for (i=1; i<=fNbPage; i++) {
293  WriteInteger(4*(i-1)+kObjFirstPage);
294  PrintStr(" 0 R");
295  }
296  PrintStr(" ]");
297  PrintStr("@");
298  PrintStr(">>@");
299  PrintStr("endobj@");
300 
302  PrintStr("<<@");
303  for (i=0; i<(int)fAlphas.size(); i++) {
304  PrintStr(
305  Form("/ca%3.2f << /Type /ExtGState /ca %3.2f >> /CA%3.2f << /Type /ExtGState /CA %3.2f >>@",
306  fAlphas[i],fAlphas[i],fAlphas[i],fAlphas[i]));
307  }
308  PrintStr(">>@");
309  PrintStr("endobj@");
310  if (fAlphas.size()) fAlphas.clear();
311 
312  // Cross-Reference Table
313  Int_t refInd = fNByte;
314  PrintStr("xref@");
315  PrintStr("0");
316  WriteInteger(fNbObj+1);
317  PrintStr("@");
318  PrintStr("0000000000 65535 f @");
319  char str[21];
320  for (i=0; i<fNbObj; i++) {
321  snprintf(str,21,"%10.10d 00000 n @",fObjPos[i]);
322  PrintStr(str);
323  }
324 
325  // Trailer
326  PrintStr("trailer@");
327  PrintStr("<<@");
328  PrintStr("/Size");
329  WriteInteger(fNbObj+1);
330  PrintStr("@");
331  PrintStr("/Root");
333  PrintStr(" 0 R");
334  PrintStr("@");
335  PrintStr("/Info");
337  PrintStr(" 0 R@");
338  PrintStr(">>@");
339  PrintStr("startxref@");
340  WriteInteger(refInd, 0);
341  PrintStr("@");
342  PrintStr("%%EOF@");
343 
344  // Close file stream
345  if (fStream) { fStream->close(); delete fStream; fStream = 0;}
346 
347  gVirtualPS = 0;
348 }
349 
350 ////////////////////////////////////////////////////////////////////////////////
351 /// Draw a Box
352 
354 {
355  static Double_t x[4], y[4];
356  Double_t ix1 = XtoPDF(x1);
357  Double_t ix2 = XtoPDF(x2);
358  Double_t iy1 = YtoPDF(y1);
359  Double_t iy2 = YtoPDF(y2);
360  Int_t fillis = fFillStyle/1000;
361  Int_t fillsi = fFillStyle%1000;
362 
363  if (fillis == 3 || fillis == 2) {
364  if (fillsi > 99) {
365  x[0] = x1; y[0] = y1;
366  x[1] = x2; y[1] = y1;
367  x[2] = x2; y[2] = y2;
368  x[3] = x1; y[3] = y2;
369  return;
370  }
371  if (fillsi > 0 && fillsi < 26) {
372  x[0] = x1; y[0] = y1;
373  x[1] = x2; y[1] = y1;
374  x[2] = x2; y[2] = y2;
375  x[3] = x1; y[3] = y2;
376  DrawPS(-4, &x[0], &y[0]);
377  }
378  if (fillsi == -3) {
379  SetColor(5);
380  if (fAlpha == 1) PrintFast(15," q 0.4 w [] 0 d");
381  WriteReal(ix1);
382  WriteReal(iy1);
383  WriteReal(ix2 - ix1);
384  WriteReal(iy2 - iy1);
385  if (fAlpha == 1) PrintFast(8," re b* Q");
386  else PrintFast(6," re f*");
387  }
388  }
389  if (fillis == 1) {
391  if (fAlpha == 1) PrintFast(15," q 0.4 w [] 0 d");
392  WriteReal(ix1);
393  WriteReal(iy1);
394  WriteReal(ix2 - ix1);
395  WriteReal(iy2 - iy1);
396  if (fAlpha == 1) PrintFast(8," re b* Q");
397  else PrintFast(6," re f*");
398  }
399  if (fillis == 0) {
400  if (fLineWidth<=0) return;
402  WriteReal(ix1);
403  WriteReal(iy1);
404  WriteReal(ix2 - ix1);
405  WriteReal(iy2 - iy1);
406  PrintFast(5," re S");
407  }
408 }
409 
410 ////////////////////////////////////////////////////////////////////////////////
411 /// Draw a Frame around a box
412 ///
413 /// - mode = -1 box looks as it is behind the screen
414 /// - mode = 1 box looks as it is in front of the screen
415 /// - border is the border size in already precomputed PDF units
416 /// - dark is the color for the dark part of the frame
417 /// - light is the color for the light part of the frame
418 
420  Int_t mode, Int_t border, Int_t dark, Int_t light)
421 {
422  static Double_t xps[7], yps[7];
423  Int_t i;
424 
425  // Draw top&left part of the box
426  if (mode == -1) SetColor(dark);
427  else SetColor(light);
428  xps[0] = XtoPDF(xl); yps[0] = YtoPDF(yl);
429  xps[1] = xps[0] + border; yps[1] = yps[0] + border;
430  xps[2] = xps[1]; yps[2] = YtoPDF(yt) - border;
431  xps[3] = XtoPDF(xt) - border; yps[3] = yps[2];
432  xps[4] = XtoPDF(xt); yps[4] = YtoPDF(yt);
433  xps[5] = xps[0]; yps[5] = yps[4];
434  xps[6] = xps[0]; yps[6] = yps[0];
435 
436  MoveTo(xps[0], yps[0]);
437  for (i=1;i<7;i++) LineTo(xps[i], yps[i]);
438  PrintFast(3," f*");
439 
440  // Draw bottom&right part of the box
441  if (mode == -1) SetColor(light);
442  else SetColor(dark);
443  xps[0] = XtoPDF(xl); yps[0] = YtoPDF(yl);
444  xps[1] = xps[0] + border; yps[1] = yps[0] + border;
445  xps[2] = XtoPDF(xt) - border; yps[2] = yps[1];
446  xps[3] = xps[2]; yps[3] = YtoPDF(yt) - border;
447  xps[4] = XtoPDF(xt); yps[4] = YtoPDF(yt);
448  xps[5] = xps[4]; yps[5] = yps[0];
449  xps[6] = xps[0]; yps[6] = yps[0];
450 
451  MoveTo(xps[0], yps[0]);
452  for (i=1;i<7;i++) LineTo(xps[i], yps[i]);
453  PrintFast(3," f*");
454 }
455 
456 ////////////////////////////////////////////////////////////////////////////////
457 /// Draw Fill area with hatch styles
458 
460 {
461  Warning("DrawHatch", "hatch fill style not yet implemented");
462 }
463 
464 ////////////////////////////////////////////////////////////////////////////////
465 /// Draw Fill area with hatch styles
466 
468 {
469  Warning("DrawHatch", "hatch fill style not yet implemented");
470 }
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// Draw a PolyLine
474 ///
475 /// Draw a polyline through the points xy.
476 ///
477 /// - If NN=1 moves only to point x,y.
478 /// - If NN=0 the x,y are written in the PDF file
479 /// according to the current transformation.
480 /// - If NN>0 the line is clipped as a line.
481 /// - If NN<0 the line is clipped as a fill area.
482 
484 {
485  Int_t n;
486 
487  Style_t linestylesav = fLineStyle;
488  Width_t linewidthsav = fLineWidth;
489 
490  if (nn > 0) {
491  if (fLineWidth<=0) return;
492  n = nn;
496  } else {
497  n = -nn;
498  SetLineStyle(1);
499  SetLineWidth(1);
501  }
502 
503  WriteReal(XtoPDF(xy[0].GetX()));
504  WriteReal(YtoPDF(xy[0].GetY()));
505  if (n <= 1) {
506  if (n == 0) return;
507  PrintFast(2," m");
508  return;
509  }
510 
511  PrintFast(2," m");
512 
513  for (Int_t i=1;i<n;i++) LineTo(XtoPDF(xy[i].GetX()), YtoPDF(xy[i].GetY()));
514 
515  if (nn > 0) {
516  if (xy[0].GetX() == xy[n-1].GetX() && xy[0].GetY() == xy[n-1].GetY()) PrintFast(3," cl");
517  PrintFast(2," S");
518  } else {
519  PrintFast(3," f*");
520  }
521 
522  SetLineStyle(linestylesav);
523  SetLineWidth(linewidthsav);
524 }
525 
526 ////////////////////////////////////////////////////////////////////////////////
527 /// Draw a PolyLine in NDC space
528 ///
529 /// Draw a polyline through the points xy.
530 ///
531 /// - If NN=1 moves only to point x,y.
532 /// - If NN=0 the x,y are written in the PDF file
533 /// according to the current transformation.
534 /// - If NN>0 the line is clipped as a line.
535 /// - If NN<0 the line is clipped as a fill area.
536 
538 {
539  Int_t n;
540 
541  Style_t linestylesav = fLineStyle;
542  Width_t linewidthsav = fLineWidth;
543 
544  if (nn > 0) {
545  if (fLineWidth<=0) return;
546  n = nn;
550  } else {
551  n = -nn;
552  SetLineStyle(1);
553  SetLineWidth(1);
555  }
556 
557  WriteReal(UtoPDF(xy[0].GetX()));
558  WriteReal(VtoPDF(xy[0].GetY()));
559  if (n <= 1) {
560  if (n == 0) return;
561  PrintFast(2," m");
562  return;
563  }
564 
565  PrintFast(2," m");
566 
567  for (Int_t i=1;i<n;i++) LineTo(UtoPDF(xy[i].GetX()), VtoPDF(xy[i].GetY()));
568 
569  if (nn > 0) {
570  if (xy[0].GetX() == xy[n-1].GetX() && xy[0].GetY() == xy[n-1].GetY()) PrintFast(3," cl");
571  PrintFast(2," S");
572  } else {
573  PrintFast(3," f*");
574  }
575 
576  SetLineStyle(linestylesav);
577  SetLineWidth(linewidthsav);
578 }
579 
580 ////////////////////////////////////////////////////////////////////////////////
581 /// Draw markers at the n WC points xw, yw
582 
584 {
586  Style_t linestylesav = fLineStyle;
587  Width_t linewidthsav = fLineWidth;
588  SetLineStyle(1);
592 
593  if (ms == 4)
594  ms = 24;
595  else if (ms >= 6 && ms <= 8)
596  ms = 20;
597  else if (ms >= 9 && ms <= 19)
598  ms = 1;
599 
600  // Define the marker size
602  if (fMarkerStyle == 1 || (fMarkerStyle >= 9 && fMarkerStyle <= 19)) {
603  msize = 1.;
604  } else if (fMarkerStyle == 6) {
605  msize = 1.;
606  } else if (fMarkerStyle == 7) {
607  msize = 1.5;
608  } else {
609  const Int_t kBASEMARKER = 8;
610  Float_t sbase = msize*kBASEMARKER;
611  Float_t s2x = sbase / Float_t(gPad->GetWw() * gPad->GetAbsWNDC());
612  msize = this->UtoPDF(s2x) - this->UtoPDF(0);
613  }
614 
615  Double_t m = msize;
616  Double_t m2 = m/2;
617  Double_t m3 = m/3;
618  Double_t m4 = m2*1.333333333333;
619  Double_t m6 = m/6;
620  Double_t m0 = m/10.;
621  Double_t m8 = m/4;
622  Double_t m9 = m/8;
623 
624  // Draw the marker according to the type
625  Double_t ix,iy;
626  for (Int_t i=0;i<n;i++) {
627  ix = XtoPDF(xw[i]);
628  iy = YtoPDF(yw[i]);
629  // Dot (.)
630  if (ms == 1) {
631  MoveTo(ix-1, iy);
632  LineTo(ix , iy);
633  // Plus (+)
634  } else if (ms == 2) {
635  MoveTo(ix-m2, iy);
636  LineTo(ix+m2, iy);
637  MoveTo(ix , iy-m2);
638  LineTo(ix , iy+m2);
639  // X shape (X)
640  } else if (ms == 5) {
641  MoveTo(ix-m2*0.707, iy-m2*0.707);
642  LineTo(ix+m2*0.707, iy+m2*0.707);
643  MoveTo(ix-m2*0.707, iy+m2*0.707);
644  LineTo(ix+m2*0.707, iy-m2*0.707);
645  // Asterisk shape (*)
646  } else if (ms == 3 || ms == 31) {
647  MoveTo(ix-m2, iy);
648  LineTo(ix+m2, iy);
649  MoveTo(ix , iy-m2);
650  LineTo(ix , iy+m2);
651  MoveTo(ix-m2*0.707, iy-m2*0.707);
652  LineTo(ix+m2*0.707, iy+m2*0.707);
653  MoveTo(ix-m2*0.707, iy+m2*0.707);
654  LineTo(ix+m2*0.707, iy-m2*0.707);
655  // Circle
656  } else if (ms == 24 || ms == 20) {
657  MoveTo(ix-m2, iy);
658  WriteReal(ix-m2); WriteReal(iy+m4);
659  WriteReal(ix+m2); WriteReal(iy+m4);
660  WriteReal(ix+m2); WriteReal(iy) ; PrintFast(2," c");
661  WriteReal(ix+m2); WriteReal(iy-m4);
662  WriteReal(ix-m2); WriteReal(iy-m4);
663  WriteReal(ix-m2); WriteReal(iy) ; PrintFast(4," c h");
664  // Square
665  } else if (ms == 25 || ms == 21) {
666  WriteReal(ix-m2); WriteReal(iy-m2);
667  WriteReal(m) ; WriteReal(m) ; PrintFast(3," re");
668  // Down triangle
669  } else if (ms == 23 || ms == 32) {
670  MoveTo(ix , iy-m2);
671  LineTo(ix+m2, iy+m2);
672  LineTo(ix-m2, iy+m2);
673  PrintFast(2," h");
674  // Up triangle
675  } else if (ms == 26 || ms == 22) {
676  MoveTo(ix-m2, iy-m2);
677  LineTo(ix+m2, iy-m2);
678  LineTo(ix , iy+m2);
679  PrintFast(2," h");
680  } else if (ms == 27 || ms == 33) {
681  MoveTo(ix , iy-m2);
682  LineTo(ix+m3, iy);
683  LineTo(ix , iy+m2);
684  LineTo(ix-m3, iy) ;
685  PrintFast(2," h");
686  } else if (ms == 28 || ms == 34) {
687  MoveTo(ix-m6, iy-m6);
688  LineTo(ix-m6, iy-m2);
689  LineTo(ix+m6, iy-m2);
690  LineTo(ix+m6, iy-m6);
691  LineTo(ix+m2, iy-m6);
692  LineTo(ix+m2, iy+m6);
693  LineTo(ix+m6, iy+m6);
694  LineTo(ix+m6, iy+m2);
695  LineTo(ix-m6, iy+m2);
696  LineTo(ix-m6, iy+m6);
697  LineTo(ix-m2, iy+m6);
698  LineTo(ix-m2, iy-m6);
699  PrintFast(2," h");
700  } else if (ms == 29 || ms == 30) {
701  MoveTo(ix , iy+m2);
702  LineTo(ix+0.112255*m, iy+0.15451*m);
703  LineTo(ix+0.47552*m , iy+0.15451*m);
704  LineTo(ix+0.181635*m, iy-0.05902*m);
705  LineTo(ix+0.29389*m , iy-0.40451*m);
706  LineTo(ix , iy-0.19098*m);
707  LineTo(ix-0.29389*m , iy-0.40451*m);
708  LineTo(ix-0.181635*m, iy-0.05902*m);
709  LineTo(ix-0.47552*m , iy+0.15451*m);
710  LineTo(ix-0.112255*m, iy+0.15451*m);
711  PrintFast(2," h");
712  } else if (ms == 35 ) {
713  // diamond with cross
714  MoveTo(ix-m2, iy );
715  LineTo(ix , iy-m2);
716  LineTo(ix+m2, iy );
717  LineTo(ix , iy+m2);
718  LineTo(ix-m2, iy );
719  LineTo(ix+m2, iy );
720  LineTo(ix , iy+m2);
721  LineTo(ix , iy-m2);
722  PrintFast(2," h");
723  } else if (ms == 36 ) {
724  // square with diagonal cross
725  MoveTo(ix-m2, iy-m2);
726  LineTo(ix+m2, iy-m2);
727  LineTo(ix+m2, iy+m2);
728  LineTo(ix-m2, iy+m2);
729  LineTo(ix-m2, iy-m2);
730  LineTo(ix+m2, iy+m2);
731  LineTo(ix-m2, iy+m2);
732  LineTo(ix+m2, iy-m2);
733  PrintFast(2," h");
734  } else if (ms == 37 || ms == 39 ) {
735  // square with cross
736  MoveTo(ix , iy );
737  LineTo(ix-m8, iy+m2);
738  LineTo(ix-m2, iy );
739  LineTo(ix , iy );
740  LineTo(ix-m8, iy-m2);
741  LineTo(ix+m8, iy-m2);
742  LineTo(ix , iy );
743  LineTo(ix+m2, iy );
744  LineTo(ix+m8, iy+m2);
745  LineTo(ix , iy );
746  PrintFast(2," h");
747  } else if (ms == 38 ) {
748  // + shaped marker with octagon
749  MoveTo(ix-m2, iy );
750  LineTo(ix-m2, iy-m8);
751  LineTo(ix-m8, iy-m2);
752  LineTo(ix+m8, iy-m2);
753  LineTo(ix+m2, iy-m8);
754  LineTo(ix+m2, iy+m8);
755  LineTo(ix+m8, iy+m2);
756  LineTo(ix-m8, iy+m2);
757  LineTo(ix-m2, iy+m8);
758  LineTo(ix-m2, iy );
759  LineTo(ix+m2, iy );
760  LineTo(ix , iy );
761  LineTo(ix , iy-m2);
762  LineTo(ix , iy+m2);
763  LineTo(ix , iy);
764  PrintFast(2," h");
765  } else if (ms == 40 || ms == 41 ) {
766  // four triangles X
767  MoveTo(ix , iy );
768  LineTo(ix+m8, iy+m2);
769  LineTo(ix+m2, iy+m8);
770  LineTo(ix , iy );
771  LineTo(ix+m2, iy-m8);
772  LineTo(ix+m8, iy-m2);
773  LineTo(ix , iy );
774  LineTo(ix-m8, iy-m2);
775  LineTo(ix-m2, iy-m8);
776  LineTo(ix , iy );
777  LineTo(ix-m2, iy+m8);
778  LineTo(ix-m8, iy+m2);
779  LineTo(ix , iy );
780  PrintFast(2," h");
781  } else if (ms == 42 || ms == 43 ) {
782  // double diamonds
783  MoveTo(ix , iy+m2);
784  LineTo(ix-m9, iy+m9);
785  LineTo(ix-m2, iy );
786  LineTo(ix-m9, iy-m9);
787  LineTo(ix , iy-m2);
788  LineTo(ix+m9, iy-m9);
789  LineTo(ix+m2, iy );
790  LineTo(ix+m9, iy+m9);
791  LineTo(ix , iy+m2);
792  PrintFast(2," h");
793  } else if (ms == 44 ) {
794  // open four triangles plus
795  MoveTo(ix , iy );
796  LineTo(ix+m8, iy+m2);
797  LineTo(ix-m8, iy+m2);
798  LineTo(ix+m8, iy-m2);
799  LineTo(ix-m8, iy-m2);
800  LineTo(ix , iy );
801  LineTo(ix+m2, iy+m8);
802  LineTo(ix+m2, iy-m8);
803  LineTo(ix-m2, iy+m8);
804  LineTo(ix-m2, iy-m8);
805  LineTo(ix , iy );
806  PrintFast(2," h");
807  } else if (ms == 45 ) {
808  // filled four triangles plus
809  MoveTo(ix+m0, iy+m0);
810  LineTo(ix+m8, iy+m2);
811  LineTo(ix-m8, iy+m2);
812  LineTo(ix-m0, iy+m0);
813  LineTo(ix-m2, iy+m8);
814  LineTo(ix-m2, iy-m8);
815  LineTo(ix-m0, iy-m0);
816  LineTo(ix-m8, iy-m2);
817  LineTo(ix+m8, iy-m2);
818  LineTo(ix+m0, iy-m0);
819  LineTo(ix+m2, iy-m8);
820  LineTo(ix+m2, iy+m8);
821  LineTo(ix+m0, iy+m0);
822  PrintFast(2," h");
823  } else if (ms == 46 || ms == 47 ) {
824  // four triangles X
825  MoveTo(ix , iy+m8);
826  LineTo(ix-m8, iy+m2);
827  LineTo(ix-m2, iy+m8);
828  LineTo(ix-m8, iy );
829  LineTo(ix-m2, iy-m8);
830  LineTo(ix-m8, iy-m2);
831  LineTo(ix , iy-m8);
832  LineTo(ix+m8, iy-m2);
833  LineTo(ix+m2, iy-m8);
834  LineTo(ix+m8, iy );
835  LineTo(ix+m2, iy+m8);
836  LineTo(ix+m8, iy+m2);
837  LineTo(ix , iy+m8);
838  PrintFast(2," h");
839  } else if (ms == 48 ) {
840  // four filled squares X
841  MoveTo(ix , iy+m8*1.01);
842  LineTo(ix-m8, iy+m2);
843  LineTo(ix-m2, iy+m8);
844  LineTo(ix-m8, iy );
845  LineTo(ix-m2, iy-m8);
846  LineTo(ix-m8, iy-m2);
847  LineTo(ix , iy-m8);
848  LineTo(ix+m8, iy-m2);
849  LineTo(ix+m2, iy-m8);
850  LineTo(ix+m8, iy );
851  LineTo(ix+m2, iy+m8);
852  LineTo(ix+m8, iy+m2);
853  LineTo(ix , iy+m8*0.99);
854  LineTo(ix+m8*0.99, iy );
855  LineTo(ix , iy-m8*0.99);
856  LineTo(ix-m8*0.99, iy );
857  LineTo(ix , iy+m8*0.99);
858  PrintFast(2," h");
859  } else if (ms == 49 ) {
860  // four filled squares plus
861  MoveTo(ix-m6, iy-m6*1.01);
862  LineTo(ix-m6, iy-m2);
863  LineTo(ix+m6, iy-m2);
864  LineTo(ix+m6, iy-m6);
865  LineTo(ix+m2, iy-m6);
866  LineTo(ix+m2, iy+m6);
867  LineTo(ix+m6, iy+m6);
868  LineTo(ix+m6, iy+m2);
869  LineTo(ix-m6, iy+m2);
870  LineTo(ix-m6, iy+m6);
871  LineTo(ix-m2, iy+m6);
872  LineTo(ix-m2, iy-m6);
873  LineTo(ix-m6, iy-m6*0.99);
874  LineTo(ix-m6, iy+m6);
875  LineTo(ix+m6, iy+m6);
876  LineTo(ix+m6, iy-m6);
877  PrintFast(2," h");
878  } else {
879  MoveTo(ix-m6, iy-m6);
880  LineTo(ix-m6, iy-m2);
881  }
882 
883  if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34 ||
884  ms == 39 || ms == 41 || ms == 43 || ms == 45 ||
885  ms == 47 || ms == 48 || ms == 49) {
886  PrintFast(2," f");
887  } else {
888  PrintFast(2," S");
889  }
890  }
891 
892  SetLineStyle(linestylesav);
893  SetLineWidth(linewidthsav);
894 }
895 
896 ////////////////////////////////////////////////////////////////////////////////
897 /// Draw markers at the n WC points xw, yw
898 
900 {
902  Style_t linestylesav = fLineStyle;
903  Width_t linewidthsav = fLineWidth;
904  SetLineStyle(1);
908 
909  if (ms == 4)
910  ms = 24;
911  else if (ms >= 6 && ms <= 8)
912  ms = 20;
913  else if (ms >= 9 && ms <= 19)
914  ms = 1;
915 
916  // Define the marker size
918  if (fMarkerStyle == 1 || (fMarkerStyle >= 9 && fMarkerStyle <= 19)) {
919  msize = 1.;
920  } else if (fMarkerStyle == 6) {
921  msize = 1.5;
922  } else if (fMarkerStyle == 7) {
923  msize = 3.;
924  } else {
925  const Int_t kBASEMARKER = 8;
926  Float_t sbase = msize*kBASEMARKER;
927  Float_t s2x = sbase / Float_t(gPad->GetWw() * gPad->GetAbsWNDC());
928  msize = this->UtoPDF(s2x) - this->UtoPDF(0);
929  }
930 
931  Double_t m = msize;
932  Double_t m2 = m/2;
933  Double_t m3 = m/3;
934  Double_t m4 = m2*1.333333333333;
935  Double_t m6 = m/6;
936  Double_t m8 = m/4;
937  Double_t m9 = m/8;
938 
939  // Draw the marker according to the type
940  Double_t ix,iy;
941  for (Int_t i=0;i<n;i++) {
942  ix = XtoPDF(xw[i]);
943  iy = YtoPDF(yw[i]);
944  // Dot (.)
945  if (ms == 1) {
946  MoveTo(ix-1, iy);
947  LineTo(ix , iy);
948  // Plus (+)
949  } else if (ms == 2) {
950  MoveTo(ix-m2, iy);
951  LineTo(ix+m2, iy);
952  MoveTo(ix , iy-m2);
953  LineTo(ix , iy+m2);
954  // X shape (X)
955  } else if (ms == 5) {
956  MoveTo(ix-m2*0.707, iy-m2*0.707);
957  LineTo(ix+m2*0.707, iy+m2*0.707);
958  MoveTo(ix-m2*0.707, iy+m2*0.707);
959  LineTo(ix+m2*0.707, iy-m2*0.707);
960  // Asterisk shape (*)
961  } else if (ms == 3 || ms == 31) {
962  MoveTo(ix-m2, iy);
963  LineTo(ix+m2, iy);
964  MoveTo(ix , iy-m2);
965  LineTo(ix , iy+m2);
966  MoveTo(ix-m2*0.707, iy-m2*0.707);
967  LineTo(ix+m2*0.707, iy+m2*0.707);
968  MoveTo(ix-m2*0.707, iy+m2*0.707);
969  LineTo(ix+m2*0.707, iy-m2*0.707);
970  // Circle
971  } else if (ms == 24 || ms == 20) {
972  MoveTo(ix-m2, iy);
973  WriteReal(ix-m2); WriteReal(iy+m4);
974  WriteReal(ix+m2); WriteReal(iy+m4);
975  WriteReal(ix+m2); WriteReal(iy) ; PrintFast(2," c");
976  WriteReal(ix+m2); WriteReal(iy-m4);
977  WriteReal(ix-m2); WriteReal(iy-m4);
978  WriteReal(ix-m2); WriteReal(iy) ; PrintFast(4," c h");
979  // Square
980  } else if (ms == 25 || ms == 21) {
981  WriteReal(ix-m2); WriteReal(iy-m2);
982  WriteReal(m) ; WriteReal(m) ; PrintFast(3," re");
983  // Down triangle
984  } else if (ms == 23 || ms == 32) {
985  MoveTo(ix , iy-m2);
986  LineTo(ix+m2, iy+m2);
987  LineTo(ix-m2, iy+m2);
988  PrintFast(2," h");
989  // Up triangle
990  } else if (ms == 26 || ms == 22) {
991  MoveTo(ix-m2, iy-m2);
992  LineTo(ix+m2, iy-m2);
993  LineTo(ix , iy+m2);
994  PrintFast(2," h");
995  } else if (ms == 27 || ms == 33) {
996  MoveTo(ix , iy-m2);
997  LineTo(ix+m3, iy);
998  LineTo(ix , iy+m2);
999  LineTo(ix-m3, iy) ;
1000  PrintFast(2," h");
1001  } else if (ms == 28 || ms == 34) {
1002  MoveTo(ix-m6, iy-m6);
1003  LineTo(ix-m6, iy-m2);
1004  LineTo(ix+m6, iy-m2);
1005  LineTo(ix+m6, iy-m6);
1006  LineTo(ix+m2, iy-m6);
1007  LineTo(ix+m2, iy+m6);
1008  LineTo(ix+m6, iy+m6);
1009  LineTo(ix+m6, iy+m2);
1010  LineTo(ix-m6, iy+m2);
1011  LineTo(ix-m6, iy+m6);
1012  LineTo(ix-m2, iy+m6);
1013  LineTo(ix-m2, iy-m6);
1014  PrintFast(2," h");
1015  } else if (ms == 29 || ms == 30) {
1016  MoveTo(ix , iy-m2);
1017  LineTo(ix-0.112255*m, iy-0.15451*m);
1018  LineTo(ix-0.47552*m , iy-0.15451*m);
1019  LineTo(ix-0.181635*m, iy+0.05902*m);
1020  LineTo(ix-0.29389*m , iy+0.40451*m);
1021  LineTo(ix , iy+0.19098*m);
1022  LineTo(ix+0.29389*m , iy+0.40451*m);
1023  LineTo(ix+0.181635*m, iy+0.05902*m);
1024  LineTo(ix+0.47552*m , iy-0.15451*m);
1025  LineTo(ix+0.112255*m, iy-0.15451*m);
1026  PrintFast(2," h");
1027  } else if (ms == 35 ) {
1028  MoveTo(ix-m2, iy );
1029  LineTo(ix , iy-m2);
1030  LineTo(ix+m2, iy );
1031  LineTo(ix , iy+m2);
1032  LineTo(ix-m2, iy );
1033  LineTo(ix+m2, iy );
1034  LineTo(ix , iy+m2);
1035  LineTo(ix , iy-m2);
1036  PrintFast(2," h");
1037  } else if (ms == 36 ) {
1038  MoveTo(ix-m2, iy-m2);
1039  LineTo(ix+m2, iy-m2);
1040  LineTo(ix+m2, iy+m2);
1041  LineTo(ix-m2, iy+m2);
1042  LineTo(ix-m2, iy-m2);
1043  LineTo(ix+m2, iy+m2);
1044  LineTo(ix-m2, iy+m2);
1045  LineTo(ix+m2, iy-m2);
1046  PrintFast(2," h");
1047  } else if (ms == 37 || ms == 39 ) {
1048  MoveTo(ix , iy );
1049  LineTo(ix-m8, iy+m2);
1050  LineTo(ix-m2, iy );
1051  LineTo(ix , iy );
1052  LineTo(ix-m8, iy-m2);
1053  LineTo(ix+m8, iy-m2);
1054  LineTo(ix , iy );
1055  LineTo(ix+m2, iy );
1056  LineTo(ix+m8, iy+m2);
1057  LineTo(ix , iy );
1058  PrintFast(2," h");
1059  } else if (ms == 38 ) {
1060  MoveTo(ix-m2, iy );
1061  LineTo(ix-m2, iy-m8);
1062  LineTo(ix-m8, iy-m2);
1063  LineTo(ix+m8, iy-m2);
1064  LineTo(ix+m2, iy-m8);
1065  LineTo(ix+m2, iy+m8);
1066  LineTo(ix+m8, iy+m2);
1067  LineTo(ix-m8, iy+m2);
1068  LineTo(ix-m2, iy+m8);
1069  LineTo(ix-m2, iy );
1070  LineTo(ix+m2, iy );
1071  LineTo(ix , iy );
1072  LineTo(ix , iy-m2);
1073  LineTo(ix , iy+m2);
1074  LineTo(ix , iy );
1075  PrintFast(2," h");
1076  } else if (ms == 40 || ms == 41 ) {
1077  MoveTo(ix , iy );
1078  LineTo(ix+m8, iy+m2);
1079  LineTo(ix+m2, iy+m8);
1080  LineTo(ix , iy );
1081  LineTo(ix+m2, iy-m8);
1082  LineTo(ix+m8, iy-m2);
1083  LineTo(ix , iy );
1084  LineTo(ix-m8, iy-m2);
1085  LineTo(ix-m2, iy-m8);
1086  LineTo(ix , iy );
1087  LineTo(ix-m2, iy+m8);
1088  LineTo(ix-m8, iy+m2);
1089  LineTo(ix , iy );
1090  PrintFast(2," h");
1091  } else if (ms == 42 || ms == 43 ) {
1092  MoveTo(ix , iy+m2);
1093  LineTo(ix-m9, iy+m9);
1094  LineTo(ix-m2, iy );
1095  LineTo(ix-m9, iy-m9);
1096  LineTo(ix , iy-m2);
1097  LineTo(ix+m9, iy-m9);
1098  LineTo(ix+m2, iy );
1099  LineTo(ix+m9, iy+m9);
1100  LineTo(ix , iy+m2);
1101  PrintFast(2," h");
1102  } else if (ms == 44 ) {
1103  MoveTo(ix , iy );
1104  LineTo(ix+m8, iy+m2);
1105  LineTo(ix-m8, iy+m2);
1106  LineTo(ix+m8, iy-m2);
1107  LineTo(ix-m8, iy-m2);
1108  LineTo(ix , iy );
1109  LineTo(ix+m2, iy+m8);
1110  LineTo(ix+m2, iy-m8);
1111  LineTo(ix-m2, iy+m8);
1112  LineTo(ix-m2, iy-m8);
1113  LineTo(ix , iy );
1114  PrintFast(2," h");
1115  } else if (ms == 45 ) {
1116  MoveTo(ix+m6/2., iy+m6/2.);
1117  LineTo(ix+m8, iy+m2);
1118  LineTo(ix-m8, iy+m2);
1119  LineTo(ix-m6/2., iy+m6/2.);
1120  LineTo(ix-m2, iy+m8);
1121  LineTo(ix-m2, iy-m8);
1122  LineTo(ix-m6/2., iy-m6/2.);
1123  LineTo(ix-m8, iy-m2);
1124  LineTo(ix+m8, iy-m2);
1125  LineTo(ix+m6/2., iy-m6/2.);
1126  LineTo(ix+m2, iy-m8);
1127  LineTo(ix+m2, iy+m8);
1128  LineTo(ix+m6/2., iy+m6/2.);
1129  PrintFast(2," h");
1130  } else if (ms == 46 || ms == 47 ) {
1131  MoveTo(ix , iy+m8);
1132  LineTo(ix-m8, iy+m2);
1133  LineTo(ix-m2, iy+m8);
1134  LineTo(ix-m8, iy );
1135  LineTo(ix-m2, iy-m8);
1136  LineTo(ix-m8, iy-m2);
1137  LineTo(ix , iy-m8);
1138  LineTo(ix+m8, iy-m2);
1139  LineTo(ix+m2, iy-m8);
1140  LineTo(ix+m8, iy );
1141  LineTo(ix+m2, iy+m8);
1142  LineTo(ix+m8, iy+m2);
1143  LineTo(ix , iy+m8);
1144  PrintFast(2," h");
1145  } else if (ms == 48 ) {
1146  MoveTo(ix , iy+m8*1.005);
1147  LineTo(ix-m8, iy+m2);
1148  LineTo(ix-m2, iy+m8);
1149  LineTo(ix-m8, iy );
1150  LineTo(ix-m2, iy-m8);
1151  LineTo(ix-m8, iy-m2);
1152  LineTo(ix , iy-m8);
1153  LineTo(ix+m8, iy-m2);
1154  LineTo(ix+m2, iy-m8);
1155  LineTo(ix+m8, iy );
1156  LineTo(ix+m2, iy+m8);
1157  LineTo(ix+m8, iy+m2);
1158  LineTo(ix , iy+m8*0.995);
1159  LineTo(ix+m8*0.995, iy );
1160  LineTo(ix , iy-m8*0.995);
1161  LineTo(ix-m8*0.995, iy );
1162  LineTo(ix , iy+m8*0.995);
1163  PrintFast(2," h");
1164  } else if (ms == 49 ) {
1165  MoveTo(ix-m6, iy-m6*1.01);
1166  LineTo(ix-m6, iy-m2);
1167  LineTo(ix+m6, iy-m2);
1168  LineTo(ix+m6, iy-m6);
1169  LineTo(ix+m2, iy-m6);
1170  LineTo(ix+m2, iy+m6);
1171  LineTo(ix+m6, iy+m6);
1172  LineTo(ix+m6, iy+m2);
1173  LineTo(ix-m6, iy+m2);
1174  LineTo(ix-m6, iy+m6);
1175  LineTo(ix-m2, iy+m6);
1176  LineTo(ix-m2, iy-m6);
1177  LineTo(ix-m6, iy-m6*0.99);
1178  LineTo(ix-m6, iy+m6);
1179  LineTo(ix+m6, iy+m6);
1180  LineTo(ix+m6, iy-m6);
1181  MoveTo(ix-m6, iy-m6*1.01);
1182  PrintFast(2," h");
1183  } else {
1184  MoveTo(ix-1, iy);
1185  LineTo(ix , iy);
1186  }
1187  if ((ms > 19 && ms < 24) || ms == 29 || ms == 33 || ms == 34 ||
1188  ms == 39 || ms == 41 || ms == 43 || ms == 45 ||
1189  ms == 47 || ms == 48 || ms == 49) {
1190  PrintFast(2," f");
1191  } else {
1192  PrintFast(2," S");
1193  }
1194  }
1195 
1196  SetLineStyle(linestylesav);
1197  SetLineWidth(linewidthsav);
1198 }
1199 
1200 ////////////////////////////////////////////////////////////////////////////////
1201 /// Draw a PolyLine
1202 ///
1203 /// Draw a polyline through the points xw,yw.
1204 ///
1205 /// - If nn=1 moves only to point xw,yw.
1206 /// - If nn=0 the XW(1) and YW(1) are written in the PDF file
1207 /// according to the current NT.
1208 /// - If nn>0 the line is clipped as a line.
1209 /// - If nn<0 the line is clipped as a fill area.
1210 
1211 void TPDF::DrawPS(Int_t nn, Float_t *xw, Float_t *yw)
1212 {
1213  static Float_t dyhatch[24] = {.0075,.0075,.0075,.0075,.0075,.0075,.0075,.0075,
1214  .01 ,.01 ,.01 ,.01 ,.01 ,.01 ,.01 ,.01 ,
1215  .015 ,.015 ,.015 ,.015 ,.015 ,.015 ,.015 ,.015};
1216  static Float_t anglehatch[24] = {180, 90,135, 45,150, 30,120, 60,
1217  180, 90,135, 45,150, 30,120, 60,
1218  180, 90,135, 45,150, 30,120, 60};
1219  Int_t n = 0, fais = 0 , fasi = 0;
1220 
1221  Style_t linestylesav = fLineStyle;
1222  Width_t linewidthsav = fLineWidth;
1223 
1224  if (nn > 0) {
1225  if (fLineWidth<=0) return;
1226  n = nn;
1230  }
1231  if (nn < 0) {
1232  n = -nn;
1233  SetLineStyle(1);
1234  SetLineWidth(1);
1236  fais = fFillStyle/1000;
1237  fasi = fFillStyle%1000;
1238  if (fais == 3 || fais == 2) {
1239  if (fasi > 100 && fasi <125) {
1240  DrawHatch(dyhatch[fasi-101],anglehatch[fasi-101], n, xw, yw);
1241  SetLineStyle(linestylesav);
1242  SetLineWidth(linewidthsav);
1243  return;
1244  }
1245  if (fasi > 0 && fasi < 26) {
1247  }
1248  }
1249  }
1250 
1251  WriteReal(XtoPDF(xw[0]));
1252  WriteReal(YtoPDF(yw[0]));
1253  if (n <= 1) {
1254  if (n == 0) return;
1255  PrintFast(2," m");
1256  return;
1257  }
1258 
1259  PrintFast(2," m");
1260 
1261  for (Int_t i=1;i<n;i++) LineTo(XtoPDF(xw[i]), YtoPDF(yw[i]));
1262 
1263  if (nn > 0) {
1264  if (xw[0] == xw[n-1] && yw[0] == yw[n-1]) PrintFast(2," h");
1265  PrintFast(2," S");
1266  } else {
1267  if (fais == 0) {PrintFast(2," s"); return;}
1268  if (fais == 3 || fais == 2) {
1269  if (fasi > 0 && fasi < 26) {
1270  PrintFast(3," f*");
1271  fRed = -1;
1272  fGreen = -1;
1273  fBlue = -1;
1274  fAlpha = -1.;
1275  }
1276  SetLineStyle(linestylesav);
1277  SetLineWidth(linewidthsav);
1278  return;
1279  }
1280  PrintFast(3," f*");
1281  }
1282 
1283  SetLineStyle(linestylesav);
1284  SetLineWidth(linewidthsav);
1285 }
1286 
1287 ////////////////////////////////////////////////////////////////////////////////
1288 /// Draw a PolyLine
1289 ///
1290 /// Draw a polyline through the points xw,yw.
1291 ///
1292 /// - If nn=1 moves only to point xw,yw.
1293 /// - If nn=0 the xw(1) and YW(1) are written in the PDF file
1294 /// according to the current NT.
1295 /// - If nn>0 the line is clipped as a line.
1296 /// - If nn<0 the line is clipped as a fill area.
1297 
1299 {
1300  static Float_t dyhatch[24] = {.0075,.0075,.0075,.0075,.0075,.0075,.0075,.0075,
1301  .01 ,.01 ,.01 ,.01 ,.01 ,.01 ,.01 ,.01 ,
1302  .015 ,.015 ,.015 ,.015 ,.015 ,.015 ,.015 ,.015};
1303  static Float_t anglehatch[24] = {180, 90,135, 45,150, 30,120, 60,
1304  180, 90,135, 45,150, 30,120, 60,
1305  180, 90,135, 45,150, 30,120, 60};
1306  Int_t n = 0, fais = 0, fasi = 0;
1307 
1308  Style_t linestylesav = fLineStyle;
1309  Width_t linewidthsav = fLineWidth;
1310 
1311  if (nn > 0) {
1312  if (fLineWidth<=0) return;
1313  n = nn;
1317  }
1318  if (nn < 0) {
1319  n = -nn;
1320  SetLineStyle(1);
1321  SetLineWidth(1);
1323  fais = fFillStyle/1000;
1324  fasi = fFillStyle%1000;
1325  if (fais == 3 || fais == 2) {
1326  if (fasi > 100 && fasi <125) {
1327  DrawHatch(dyhatch[fasi-101],anglehatch[fasi-101], n, xw, yw);
1328  SetLineStyle(linestylesav);
1329  SetLineWidth(linewidthsav);
1330  return;
1331  }
1332  if (fasi > 0 && fasi < 26) {
1334  }
1335  }
1336  }
1337 
1338  WriteReal(XtoPDF(xw[0]));
1339  WriteReal(YtoPDF(yw[0]));
1340  if (n <= 1) {
1341  if (n == 0) return;
1342  PrintFast(2," m");
1343  return;
1344  }
1345 
1346  PrintFast(2," m");
1347 
1348  for (Int_t i=1;i<n;i++) LineTo(XtoPDF(xw[i]), YtoPDF(yw[i]));
1349 
1350  if (nn > 0) {
1351  if (xw[0] == xw[n-1] && yw[0] == yw[n-1]) PrintFast(2," h");
1352  PrintFast(2," S");
1353  } else {
1354  if (fais == 0) {PrintFast(2," s"); return;}
1355  if (fais == 3 || fais == 2) {
1356  if (fasi > 0 && fasi < 26) {
1357  PrintFast(3," f*");
1358  fRed = -1;
1359  fGreen = -1;
1360  fBlue = -1;
1361  fAlpha = -1.;
1362  }
1363  SetLineStyle(linestylesav);
1364  SetLineWidth(linewidthsav);
1365  return;
1366  }
1367  PrintFast(3," f*");
1368  }
1369 
1370  SetLineStyle(linestylesav);
1371  SetLineWidth(linewidthsav);
1372 }
1373 
1374 ////////////////////////////////////////////////////////////////////////////////
1375 /// Font encoding
1376 
1378 {
1379  static const char *sdtfonts[] = {
1380  "/Times-Italic" , "/Times-Bold" , "/Times-BoldItalic",
1381  "/Helvetica" , "/Helvetica-Oblique" , "/Helvetica-Bold" ,
1382  "/Helvetica-BoldOblique", "/Courier" , "/Courier-Oblique" ,
1383  "/Courier-Bold" , "/Courier-BoldOblique", "/Symbol" ,
1384  "/Times-Roman" , "/ZapfDingbats" , "/Symbol"};
1385 
1386  for (Int_t i=0; i<kNumberOfFonts; i++) {
1387  NewObject(kObjFont+i);
1388  PrintStr("<<@");
1389  PrintStr("/Type /Font@");
1390  PrintStr("/Subtype /Type1@");
1391  PrintStr("/Name /F");
1392  WriteInteger(i+1,0);
1393  PrintStr("@");
1394  PrintStr("/BaseFont ");
1395  PrintStr(sdtfonts[i]);
1396  PrintStr("@");
1397  if (i!=11 && i!=13 && i!=14) {
1398  PrintStr("/Encoding /WinAnsiEncoding");
1399  PrintStr("@");
1400  }
1401  PrintStr(">>@");
1402  PrintStr("endobj@");
1403  }
1404 }
1405 
1406 ////////////////////////////////////////////////////////////////////////////////
1407 /// Draw a line to a new position
1408 
1410 {
1411  WriteReal(x);
1412  WriteReal(y);
1413  PrintFast(2," l");
1414 }
1415 
1416 ////////////////////////////////////////////////////////////////////////////////
1417 /// Move to a new position
1418 
1420 {
1421  WriteReal(x);
1422  WriteReal(y);
1423  PrintFast(2," m");
1424 }
1425 
1426 ////////////////////////////////////////////////////////////////////////////////
1427 /// Create a new object in the PDF file
1428 
1430 {
1431  if (!fObjPos || n >= fObjPosSize) {
1432  Int_t newN = TMath::Max(2*fObjPosSize,n+1);
1433  Int_t *saveo = new Int_t [newN];
1434  if (fObjPos && fObjPosSize) {
1435  memcpy(saveo,fObjPos,fObjPosSize*sizeof(Int_t));
1436  memset(&saveo[fObjPosSize],0,(newN-fObjPosSize)*sizeof(Int_t));
1437  delete [] fObjPos;
1438  }
1439  fObjPos = saveo;
1440  fObjPosSize = newN;
1441  }
1442  fObjPos[n-1] = fNByte;
1444  WriteInteger(n, 0);
1445  PrintStr(" 0 obj");
1446  PrintStr("@");
1447 }
1448 
1449 ////////////////////////////////////////////////////////////////////////////////
1450 /// Start a new PDF page.
1451 
1453 {
1454  if (!fPageNotEmpty) return;
1455 
1456  // Compute pad conversion coefficients
1457  if (gPad) {
1458  Double_t ww = gPad->GetWw();
1459  Double_t wh = gPad->GetWh();
1460  fYsize = fXsize*wh/ww;
1461  } else {
1462  fYsize = 27;
1463  }
1464 
1465  fNbPage++;
1466 
1467  if (fNbPage>1) {
1468  // Close the currently opened page
1470  PrintStr("endstream@");
1471  Int_t streamLength = fNByte-fStartStream-10;
1472  PrintStr("endobj@");
1473  NewObject(4*(fNbPage-2)+kObjFirstPage+2);
1474  WriteInteger(streamLength, 0);
1475  PrintStr("@");
1476  PrintStr("endobj@");
1477  NewObject(4*(fNbPage-2)+kObjFirstPage+3);
1478  PrintStr("<<@");
1479  if (!strstr(GetTitle(),"PDF")) {
1480  PrintStr("/Title (");
1481  PrintStr(GetTitle());
1482  PrintStr(")@");
1483  } else {
1484  PrintStr("/Title (Page");
1485  WriteInteger(fNbPage-1);
1486  PrintStr(")@");
1487  }
1488  PrintStr("/Dest [");
1490  PrintStr(" 0 R /XYZ null null 0]@");
1491  PrintStr("/Parent");
1493  PrintStr(" 0 R");
1494  PrintStr("@");
1495  PrintStr("/Next");
1497  PrintStr(" 0 R");
1498  PrintStr("@");
1499  if (fNbPage>2) {
1500  PrintStr("/Prev");
1502  PrintStr(" 0 R");
1503  PrintStr("@");
1504  }
1505  PrintStr(">>@");
1506  }
1507 
1508  // Start a new page
1510  PrintStr("<<@");
1511  PrintStr("/Type /Page@");
1512  PrintStr("@");
1513  PrintStr("/Parent");
1515  PrintStr(" 0 R");
1516  PrintStr("@");
1517 
1518  Double_t xlow=0, ylow=0, xup=1, yup=1;
1519  if (gPad) {
1520  xlow = gPad->GetAbsXlowNDC();
1521  xup = xlow + gPad->GetAbsWNDC();
1522  ylow = gPad->GetAbsYlowNDC();
1523  yup = ylow + gPad->GetAbsHNDC();
1524  }
1525 
1526  PrintStr("/MediaBox [");
1527  Double_t width, height;
1528  switch (fPageFormat) {
1529  case 100 :
1530  width = 8.5*2.54;
1531  height = 11.*2.54;
1532  break;
1533  case 200 :
1534  width = 8.5*2.54;
1535  height = 14.*2.54;
1536  break;
1537  case 300 :
1538  width = 11.*2.54;
1539  height = 17.*2.54;
1540  break;
1541  default :
1542  width = 21.0*TMath::Power(TMath::Sqrt(2.), 4-fPageFormat);
1543  height = 29.7*TMath::Power(TMath::Sqrt(2.), 4-fPageFormat);
1544  };
1545  WriteReal(CMtoPDF(fXsize*xlow));
1546  WriteReal(CMtoPDF(fYsize*ylow));
1548  WriteReal(CMtoPDF(height));
1549  PrintStr("]");
1550  PrintStr("@");
1551 
1552  Double_t xmargin = CMtoPDF(0.7);
1553  Double_t ymargin = 0;
1554  if (fPageOrientation == 1) ymargin = CMtoPDF(TMath::Sqrt(2.)*0.7);
1555  if (fPageOrientation == 2) ymargin = CMtoPDF(height)-CMtoPDF(0.7);
1556 
1557  PrintStr("/CropBox [");
1558  if (fPageOrientation == 1) {
1559  WriteReal(xmargin);
1560  WriteReal(ymargin);
1561  WriteReal(xmargin+CMtoPDF(fXsize*xup));
1562  WriteReal(ymargin+CMtoPDF(fYsize*yup));
1563  }
1564  if (fPageOrientation == 2) {
1565  WriteReal(xmargin);
1566  WriteReal(CMtoPDF(height)-CMtoPDF(fXsize*xup)-xmargin);
1567  WriteReal(xmargin+CMtoPDF(fYsize*yup));
1568  WriteReal(CMtoPDF(height)-xmargin);
1569  }
1570  PrintStr("]");
1571  PrintStr("@");
1572 
1573  if (fPageOrientation == 1) PrintStr("/Rotate 0@");
1574  if (fPageOrientation == 2) PrintStr("/Rotate 90@");
1575 
1576  PrintStr("/Resources");
1578  PrintStr(" 0 R");
1579  PrintStr("@");
1580 
1581  PrintStr("/Contents");
1583  PrintStr(" 0 R@");
1584  PrintStr(">>@");
1585  PrintStr("endobj@");
1586 
1587  NewObject(4*(fNbPage-1)+kObjFirstPage+1);
1588  PrintStr("<<@");
1589  PrintStr("/Length");
1591  PrintStr(" 0 R@");
1592  PrintStr("/Filter [/FlateDecode]@");
1593  PrintStr(">>@");
1594  PrintStr("stream@");
1595  fStartStream = fNByte;
1596  fCompress = kTRUE;
1597 
1598  // Force the line width definition next time TPDF::SetLineWidth will be called.
1599  fLineWidth = -1;
1600 
1601  // Force the color definition next time TPDF::SetColor will be called.
1602  fRed = -1;
1603  fGreen = -1;
1604  fBlue = -1;
1605  fAlpha = -1.;
1606 
1607  PrintStr("1 0 0 1");
1608  if (fPageOrientation == 2) {
1609  ymargin = CMtoPDF(height)-CMtoPDF(fXsize*xup)-xmargin;
1610  xmargin = xmargin+CMtoPDF(fYsize*yup);
1611  }
1612  WriteReal(xmargin);
1613  WriteReal(ymargin);
1614  PrintStr(" cm");
1615  if (fPageOrientation == 2) PrintStr(" 0 1 -1 0 0 0 cm");
1616  if (fgLineJoin) {
1618  PrintFast(2," j");
1619  }
1620  if (fgLineCap) {
1622  PrintFast(2," J");
1623  }
1624 }
1625 
1626 ////////////////////////////////////////////////////////////////////////////////
1627 /// Deactivate an already open PDF file
1628 
1630 {
1631  gVirtualPS = 0;
1632 }
1633 
1634 ////////////////////////////////////////////////////////////////////////////////
1635 /// Activate an already open PDF file
1636 
1637 void TPDF::On()
1638 {
1639  // fType is used to know if the PDF file is open. Unlike TPostScript, TPDF
1640  // has no "workstation type".
1641 
1642  if (!fType) {
1643  Error("On", "no PDF file open");
1644  Off();
1645  return;
1646  }
1647  gVirtualPS = this;
1648 }
1649 
1650 ////////////////////////////////////////////////////////////////////////////////
1651 /// Open a PDF file
1652 
1653 void TPDF::Open(const char *fname, Int_t wtype)
1654 {
1655  Int_t i;
1656 
1657  if (fStream) {
1658  Warning("Open", "PDF file already open");
1659  return;
1660  }
1661 
1662  fLenBuffer = 0;
1663  fRed = -1;
1664  fGreen = -1;
1665  fBlue = -1;
1666  fAlpha = -1.;
1667  fType = abs(wtype);
1672  Float_t xrange, yrange;
1673  if (gPad) {
1674  Double_t ww = gPad->GetWw();
1675  Double_t wh = gPad->GetWh();
1676  if (fType == 113) {
1677  ww *= gPad->GetWNDC();
1678  wh *= gPad->GetHNDC();
1679  }
1680  Double_t ratio = wh/ww;
1681  xrange = fXsize;
1682  yrange = fXsize*ratio;
1683  if (yrange > fYsize) { yrange = fYsize; xrange = yrange/ratio;}
1684  fXsize = xrange; fYsize = yrange;
1685  }
1686 
1687  // Open OS file
1688  fStream = new std::ofstream();
1689 #ifdef R__WIN32
1690  fStream->open(fname, std::ofstream::out | std::ofstream::binary);
1691 #else
1692  fStream->open(fname, std::ofstream::out);
1693 #endif
1694  if (fStream == 0 || !fStream->good()) {
1695  printf("ERROR in TPDF::Open: Cannot open file:%s\n",fname);
1696  if (fStream == 0) return;
1697  }
1698 
1699  gVirtualPS = this;
1700 
1701  for (i=0; i<fSizBuffer; i++) fBuffer[i] = ' ';
1702 
1703  // The page orientation is last digit of PDF workstation type
1704  // orientation = 1 for portrait
1705  // orientation = 2 for landscape
1706  fPageOrientation = fType%10;
1707  if (fPageOrientation < 1 || fPageOrientation > 2) {
1708  Error("Open", "Invalid page orientation %d", fPageOrientation);
1709  return;
1710  }
1711 
1712  // format = 0-99 is the European page format (A4,A3 ...)
1713  // format = 100 is the US format 8.5x11.0 inch
1714  // format = 200 is the US format 8.5x14.0 inch
1715  // format = 300 is the US format 11.0x17.0 inch
1716  fPageFormat = fType/1000;
1717  if (fPageFormat == 0) fPageFormat = 4;
1718  if (fPageFormat == 99) fPageFormat = 0;
1719 
1720  fRange = kFALSE;
1721 
1722  // Set a default range
1723  Range(fXsize, fYsize);
1724 
1725  fObjPos = 0;
1726  fObjPosSize = 0;
1727  fNbObj = 0;
1728  fNbPage = 0;
1729 
1730  PrintStr("%PDF-1.4@");
1731  PrintStr("%\342\343\317\323");
1732  PrintStr("@");
1733 
1735  PrintStr("<<@");
1736  PrintStr("/Type /Catalog@");
1737  PrintStr("/Pages");
1739  PrintStr(" 0 R@");
1740  PrintStr("/Outlines");
1742  PrintStr(" 0 R@");
1743  PrintStr("/PageMode /UseOutlines@");
1744  PrintStr(">>@");
1745  PrintStr("endobj@");
1746 
1748  PrintStr("<<@");
1749  PrintStr("/Creator (ROOT Version ");
1750  PrintStr(gROOT->GetVersion());
1751  PrintStr(")");
1752  PrintStr("@");
1753  PrintStr("/CreationDate (");
1754  TDatime t;
1755  Int_t toff = t.Convert(kFALSE) - t.Convert(kTRUE); // time zone and dst offset
1756  toff = toff/60;
1757  char str[24];
1758  snprintf(str,24,"D:%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d%c%2.2d'%2.2d'",
1759  t.GetYear() , t.GetMonth(),
1760  t.GetDay() , t.GetHour(),
1761  t.GetMinute(), t.GetSecond(),
1762  toff < 0 ? '-' : '+',
1763  // TMath::Abs(toff/60), TMath::Abs(toff%60)); // format-truncation warning
1764  TMath::Abs(toff/60) & 0x3F, TMath::Abs(toff%60) & 0x3F); // now 2 digits
1765  PrintStr(str);
1766  PrintStr(")");
1767  PrintStr("@");
1768  PrintStr("/ModDate (");
1769  PrintStr(str);
1770  PrintStr(")");
1771  PrintStr("@");
1772  PrintStr("/Title (");
1773  if (strlen(GetName())<=80) PrintStr(GetName());
1774  PrintStr(")");
1775  PrintStr("@");
1776  PrintStr("/Keywords (ROOT)@");
1777  PrintStr(">>@");
1778  PrintStr("endobj@");
1779 
1781  PrintStr("<<@");
1782  PrintStr("/ProcSet [/PDF /Text]@");
1783 
1784  PrintStr("/Font@");
1785  PrintStr("<<@");
1786  for (i=0; i<kNumberOfFonts; i++) {
1787  PrintStr(" /F");
1788  WriteInteger(i+1,0);
1790  PrintStr(" 0 R");
1791  }
1792  PrintStr("@");
1793  PrintStr(">>@");
1794 
1795  PrintStr("/ExtGState");
1797  PrintStr(" 0 R @");
1798  if (fAlphas.size()) fAlphas.clear();
1799 
1800  PrintStr("/ColorSpace << /Cs8");
1802  PrintStr(" 0 R >>");
1803  PrintStr("@");
1804  PrintStr("/Pattern");
1806  PrintStr(" 0 R");
1807  PrintStr("@");
1808  PrintStr(">>@");
1809  PrintStr("endobj@");
1810 
1811  FontEncode();
1812  PatternEncode();
1813 
1814  NewPage();
1816 }
1817 
1818 ////////////////////////////////////////////////////////////////////////////////
1819 /// Output the string str in the output buffer
1820 
1821 void TPDF::PrintStr(const char *str)
1822 {
1823  Int_t len = strlen(str);
1824  if (len == 0) return;
1825  fPageNotEmpty = kTRUE;
1826 
1827  if (fCompress) {
1828  if (fLenBuffer+len >= fSizBuffer) {
1830  fSizBuffer = 2*fSizBuffer;
1831  }
1832  strcpy(fBuffer + fLenBuffer, str);
1833  fLenBuffer += len;
1834  return;
1835  }
1836 
1837  TVirtualPS::PrintStr(str);
1838 }
1839 
1840 ////////////////////////////////////////////////////////////////////////////////
1841 /// Fast version of Print
1842 
1843 void TPDF::PrintFast(Int_t len, const char *str)
1844 {
1845  fPageNotEmpty = kTRUE;
1846  if (fCompress) {
1847  if (fLenBuffer+len >= fSizBuffer) {
1849  fSizBuffer = 2*fSizBuffer;
1850  }
1851  strcpy(fBuffer + fLenBuffer, str);
1852  fLenBuffer += len;
1853  return;
1854  }
1855 
1856  TVirtualPS::PrintFast(len, str);
1857 }
1858 
1859 ////////////////////////////////////////////////////////////////////////////////
1860 /// Set the range for the paper in centimetres
1861 
1862 void TPDF::Range(Float_t xsize, Float_t ysize)
1863 {
1864  Float_t xps, yps, xncm, yncm, dxwn, dywn, xwkwn, ywkwn, xymax;
1865 
1866  fXsize = xsize;
1867  fYsize = ysize;
1868 
1869  xps = xsize;
1870  yps = ysize;
1871 
1872  if (xsize <= xps && ysize < yps) {
1873  if ( xps > yps) xymax = xps;
1874  else xymax = yps;
1875  xncm = xsize/xymax;
1876  yncm = ysize/xymax;
1877  dxwn = ((xps/xymax)-xncm)/2;
1878  dywn = ((yps/xymax)-yncm)/2;
1879  } else {
1880  if (xps/yps < 1) xwkwn = xps/yps;
1881  else xwkwn = 1;
1882  if (yps/xps < 1) ywkwn = yps/xps;
1883  else ywkwn = 1;
1884 
1885  if (xsize < ysize) {
1886  xncm = ywkwn*xsize/ysize;
1887  yncm = ywkwn;
1888  dxwn = (xwkwn-xncm)/2;
1889  dywn = 0;
1890  if (dxwn < 0) {
1891  xncm = xwkwn;
1892  dxwn = 0;
1893  yncm = xwkwn*ysize/xsize;
1894  dywn = (ywkwn-yncm)/2;
1895  }
1896  } else {
1897  xncm = xwkwn;
1898  yncm = xwkwn*ysize/xsize;
1899  dxwn = 0;
1900  dywn = (ywkwn-yncm)/2;
1901  if (dywn < 0) {
1902  yncm = ywkwn;
1903  dywn = 0;
1904  xncm = ywkwn*xsize/ysize;
1905  dxwn = (xwkwn-xncm)/2;
1906  }
1907  }
1908  }
1909  fRange = kTRUE;
1910 }
1911 
1912 ////////////////////////////////////////////////////////////////////////////////
1913 /// Set the alpha channel value.
1914 
1916 {
1917  if (a == fAlpha) return;
1918  fAlpha = a;
1919  if (fAlpha <= 0.000001) fAlpha = 0;
1920 
1921  Bool_t known = kFALSE;
1922  for (int i=0; i<(int)fAlphas.size(); i++) {
1923  if (fAlpha == fAlphas[i]) {
1924  known = kTRUE;
1925  break;
1926  }
1927  }
1928  if (!known) fAlphas.push_back(fAlpha);
1929  PrintStr(Form(" /ca%3.2f gs /CA%3.2f gs",fAlpha,fAlpha));
1930 }
1931 
1932 ////////////////////////////////////////////////////////////////////////////////
1933 /// Set color with its color index.
1934 
1936 {
1937  if (color < 0) color = 0;
1938  TColor *col = gROOT->GetColor(color);
1939 
1940  if (col) {
1941  SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
1942  SetAlpha(col->GetAlpha());
1943  } else {
1944  SetColor(1., 1., 1.);
1945  SetAlpha(1.);
1946  }
1947 }
1948 
1949 ////////////////////////////////////////////////////////////////////////////////
1950 /// Set color with its R G B components:
1951 ///
1952 /// - r: % of red in [0,1]
1953 /// - g: % of green in [0,1]
1954 /// - b: % of blue in [0,1]
1955 
1957 {
1958  if (r == fRed && g == fGreen && b == fBlue) return;
1959 
1960  fRed = r;
1961  fGreen = g;
1962  fBlue = b;
1963  if (fRed <= 0.000001) fRed = 0;
1964  if (fGreen <= 0.000001) fGreen = 0;
1965  if (fBlue <= 0.000001) fBlue = 0;
1966 
1967  if (gStyle->GetColorModelPS()) {
1968  Double_t colCyan, colMagenta, colYellow;
1969  Double_t colBlack = TMath::Min(TMath::Min(1-fRed,1-fGreen),1-fBlue);
1970  if (colBlack==1) {
1971  colCyan = 0;
1972  colMagenta = 0;
1973  colYellow = 0;
1974  } else {
1975  colCyan = (1-fRed-colBlack)/(1-colBlack);
1976  colMagenta = (1-fGreen-colBlack)/(1-colBlack);
1977  colYellow = (1-fBlue-colBlack)/(1-colBlack);
1978  }
1979  if (colCyan <= 0.000001) colCyan = 0;
1980  if (colMagenta <= 0.000001) colMagenta = 0;
1981  if (colYellow <= 0.000001) colYellow = 0;
1982  if (colBlack <= 0.000001) colBlack = 0;
1983  WriteReal(colCyan);
1984  WriteReal(colMagenta);
1985  WriteReal(colYellow);
1986  WriteReal(colBlack);
1987  PrintFast(2," K");
1988  WriteReal(colCyan);
1989  WriteReal(colMagenta);
1990  WriteReal(colYellow);
1991  WriteReal(colBlack);
1992  PrintFast(2," k");
1993  } else {
1994  WriteReal(fRed);
1995  WriteReal(fGreen);
1996  WriteReal(fBlue);
1997  PrintFast(3," RG");
1998  WriteReal(fRed);
1999  WriteReal(fGreen);
2000  WriteReal(fBlue);
2001  PrintFast(3," rg");
2002  }
2003 }
2004 
2005 ////////////////////////////////////////////////////////////////////////////////
2006 /// Set color index for fill areas
2007 
2009 {
2010  fFillColor = cindex;
2011  if (gStyle->GetFillColor() <= 0) cindex = 0;
2012 }
2013 
2014 ////////////////////////////////////////////////////////////////////////////////
2015 /// Set the fill patterns (1 to 25) for fill areas
2016 
2018 {
2019  char cpat[10];
2020  TColor *col = gROOT->GetColor(color);
2021  if (!col) return;
2022  PrintStr(" /Cs8 cs");
2023  Double_t colRed = col->GetRed();
2024  Double_t colGreen = col->GetGreen();
2025  Double_t colBlue = col->GetBlue();
2026  if (gStyle->GetColorModelPS()) {
2027  Double_t colBlack = TMath::Min(TMath::Min(1-colRed,1-colGreen),1-colBlue);
2028  if (colBlack==1) {
2029  WriteReal(0);
2030  WriteReal(0);
2031  WriteReal(0);
2032  WriteReal(colBlack);
2033  } else {
2034  Double_t colCyan = (1-colRed-colBlack)/(1-colBlack);
2035  Double_t colMagenta = (1-colGreen-colBlack)/(1-colBlack);
2036  Double_t colYellow = (1-colBlue-colBlack)/(1-colBlack);
2037  WriteReal(colCyan);
2038  WriteReal(colMagenta);
2039  WriteReal(colYellow);
2040  WriteReal(colBlack);
2041  }
2042  } else {
2043  WriteReal(colRed);
2044  WriteReal(colGreen);
2045  WriteReal(colBlue);
2046  }
2047  snprintf(cpat,10," /P%2.2d scn", ipat);
2048  PrintStr(cpat);
2049 }
2050 
2051 ////////////////////////////////////////////////////////////////////////////////
2052 /// Set color index for lines
2053 
2055 {
2056  fLineColor = cindex;
2057 }
2058 
2059 ////////////////////////////////////////////////////////////////////////////////
2060 /// Set the value of the global parameter TPDF::fgLineJoin.
2061 /// This parameter determines the appearance of joining lines in a PDF
2062 /// output.
2063 /// It takes one argument which may be:
2064 /// - 0 (miter join)
2065 /// - 1 (round join)
2066 /// - 2 (bevel join)
2067 /// The default value is 0 (miter join).
2068 ///
2069 /// \image html postscript_1.png
2070 ///
2071 /// To change the line join behaviour just do:
2072 /// ~~~ {.cpp}
2073 /// gStyle->SetJoinLinePS(2); // Set the PDF line join to bevel.
2074 /// ~~~
2075 
2076 void TPDF::SetLineJoin( Int_t linejoin )
2077 {
2078  fgLineJoin = linejoin;
2079  if (fgLineJoin<0) fgLineJoin=0;
2080  if (fgLineJoin>2) fgLineJoin=2;
2081 }
2082 
2083 ////////////////////////////////////////////////////////////////////////////////
2084 /// Set the value of the global parameter TPDF::fgLineCap.
2085 /// This parameter determines the appearance of line caps in a PDF
2086 /// output.
2087 /// It takes one argument which may be:
2088 /// - 0 (butt caps)
2089 /// - 1 (round caps)
2090 /// - 2 (projecting caps)
2091 /// The default value is 0 (butt caps).
2092 ///
2093 /// \image html postscript_2.png
2094 ///
2095 /// To change the line cap behaviour just do:
2096 /// ~~~ {.cpp}
2097 /// gStyle->SetCapLinePS(2); // Set the PDF line cap to projecting.
2098 /// ~~~
2099 
2100 void TPDF::SetLineCap( Int_t linecap )
2101 {
2102  fgLineCap = linecap;
2103  if (fgLineCap<0) fgLineCap=0;
2104  if (fgLineCap>2) fgLineCap=2;
2105 }
2106 
2107 ////////////////////////////////////////////////////////////////////////////////
2108 /// Change the line style
2109 ///
2110 /// - linestyle = 2 dashed
2111 /// - linestyle = 3 dotted
2112 /// - linestyle = 4 dash-dotted
2113 /// - linestyle = else solid (1 in is used most of the time)
2114 
2116 {
2117  if ( linestyle == fLineStyle) return;
2118  fLineStyle = linestyle;
2119  TString st = (TString)gStyle->GetLineStyleString(linestyle);
2120  PrintFast(2," [");
2121  TObjArray *tokens = st.Tokenize(" ");
2122  for (Int_t j = 0; j<tokens->GetEntries(); j++) {
2123  Int_t it;
2124  sscanf(((TObjString*)tokens->At(j))->GetName(), "%d", &it);
2125  WriteInteger((Int_t)(it/4));
2126  }
2127  delete tokens;
2128  PrintFast(5,"] 0 d");
2129 }
2130 
2131 ////////////////////////////////////////////////////////////////////////////////
2132 /// Change the line width
2133 
2135 {
2136  if (linewidth == fLineWidth) return;
2137  fLineWidth = linewidth;
2138  if (fLineWidth!=0) {
2140  PrintFast(2," w");
2141  }
2142 }
2143 
2144 ////////////////////////////////////////////////////////////////////////////////
2145 /// Set color index for markers.
2146 
2148 {
2149  fMarkerColor = cindex;
2150 }
2151 
2152 ////////////////////////////////////////////////////////////////////////////////
2153 /// Set color index for text
2154 
2156 {
2157  fTextColor = cindex;
2158 }
2159 
2160 ////////////////////////////////////////////////////////////////////////////////
2161 /// Draw text
2162 ///
2163 /// - xx: x position of the text
2164 /// - yy: y position of the text
2165 /// - chars: text to be drawn
2166 
2167 void TPDF::Text(Double_t xx, Double_t yy, const char *chars)
2168 {
2169  if (fTextSize <= 0) return;
2170 
2171  const Double_t kDEGRAD = TMath::Pi()/180.;
2172  char str[8];
2173  Double_t x = xx;
2174  Double_t y = yy;
2175 
2176  // Font and text size
2177  Int_t font = abs(fTextFont)/10;
2178  if (font > kNumberOfFonts || font < 1) font = 1;
2179 
2180  Double_t wh = (Double_t)gPad->XtoPixel(gPad->GetX2());
2181  Double_t hh = (Double_t)gPad->YtoPixel(gPad->GetY1());
2182  Float_t tsize, ftsize;
2183  if (wh < hh) {
2184  tsize = fTextSize*wh;
2185  Int_t sizeTTF = (Int_t)(tsize*kScale+0.5); // TTF size
2186  ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
2187  } else {
2188  tsize = fTextSize*hh;
2189  Int_t sizeTTF = (Int_t)(tsize*kScale+0.5); // TTF size
2190  ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
2191  }
2192  Double_t fontsize = 72*(ftsize)/2.54;
2193  if (fontsize <= 0) return;
2194 
2195  // Text color
2197 
2198  // Clipping
2199  PrintStr(" q");
2200  Double_t x1 = XtoPDF(gPad->GetX1());
2201  Double_t x2 = XtoPDF(gPad->GetX2());
2202  Double_t y1 = YtoPDF(gPad->GetY1());
2203  Double_t y2 = YtoPDF(gPad->GetY2());
2204  WriteReal(x1);
2205  WriteReal(y1);
2206  WriteReal(x2 - x1);
2207  WriteReal(y2 - y1);
2208  PrintStr(" re W n");
2209 
2210  // Start the text
2211  if (!fCompress) PrintStr("@");
2212 
2213  // Text alignment
2214  Float_t tsizex = gPad->AbsPixeltoX(Int_t(tsize))-gPad->AbsPixeltoX(0);
2215  Float_t tsizey = gPad->AbsPixeltoY(0)-gPad->AbsPixeltoY(Int_t(tsize));
2216  Int_t txalh = fTextAlign/10;
2217  if (txalh < 1) txalh = 1; else if (txalh > 3) txalh = 3;
2218  Int_t txalv = fTextAlign%10;
2219  if (txalv < 1) txalv = 1; else if (txalv > 3) txalv = 3;
2220  if (txalv == 3) {
2221  y -= 0.8*tsizey*TMath::Cos(kDEGRAD*fTextAngle);
2222  x += 0.8*tsizex*TMath::Sin(kDEGRAD*fTextAngle);
2223  } else if (txalv == 2) {
2224  y -= 0.4*tsizey*TMath::Cos(kDEGRAD*fTextAngle);
2225  x += 0.4*tsizex*TMath::Sin(kDEGRAD*fTextAngle);
2226  }
2227 
2228  if (txalh > 1) {
2229  TText t;
2230  UInt_t w=0, h;
2233  t.GetTextExtent(w, h, chars);
2234  Double_t twx = gPad->AbsPixeltoX(w)-gPad->AbsPixeltoX(0);
2235  Double_t twy = gPad->AbsPixeltoY(0)-gPad->AbsPixeltoY(w);
2236  if (txalh == 2) {
2237  x = x-(twx/2)*TMath::Cos(kDEGRAD*fTextAngle);
2238  y = y-(twy/2)*TMath::Sin(kDEGRAD*fTextAngle);
2239  }
2240  if (txalh == 3) {
2241  x = x-twx*TMath::Cos(kDEGRAD*fTextAngle);
2242  y = y-twy*TMath::Sin(kDEGRAD*fTextAngle);
2243  }
2244  }
2245 
2246  // Text angle
2247  if (fTextAngle == 0) {
2248  PrintStr(" 1 0 0 1");
2249  WriteReal(XtoPDF(x));
2250  WriteReal(YtoPDF(y));
2251  } else if (fTextAngle == 90) {
2252  PrintStr(" 0 1 -1 0");
2253  WriteReal(XtoPDF(x));
2254  WriteReal(YtoPDF(y));
2255  } else if (fTextAngle == 270) {
2256  PrintStr(" 0 -1 1 0");
2257  WriteReal(XtoPDF(x));
2258  WriteReal(YtoPDF(y));
2259  } else {
2260  WriteReal(TMath::Cos(kDEGRAD*fTextAngle));
2261  WriteReal(TMath::Sin(kDEGRAD*fTextAngle));
2262  WriteReal(-TMath::Sin(kDEGRAD*fTextAngle));
2263  WriteReal(TMath::Cos(kDEGRAD*fTextAngle));
2264  WriteReal(XtoPDF(x));
2265  WriteReal(YtoPDF(y));
2266  }
2267  PrintStr(" cm");
2268 
2269  // Symbol Italic tan(15) = .26794
2270  if (font == 15) PrintStr(" 1 0 0.26794 1 0 0 cm");
2271 
2272  PrintStr(" BT");
2273 
2274  snprintf(str,8," /F%d",font);
2275  PrintStr(str);
2276  WriteReal(fontsize);
2277  PrintStr(" Tf");
2278 
2279  const Int_t len=strlen(chars);
2280 
2281  // Calculate the individual character placements.
2282  // Otherwise, if a string is printed in one line the kerning is not
2283  // performed. In order to measure the precise character positions we need to
2284  // trick FreeType into rendering high-resolution characters otherwise it will
2285  // stick to the screen pixel grid which is far worse than we can achieve on
2286  // print.
2287  const Float_t scale = 16.0;
2288  // Save current text attributes.
2289  TText saveAttText;
2290  saveAttText.TAttText::operator=(*this);
2291  TText t;
2292  t.SetTextSize(fTextSize * scale);
2294  UInt_t wa1=0, wa0=0;
2295  t.GetTextAdvance(wa0, chars, kFALSE);
2296  t.GetTextAdvance(wa1, chars);
2297  t.TAttText::Modify();
2298  Bool_t kerning;
2299  if (wa0-wa1 != 0) kerning = kTRUE;
2300  else kerning = kFALSE;
2301  Int_t *charDeltas = 0;
2302  if (kerning) {
2303  charDeltas = new Int_t[len];
2304  for (Int_t i = 0;i < len;i++) {
2305  UInt_t ww=0;
2306  t.GetTextAdvance(ww, chars + i);
2307  charDeltas[i] = wa1 - ww;
2308  }
2309  for (Int_t i = len - 1;i > 0;i--) {
2310  charDeltas[i] -= charDeltas[i-1];
2311  }
2312  char tmp[2];
2313  tmp[1] = 0;
2314  for (Int_t i = 1;i < len;i++) {
2315  tmp[0] = chars[i-1];
2316  UInt_t width=0;
2317  t.GetTextAdvance(width, &tmp[0], kFALSE);
2318  Double_t wwl = gPad->AbsPixeltoX(width - charDeltas[i]) - gPad->AbsPixeltoX(0);
2319  wwl -= 0.5*(gPad->AbsPixeltoX(1) - gPad->AbsPixeltoX(0)); // half a pixel ~ rounding error
2320  charDeltas[i] = (Int_t)((1000.0/Float_t(fontsize))*(XtoPDF(wwl) - XtoPDF(0))/scale);
2321  }
2322  }
2323  // Restore text attributes.
2324  saveAttText.TAttText::Modify();
2325 
2326  // Output the text. Escape some characters if needed
2327  if (kerning) PrintStr(" [");
2328  else PrintStr(" (");
2329 
2330  for (Int_t i=0; i<len;i++) {
2331  if (chars[i]!='\n') {
2332  if (kerning) PrintStr("(");
2333  if (chars[i]=='(' || chars[i]==')') {
2334  snprintf(str,8,"\\%c",chars[i]);
2335  } else {
2336  snprintf(str,8,"%c",chars[i]);
2337  }
2338  PrintStr(str);
2339  if (kerning) {
2340  PrintStr(") ");
2341  if (i < len-1) {
2342  WriteInteger(charDeltas[i+1]);
2343  }
2344  }
2345  }
2346  }
2347 
2348  if (kerning) PrintStr("] TJ ET Q");
2349  else PrintStr(") Tj ET Q");
2350  if (!fCompress) PrintStr("@");
2351  if (kerning) delete [] charDeltas;
2352 }
2353 
2354 ////////////////////////////////////////////////////////////////////////////////
2355 /// Write a string of characters
2356 ///
2357 /// This method writes the string chars into a PDF file
2358 /// at position xx,yy in world coordinates.
2359 
2360 void TPDF::Text(Double_t, Double_t, const wchar_t *)
2361 {
2362 }
2363 
2364 ////////////////////////////////////////////////////////////////////////////////
2365 /// Write a string of characters in NDC
2366 
2367 void TPDF::TextNDC(Double_t u, Double_t v, const char *chars)
2368 {
2369  Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
2370  Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
2371  Text(x, y, chars);
2372 }
2373 
2374 ////////////////////////////////////////////////////////////////////////////////
2375 /// Write a string of characters in NDC
2376 
2377 void TPDF::TextNDC(Double_t u, Double_t v, const wchar_t *chars)
2378 {
2379  Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
2380  Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
2381  Text(x, y, chars);
2382 }
2383 
2384 ////////////////////////////////////////////////////////////////////////////////
2385 /// Convert U from NDC coordinate to PDF
2386 
2388 {
2389  Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
2390  return 72*cm/2.54;
2391 }
2392 
2393 ////////////////////////////////////////////////////////////////////////////////
2394 /// Convert V from NDC coordinate to PDF
2395 
2397 {
2398  Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
2399  return 72*cm/2.54;
2400 }
2401 
2402 ////////////////////////////////////////////////////////////////////////////////
2403 /// Convert X from world coordinate to PDF
2404 
2406 {
2407  Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
2408  return UtoPDF(u);
2409 }
2410 
2411 ////////////////////////////////////////////////////////////////////////////////
2412 /// Convert Y from world coordinate to PDF
2413 
2415 {
2416  Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
2417  return VtoPDF(v);
2418 }
2419 
2420 ////////////////////////////////////////////////////////////////////////////////
2421 /// Write the buffer in a compressed way
2422 
2424 {
2425  z_stream stream;
2426  int err;
2427  char *out = new char[2*fLenBuffer];
2428 
2429  stream.next_in = (Bytef*)fBuffer;
2430  stream.avail_in = (uInt)fLenBuffer;
2431  stream.next_out = (Bytef*)out;
2432  stream.avail_out = (uInt)2*fLenBuffer;
2433  stream.zalloc = (alloc_func)0;
2434  stream.zfree = (free_func)0;
2435  stream.opaque = (voidpf)0;
2436 
2437  err = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
2438  if (err != Z_OK) {
2439  Error("WriteCompressedBuffer", "error in deflateInit (zlib)");
2440  delete [] out;
2441  return;
2442  }
2443 
2444  err = deflate(&stream, Z_FINISH);
2445  if (err != Z_STREAM_END) {
2446  deflateEnd(&stream);
2447  Error("WriteCompressedBuffer", "error in deflate (zlib)");
2448  delete [] out;
2449  return;
2450  }
2451 
2452  err = deflateEnd(&stream);
2453 
2454  fStream->write(out, stream.total_out);
2455 
2456  fNByte += stream.total_out;
2457  fStream->write("\n",1); fNByte++;
2458  fLenBuffer = 0;
2459  delete [] out;
2460  fCompress = kFALSE;
2461 }
2462 
2463 ////////////////////////////////////////////////////////////////////////////////
2464 /// Write a Real number to the file.
2465 /// This method overwrites TVirtualPS::WriteReal. Some PDF reader like
2466 /// Acrobat do not work when a PDF file contains reals with exponent. This
2467 /// method writes the real number "z" using the format "%f" instead of the
2468 /// format "%g" when writing it with "%g" generates a number with exponent.
2469 
2471 {
2472  char str[15];
2473  if (space) {
2474  snprintf(str,15," %g", z);
2475  if (strstr(str,"e") || strstr(str,"E")) snprintf(str,15," %10.8f", z);
2476  } else {
2477  snprintf(str,15,"%g", z);
2478  if (strstr(str,"e") || strstr(str,"E")) snprintf(str,15,"%10.8f", z);
2479  }
2480  PrintStr(str);
2481 }
2482 
2483 ////////////////////////////////////////////////////////////////////////////////
2484 /// Patterns encoding
2485 
2487 {
2488  Int_t patternNb = kObjPattern;
2489 
2491  if (gStyle->GetColorModelPS()) {
2492  PrintStr("[/Pattern /DeviceCMYK]@");
2493  } else {
2494  PrintStr("[/Pattern /DeviceRGB]@");
2495  }
2496  PrintStr("endobj@");
2498  PrintStr("<</ProcSet[/PDF]>>@");
2499  PrintStr("endobj@");
2500 
2502  PrintStr("<<@");
2503  PrintStr(" /P01");
2504  WriteInteger(patternNb++);
2505  PrintStr(" 0 R");
2506  PrintStr(" /P02");
2507  WriteInteger(patternNb++);
2508  PrintStr(" 0 R");
2509  PrintStr(" /P03");
2510  WriteInteger(patternNb++);
2511  PrintStr(" 0 R");
2512  PrintStr(" /P04");
2513  WriteInteger(patternNb++);
2514  PrintStr(" 0 R");
2515  PrintStr(" /P05");
2516  WriteInteger(patternNb++);
2517  PrintStr(" 0 R");
2518  PrintStr(" /P06");
2519  WriteInteger(patternNb++);
2520  PrintStr(" 0 R");
2521  PrintStr(" /P07");
2522  WriteInteger(patternNb++);
2523  PrintStr(" 0 R");
2524  PrintStr(" /P08");
2525  WriteInteger(patternNb++);
2526  PrintStr(" 0 R");
2527  PrintStr(" /P09");
2528  WriteInteger(patternNb++);
2529  PrintStr(" 0 R");
2530  PrintStr(" /P10");
2531  WriteInteger(patternNb++);
2532  PrintStr(" 0 R");
2533  PrintStr(" /P11");
2534  WriteInteger(patternNb++);
2535  PrintStr(" 0 R");
2536  PrintStr(" /P12");
2537  WriteInteger(patternNb++);
2538  PrintStr(" 0 R");
2539  PrintStr(" /P13");
2540  WriteInteger(patternNb++);
2541  PrintStr(" 0 R");
2542  PrintStr(" /P14");
2543  WriteInteger(patternNb++);
2544  PrintStr(" 0 R");
2545  PrintStr(" /P15");
2546  WriteInteger(patternNb++);
2547  PrintStr(" 0 R");
2548  PrintStr(" /P16");
2549  WriteInteger(patternNb++);
2550  PrintStr(" 0 R");
2551  PrintStr(" /P17");
2552  WriteInteger(patternNb++);
2553  PrintStr(" 0 R");
2554  PrintStr(" /P18");
2555  WriteInteger(patternNb++);
2556  PrintStr(" 0 R");
2557  PrintStr(" /P19");
2558  WriteInteger(patternNb++);
2559  PrintStr(" 0 R");
2560  PrintStr(" /P20");
2561  WriteInteger(patternNb++);
2562  PrintStr(" 0 R");
2563  PrintStr(" /P21");
2564  WriteInteger(patternNb++);
2565  PrintStr(" 0 R");
2566  PrintStr(" /P22");
2567  WriteInteger(patternNb++);
2568  PrintStr(" 0 R");
2569  PrintStr(" /P23");
2570  WriteInteger(patternNb++);
2571  PrintStr(" 0 R");
2572  PrintStr(" /P24");
2573  WriteInteger(patternNb++);
2574  PrintStr(" 0 R");
2575  PrintStr(" /P25");
2576  WriteInteger(patternNb++);
2577  PrintStr(" 0 R@");
2578  PrintStr(">>@");
2579  PrintStr("endobj@");
2580 
2581  patternNb = kObjPattern;
2582 
2583  // P01
2584  NewObject(patternNb++);
2585  PrintStr("<</Type/Pattern/Matrix[1 0 0 1 20 28]/PatternType 1/Resources");
2587  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 98 4]/XStep 98/YStep 4/Length 91/Filter/FlateDecode>>");
2588  PrintStr("@");
2589  fStream->write("stream",6); fNByte += 6;
2590  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301P\241\034(\254\340\253\020m\250\020k\240\220\302e\244`\242\220\313ei\t\244r\200\272\215A\034\v \225\003\2241\202\310\030\201e\f!2\206@N0W \027@\200\001\0|c\024\357\n", 93);
2591  fNByte += 93;
2592  PrintStr("endstream@");
2593  PrintStr("endobj@");
2594 
2595  // P02
2596  NewObject(patternNb++);
2597  PrintStr("<</Type/Pattern/Matrix[0.75 0 0 0.75 20 28]/PatternType 1/Resources");
2599  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 96 4]/XStep 96/YStep 4/Length 92/Filter/FlateDecode>>@");
2600  PrintStr("@");
2601  fStream->write("stream",6); fNByte += 6;
2602  fStream->write("\r\nH\211$\2121\n\2000\024C\367\234\"G\370\277\025\321+\b\016\342\340P\334tP\252\240\213\3277\332!\204\274\227\v\316\2150\032\335J\356\025\023O\241Np\247\363\021f\317\344\214\234\215\v\002+\036h\033U\326/~\243Ve\231PL\370\215\027\343\032#\006\274\002\f\0\242`\025:\n", 94);
2603  fNByte += 94;
2604  PrintStr("endstream@");
2605  PrintStr("endobj@");
2606 
2607  // P03
2608  NewObject(patternNb++);
2609  PrintStr("<</Type/Pattern/Matrix[0.5 0 0 0.5 20 28]/PatternType 1/Resources");
2611  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 96 16]/XStep 96/YStep 16/Length 93/Filter/FlateDecode>>@");
2612  PrintStr("@");
2613  fStream->write("stream",6); fNByte += 6;
2614  fStream->write("\r\nH\211$\2121\n\2000\024C\367\234\"G\370\261(\366\n\202\20388\210\233\016J\025t\361\372\376\332!\204\274\227\033\342N\030\215\262\222g\303\304\313Q\347\360\240\370:f\317Y\f\\\214+**\360Dls'\177\306\274\032\257\344\256.\252\376\215\212\221\217\021\003>\001\006\0\317\243\025\254\n", 95);
2615  fNByte += 95;
2616  PrintStr("endstream@");
2617  PrintStr("endobj@");
2618 
2619  // P04
2620  NewObject(patternNb++);
2621  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2623  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 63/Filter/FlateDecode>>");
2624  PrintStr("@");
2625  fStream->write("stream",6); fNByte += 6;
2626  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\002V\231\313\005S\233\303\025\314\025\310\005\020`\0\344\270\r\274\n", 65);
2627  fNByte += 65;
2628  PrintStr("endstream@");
2629  PrintStr("endobj@");
2630 
2631  // P05
2632  NewObject(patternNb++);
2633  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2635  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 66/Filter/FlateDecode>>");
2636  PrintStr("@");
2637  fStream->write("stream",6); fNByte += 6;
2638  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\302\005Q\223\313\005\"\r\024r\270\202\271\002\271\0\002\f\0\344\320\r\274\n", 68);
2639  fNByte += 68;
2640  PrintStr("endstream@");
2641  PrintStr("endobj@");
2642 
2643  // P06
2644  NewObject(patternNb++);
2645  PrintStr("<</Type/Pattern/Matrix[0.03 0 0 0.03 20 28]/PatternType 1/Resources");
2647  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 66/Filter/FlateDecode>>");
2648  PrintStr("@");
2649  fStream->write("stream",6); fNByte += 6;
2650  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\302e\nR\232\v\242@js\270\202\271\002\271\0\002\f\0\345X\r\305\n", 68);
2651  fNByte += 68;
2652  PrintStr("endstream@");
2653  PrintStr("endobj@");
2654 
2655  // P07
2656  NewObject(patternNb++);
2657  PrintStr("<</Type/Pattern/Matrix[0.03 0 0 0.03 20 28]/PatternType 1/Resources");
2659  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 68/Filter/FlateDecode>>");
2660  PrintStr("@");
2661  fStream->write("stream",6); fNByte += 6;
2662  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\002\02465P\310\345\002)\0042r\270\202\271\002\271\0\002\f\0\345=\r\305\n", 70);
2663  fNByte += 70;
2664  PrintStr("endstream@");
2665  PrintStr("endobj@");
2666 
2667  // P08
2668  NewObject(patternNb++);
2669  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2671  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 139/Filter/FlateDecode>>");
2672  PrintStr("@");
2673  fStream->write("stream",6); fNByte += 6;
2674  fStream->write("\r\nH\211D\217\261\016\3020\fDw\177\305\315L6Q\225|\003\022C\305\300Puk+\201\032$\272\360\373\330\265\323\016\271\330\367\234\344\"x\201\030\214\252\232\030+%\353VZ.jd\367\205\003x\241({]\311\324]\323|\342\006\033J\201:\306\325\230Jg\226J\261\275D\257#\337=\220\260\354k\233\351\211\217Z75\337\020\374\324\306\035\303\310\230\342x=\303\371\275\307o\332s\331\223\224\240G\330\a\365\364\027`\0\nX1}\n",141);
2675  fNByte += 141;
2676  PrintStr("endstream@");
2677  PrintStr("endobj@");
2678 
2679  // P09
2680  NewObject(patternNb++);
2681  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2683  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 108/Filter/FlateDecode>>");
2684  PrintStr("@");
2685  fStream->write("stream",6); fNByte += 6;
2686  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\002\02465P\310\005RFFz&\020\002,d\240\220\314en\256g\0065\b,\001b\230\202$\240\232\214@\362\246`\2169H\336\024\2426\231\v&\200,\n\326\030\314\025\310\005\020`\0\f@\036\227\n", 110);
2687  fNByte += 110;
2688  PrintStr("endstream@");
2689  PrintStr("endobj@");
2690 
2691  // P10
2692  NewObject(patternNb++);
2693  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2695  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 93/Filter/FlateDecode>>");
2696  PrintStr("@");
2697  fStream->write("stream",6); fNByte += 6;
2698  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\002\02465P\310\345\002)\0042r\200\332\r\241\\C \017dN.\027L\312\0\302\205\2535\205j6\205X\224\303\025\314\025\310\005\020`\0\2127\031\t\n", 95);
2699  fNByte += 95;
2700  PrintStr("endstream@");
2701  PrintStr("endobj@");
2702 
2703  // P11
2704  NewObject(patternNb++);
2705  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2707  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 164/Filter/FlateDecode>>");
2708  PrintStr("@");
2709  fStream->write("stream",6); fNByte += 6;
2710  fStream->write("\r\nH\211\\\2171\016\3020\fEw\237\342\037\301ip\223^\001\211\001u`@l0\200(\022,\\\037;v\204\332\241\211\336\373\337V\363\246\204;\210\301H\354\337\347F'\274T\355U>\220\360U\215\003\316\027\306\2655\027=\a\306\223\304I\002m\332\330\356&\030\325\333fZ\275F\337\205\235\265O\270\032\004\331\214\336\305\270\004\227`\357i\256\223\342;]\344\255(!\372\356\205j\030\377K\335\220\344\377\210\274\306\022\330\337T{\214,\212;\301\3508\006\346\206\021O=\216|\212|\246#\375\004\030\0\216FF\207\n", 166);
2711  fNByte += 166;
2712  PrintStr("endstream@");
2713  PrintStr("endobj@");
2714 
2715  // P12
2716  NewObject(patternNb++);
2717  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2719  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 226/Filter/FlateDecode>>");
2720  PrintStr("@");
2721  fStream->write("stream",6); fNByte += 6;
2722  fStream->write("\r\nH\211<P;n\3030\f\335y\n\236 \220DK\242\256P\240C\321\241C\221\311\311\220\242\016\220.\275~D\221/\203I\342}\370(?(\363\215)q\342\234\374\373\273\322\027\337'\3646\301\037\316\374?a~\347\357s\342\313\2045\361A9\237\322fc\231\200\236F\263\301\334;\211\017\207\rN\311\252S\\\227{\247\006w\207\244\303\255p+(\205\333\360e/v\356a\315\317\360\272\320b|w\276\203o\340k\b\004\027\v$b\226\235,\242\254t(\024\nu\305Vm\313\021\375\327\272\257\227fuf\226ju\356\222x\030\024\313\261S\215\377\341\274,\203\254\253Z\\\262A\262\205eD\350\210\320\201\225\212\320\036\241\355\025\372JE,\2266\344\366\310U\344\016HFx>\351\203\236\002\f\0d}e\216\n", 228);
2723  fNByte += 228;
2724  PrintStr("endstream@");
2725  PrintStr("endobj@");
2726 
2727  // P13
2728  NewObject(patternNb++);
2729  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2731  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 69/Filter/FlateDecode>>");
2732  PrintStr("@");
2733  fStream->write("stream",6); fNByte += 6;
2734  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\002V\231\313\005S\233\303\005\241!\" ~0W \027@\200\001\0\331\227\020\253\n", 71);
2735  fNByte += 71;
2736  PrintStr("endstream@");
2737  PrintStr("endobj@");
2738 
2739  // P14
2740  NewObject(patternNb++);
2741  PrintStr("<</Type/Pattern/Matrix[0.15 0 0 0.15 20 28]/PatternType 1/Resources");
2743  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 80/YStep 80/Length 114/Filter/FlateDecode>>");
2744  PrintStr("@");
2745  fStream->write("stream",6); fNByte += 6;
2746  fStream->write("\r\nH\2114\214=\n\2000\f\205\367\234\342\035!-\241\364\f\202\20388\210\233\016J+\350\342\365M\3723\224\327\367}I\036r8A\f\206\343\372\336\203\026\334\212\006\205\027\004\237b\214X7\306\256\33032\331\240~\022y[\315\026\206\222\372\330}\264\036\253\217\335\353\240\030\b%\223\245o=X\227\346\245\355K\341\345@\3613M\364\v0\0\207o\"\261\n", 116);
2747  fNByte += 116;
2748  PrintStr("endstream@");
2749  PrintStr("endobj@");
2750 
2751  // P15
2752  NewObject(patternNb++);
2753  PrintStr("<</Type/Pattern/Matrix[0.102 0 0 0.102 20 28]/PatternType 1/Resources");
2755  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 60 60]/XStep 60/YStep 60/Length 218/Filter/FlateDecode>>");
2756  PrintStr("@");
2757  fStream->write("stream",6); fNByte += 6;
2758  fStream->write("\r\nH\211<\2211\016\3020\fEw\237\302'@\211c\267w@b@\f\f\210\2510\200(\022,\\\037\347\307\256Z\325\221\375\337\377\225\363\241\312\017\246\302\205'\274\337;\235\371\355\215\275\267\236\\\371\307\265\360\201/\327\3027o\233\361J\262\233\247~\362g\336\211zur!A]{\035}\031S\343\006p\241\226dKI\v\326\202\265\3153\331)X)\335fE\205M\235\373\327\r*\374\026\252\022\216u\223\200\361I\211\177\031\022\001#``\342GI\211\004c\221gi\246\231\247\221\247\231\247\233$XM3\315<\215<\315<K\211e\036#\215a4\366\344\035lm\214Z\314b\211Xj\337K\\\201$\332\325\v\365\2659\204\362\242\274'\v\221\r\321\211\216\364\027`\0\212'_\215\n", 220);
2759  fNByte += 220;
2760  PrintStr("endstream@");
2761  PrintStr("endobj@");
2762 
2763  // P16
2764  NewObject(patternNb++);
2765  PrintStr("<</Type/Pattern/Matrix[0.1 0 0 0.05 20 28]/PatternType 1/Resources");
2767  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 123/Filter/FlateDecode>>");
2768  PrintStr("@");
2769  fStream->write("stream",6); fNByte += 6;
2770  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020\035k\240\220\302ej\240\0D\271 \332\314X\317B\301\330\002H\230\233*\030\231\202\310d.CC=#\020\v*\rV\235\214\254\v\210r@\264\261\031P\241\031H5D\253\021H\267\005\3104 \v\344\016\260\002\020\003lB0W \027@\200\001\0hU \305\n", 125);
2771  fNByte += 125;
2772  PrintStr("endstream@");
2773  PrintStr("endobj@");
2774 
2775  // P17
2776  NewObject(patternNb++);
2777  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2779  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 66/Filter/FlateDecode>>");
2780  PrintStr("@");
2781  fStream->write("stream",6); fNByte += 6;
2782  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020md\242\020k\240\220\002V\234\313\005S\236\303\025\314\025\310\005\020`\0\r\351\016B\n", 68);
2783  fNByte += 68;
2784  PrintStr("endstream@");
2785  PrintStr("endobj@");
2786 
2787  // P18
2788  NewObject(patternNb++);
2789  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2791  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 69/Filter/FlateDecode>>");
2792  PrintStr("@");
2793  fStream->write("stream",6); fNByte += 6;
2794  fStream->write("\r\nH\211*\3442T\310T\3402P0P04\200\340\242T\256p\205<\240\220\027P0K\301D\241\034(\254\340\253\020md\242\020k\240\220\302\005Q\226\313\005\"\r\024r\270\202\271\002\271\0\002\f\0\016\001\016B\n", 71);
2795  fNByte += 71;
2796  PrintStr("endstream@");
2797  PrintStr("endobj@");
2798 
2799  // P19
2800  NewObject(patternNb++);
2801  PrintStr("<</Type/Pattern/Matrix[0.117 0 0 0.117 20 28]/PatternType 1/Resources");
2803  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 149/Filter/FlateDecode>>");
2804  PrintStr("@");
2805  fStream->write("stream",6); fNByte += 6;
2806  fStream->write("\r\nH\211L\216;\016\302@\fD{\237bN\020\331+6a\257\200D\201((P\252@\001R\220\240\341\372\370\263\216(\326\266f\336\330\373&\301\003\304`\b\307\373\334\351\202\227J\a\025\237\020|U\306\021\327\231q\243\306\250\214\325\372T\006\336\367\032\262\326\205\3124\264b\243$\"n.\244=\314\250!\2139\033\327\022i=\323\317\2518\332T}\347.\202\346W\373\372j\315\221\344\266\213=\237\241\344\034\361\264!\236w\344\177\271o8\323\211~\002\f\0\366\3026\233\n", 151);
2807  fNByte += 151;
2808  PrintStr("endstream@");
2809  PrintStr("endobj@");
2810 
2811  // P20
2812  NewObject(patternNb++);
2813  PrintStr("<</Type/Pattern/Matrix[0.05 0 0 0.1 20 28]/PatternType 1/Resources");
2815  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 122/Filter/FlateDecode>>");
2816  PrintStr("@");
2817  fStream->write("stream",6); fNByte += 6;
2818  fStream->write("\r\nH\211<L;\016\2030\f\335}\212w\002\344$M\2323 1 \006\006\304\224vhU\220`\341\372<\aT\311\366\263\336o\023\207\017D\241pz\355\376\226\021+\251\226\344\027\017\034\244\321a\232\025/\211\n\316r\343ORh\262}\317\210\344\032o\310)\302\2233\245\252[m\274\332\313\277!$\332\371\371\210`N\242\267$\217\263\246\252W\257\245\006\351\345\024`\0o\347 \305\n", 124);
2819  fNByte += 124;
2820  PrintStr("endstream@");
2821  PrintStr("endobj@");
2822 
2823  // P21
2824  NewObject(patternNb++);
2825  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2827  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 117/Filter/FlateDecode>>");
2828  PrintStr("@");
2829  fStream->write("stream",6); fNByte += 6;
2830  fStream->write("\r\nH\211D\2151\n\2000\fE\367\234\342\037!)\224\336Ap\020\a\aq\323A\251\202.^\337$-\025\022^\372\033^n\022\354 \006CX\274\237\215&\\\032u\032\036\020\274\032\243\307\2740V]\027\234\024\242\"\033\2642En\324\312\224bc\262\\\230\377\301\332WM\224\212(U\221\375\265\301\025\016?\350\317P\215\221\033\213o\244\201>\001\006\0\031I'f\n", 119);
2831  fNByte += 119;
2832  PrintStr("endstream@");
2833  PrintStr("endobj@");
2834 
2835  // P22
2836  NewObject(patternNb++);
2837  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2839  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 118/Filter/FlateDecode>>");
2840  PrintStr("@");
2841  fStream->write("stream",6); fNByte += 6;
2842  fStream->write("\r\nH\211<\215=\n\204P\f\204\373\234b\216\220<\b\357\016\302\026ba!vZ(\273\v\332x}\223\274\237\"|\223a\230\271Hp\200\030\fa\211\273w\232\3617k0\363\204\3401\033\037,+c#\3170~\2244\304\327EV\243r\247\272oOcr\337\323]H\t\226\252\334\252r\255\362\257\213(\t\304\250\326\315T\267\032\275q\242\221^\001\006\0\272\367(&\n", 120);
2843  fNByte += 120;
2844  PrintStr("endstream@");
2845  PrintStr("endobj@");
2846 
2847  // P23
2848  NewObject(patternNb++);
2849  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2851  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 169/Filter/FlateDecode>>");
2852  PrintStr("@");
2853  fStream->write("stream",6); fNByte += 6;
2854  fStream->write("\r\nH\211<\220\273\n\0021\020E\373\371\212[[M\326\331\354\344\027\004\v\261\260\020;\025\224D\320\306\337w\036\254p\363\230\223\341$\344M\005\017\020\203Q8\307\347F'\274\f\355\f>Q\3605\214=\316\005\v.\214kt\217\230;)\324\366\245Fa\213e\320v\212r\022X\006\211Fi\3242\250J\224\302\020\367h\212\254I\\\325R\225o\03143\346U\235@a\t[\202Za\tA\202E`\351~O\002\235`\351~S\202\306h.m\253\264)\232K\217t\310\017q\354\a\353\247\364\377C\356\033\372\t0\0\bm:\375\n", 171);
2855  fNByte += 171;
2856  PrintStr("endstream@");
2857  PrintStr("endobj@");
2858 
2859  // P24
2860  NewObject(patternNb++);
2861  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2863  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 280/Filter/FlateDecode>>");
2864  PrintStr("@");
2865  fStream->write("stream",6); fNByte += 6;
2866  fStream->write("\r\nH\211DQ9N\004A\f\314\373\025\216\211\326\343v\037_@\"@\004\004\210\f\220@\003\022$|\177\335\345j\220v\345\251\303\343*\215\312\273\024\275\\d\375?\361dM\3162\306\337\214\337Y\336n\240m\217\036\301y\343\\<,i\250\0038F\035)\347l\322\026o\377\023\353|[\254\177\343\005;\315\317ky\224\257\240n\203\374\020\225\337\240\345N\236T\272<_\344\245\304^\3238\030\tc\236E\233xO\034\363\204>\251\317\324\233\023{\352\235\376\336S\357Fl\251\017\372\207\247>xoh&_\366Ud\331\253\314D\023\332\241\211\016\205\246\235\326\236*\275\307\204z8!s\031\335\306\\\306C\306\\\225\376\312\\\225\307\252\246\356\364\273Q\347\271:\371\341l\177\311e\210\3571\211\251#\374\302H\037:\342c\241\323\2617\320 \034\250\0\302\323a{\005%\302a\373(Zx\313\026\213@\215p\324}\026=\274e\217E8s\326}\026M\036\312}\271\n0\0\215\263\207\016\n", 282);
2867  fNByte += 282;
2868  PrintStr("endstream@");
2869  PrintStr("endobj@");
2870 
2871  // P25
2872  NewObject(patternNb++);
2873  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2875  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 54/Filter/FlateDecode>>");
2876  PrintStr("@");
2877  fStream->write("stream",6); fNByte += 6;
2878  fStream->write("\r\nH\2112T\310T\3402P0P\310\34526P\0\242\034.s\004m\016\242\r\r\f\024@\030\302\002\321iZP\305`M\346\310\212\201R\0\001\006\0\206\322\017\200\n", 56);
2879  fNByte += 56;
2880  PrintStr("endstream@");
2881  PrintStr("endobj@");
2882 }
TVirtualPS
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition: TVirtualPS.h:30
TPDF::fPageFormat
Int_t fPageFormat
Page format (A4, Letter etc ...)
Definition: TPDF.h:41
TPDF::Close
void Close(Option_t *opt="")
Close a PDF file.
Definition: TPDF.cxx:201
TAttLine::fLineColor
Color_t fLineColor
Line color.
Definition: TAttLine.h:21
TPDF::PrintFast
void PrintFast(Int_t nch, const char *string="")
Fast version of Print.
Definition: TPDF.cxx:1843
m
auto * m
Definition: textangle.C:8
TPDF::Text
void Text(Double_t x, Double_t y, const char *string)
Draw text.
Definition: TPDF.cxx:2167
n
const Int_t n
Definition: legend1.C:16
TPDF::SetLineStyle
void SetLineStyle(Style_t linestyle=1)
Change the line style.
Definition: TPDF.cxx:2115
TPDF::DrawPolyLineNDC
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition: TPDF.cxx:537
TPDF::VtoPDF
Double_t VtoPDF(Double_t v)
Convert V from NDC coordinate to PDF.
Definition: TPDF.cxx:2396
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:89
Style_t
short Style_t
Definition: RtypesCore.h:78
TDatime::GetHour
Int_t GetHour() const
Definition: TDatime.h:69
snprintf
#define snprintf
Definition: civetweb.c:1540
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
Option_t
const char Option_t
Definition: RtypesCore.h:64
kObjContents
const Int_t kObjContents
Definition: TPDF.cxx:85
TPDF::fgLineCap
static Int_t fgLineCap
Appearance of line caps.
Definition: TPDF.h:54
TMath::Max
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
TMath::Cos
Double_t Cos(Double_t)
Definition: TMath.h:631
TPDF::SetMarkerColor
void SetMarkerColor(Color_t cindex=1)
Set color index for markers.
Definition: TPDF.cxx:2147
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:361
Form
char * Form(const char *fmt,...)
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
TPDF::YtoPDF
Double_t YtoPDF(Double_t y)
Convert Y from world coordinate to PDF.
Definition: TPDF.cxx:2414
TObjString.h
TPDF::SetLineWidth
void SetLineWidth(Width_t linewidth=1)
Change the line width.
Definition: TPDF.cxx:2134
TDatime.h
kObjTransList
const Int_t kObjTransList
Definition: TPDF.cxx:90
TAttMarker::GetMarkerLineWidth
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
Definition: TAttMarker.cxx:297
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TAttText::fTextAlign
Short_t fTextAlign
Text alignment.
Definition: TAttText.h:23
TStyle::GetLineScalePS
Float_t GetLineScalePS() const
Definition: TStyle.h:278
TPDF::SetLineCap
void SetLineCap(Int_t linecap=0)
Set the value of the global parameter TPDF::fgLineCap.
Definition: TPDF.cxx:2100
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
TMath::Sqrt
Double_t Sqrt(Double_t x)
Definition: TMath.h:681
TDatime::GetSecond
Int_t GetSecond() const
Definition: TDatime.h:71
TPDF::fGreen
Float_t fGreen
Per cent of green.
Definition: TPDF.h:34
TPDF::SetLineColor
void SetLineColor(Color_t cindex=1)
Set color index for lines.
Definition: TPDF.cxx:2054
TPDF::DrawPolyMarker
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y)
Draw markers at the n WC points xw, yw.
Definition: TPDF.cxx:583
Float_t
float Float_t
Definition: RtypesCore.h:55
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TPDF::TextNDC
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition: TPDF.cxx:2367
TStyle.h
TPDF::CellArrayEnd
void CellArrayEnd()
End the Cell Array painting.
Definition: TPDF.cxx:193
Int_t
int Int_t
Definition: RtypesCore.h:43
TAttFill::fFillColor
Color_t fFillColor
Fill area color.
Definition: TAttFill.h:22
kObjPageResources
const Int_t kObjPageResources
Definition: TPDF.cxx:84
kObjPages
const Int_t kObjPages
Definition: TPDF.cxx:83
TAttText::SetTextSize
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
TPDF::CellArrayBegin
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
Begin the Cell Array painting.
Definition: TPDF.cxx:176
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
x
Double_t x[n]
Definition: legend1.C:17
TText::GetTextAdvance
virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const
Return text advance for string text if kern is true (default) kerning is taken into account.
Definition: TText.cxx:615
TClass.h
TAttText::fTextSize
Float_t fTextSize
Text size.
Definition: TAttText.h:22
TColor.h
TPDF::PatternEncode
void PatternEncode()
Patterns encoding.
Definition: TPDF.cxx:2486
TMath::Abs
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
TObjArray::At
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
TAttLine::fLineWidth
Width_t fLineWidth
Line width.
Definition: TAttLine.h:23
TAttText::fTextAngle
Float_t fTextAngle
Text angle.
Definition: TAttText.h:21
TString
Basic string class.
Definition: TString.h:131
TPDF::WriteReal
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
Definition: TPDF.cxx:2470
TPDF::fObjPos
Int_t * fObjPos
Objets position.
Definition: TPDF.h:45
TPDF::SetFillColor
void SetFillColor(Color_t cindex=1)
Set color index for fill areas.
Definition: TPDF.cxx:2008
Color_t
short Color_t
Definition: RtypesCore.h:81
TGeant4Unit::cm
static constexpr double cm
Definition: TGeant4SystemOfUnits.h:112
TColor::GetBlue
Float_t GetBlue() const
Definition: TColor.h:59
v
@ v
Definition: rootcling_impl.cxx:3624
kObjFont
const Int_t kObjFont
Definition: TPDF.cxx:86
TStyle::GetLineStyleString
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition: TStyle.cxx:1113
b
#define b(i)
Definition: RSha256.hxx:100
TColor::GetAlpha
Float_t GetAlpha() const
Definition: TColor.h:63
bool
TVirtualPS::PrintFast
virtual void PrintFast(Int_t nch, const char *string="")
Fast version of Print.
Definition: TVirtualPS.cxx:103
TPDF::DrawBox
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw a Box.
Definition: TPDF.cxx:353
TPDF::fgLineJoin
static Int_t fgLineJoin
Appearance of joining lines.
Definition: TPDF.h:53
TDatime::GetMinute
Int_t GetMinute() const
Definition: TDatime.h:70
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
xy
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
TPDF::UtoPDF
Double_t UtoPDF(Double_t u)
Convert U from NDC coordinate to PDF.
Definition: TPDF.cxx:2387
kObjFirstPage
const Int_t kObjFirstPage
Definition: TPDF.cxx:92
TROOT.h
TPDF::DrawFrame
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)
Draw a Frame around a box.
Definition: TPDF.cxx:419
TPDF
Interface to PDF.
Definition: TPDF.h:30
TObjString
Collectable string class.
Definition: TObjString.h:28
TPDF::SetLineScale
void SetLineScale(Float_t scale=1)
Definition: TPDF.h:97
TPDF::LineTo
void LineTo(Double_t x, Double_t y)
Draw a line to a new position.
Definition: TPDF.cxx:1409
TPDF::fLineScale
Float_t fLineScale
Line width scale factor.
Definition: TPDF.h:44
TAttText::fTextColor
Color_t fTextColor
Text color.
Definition: TAttText.h:24
TGeant4Unit::m2
static constexpr double m2
Definition: TGeant4SystemOfUnits.h:123
TMath::Pi
constexpr Double_t Pi()
Definition: TMath.h:38
TPDF::fYsize
Float_t fYsize
Page size along Y.
Definition: TPDF.h:39
TString::Tokenize
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2197
TPDF::fPageOrientation
Int_t fPageOrientation
Page orientation (Portrait, Landscape)
Definition: TPDF.h:42
TPDF::MoveTo
void MoveTo(Double_t x, Double_t y)
Move to a new position.
Definition: TPDF.cxx:1419
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:410
TPDF::Open
void Open(const char *filename, Int_t type=-111)
Open a PDF file.
Definition: TPDF.cxx:1653
TPDF::On
void On()
Activate an already open PDF file.
Definition: TPDF.cxx:1637
TColor
The color creation and management class.
Definition: TColor.h:19
TPDF::~TPDF
virtual ~TPDF()
Default PDF destructor.
Definition: TPDF.cxx:166
h
#define h(i)
Definition: RSha256.hxx:106
TPDF::SetFillPatterns
void SetFillPatterns(Int_t ipat, Int_t color)
Set the fill patterns (1 to 25) for fill areas.
Definition: TPDF.cxx:2017
TMath::Floor
Double_t Floor(Double_t x)
Definition: TMath.h:693
a
auto * a
Definition: textangle.C:12
Width_t
short Width_t
Definition: RtypesCore.h:80
TStorage.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:90
TVirtualPS::fLenBuffer
Int_t fLenBuffer
Definition: TVirtualPS.h:38
TPDF::SetTextColor
void SetTextColor(Color_t cindex=1)
Set color index for text.
Definition: TPDF.cxx:2155
TMath::Power
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:725
kObjPattern
const Int_t kObjPattern
Definition: TPDF.cxx:91
TStorage::ReAllocChar
static char * ReAllocChar(char *vp, size_t size, size_t oldsize)
Reallocate (i.e.
Definition: TStorage.cxx:265
TPDF::SetColor
void SetColor(Int_t color=1)
Set color with its color index.
Definition: TPDF.cxx:1935
TColor::GetRed
Float_t GetRed() const
Definition: TColor.h:57
TMath::Sin
Double_t Sin(Double_t)
Definition: TMath.h:627
TVirtualPad.h
TPDF::SetLineJoin
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TPDF::fgLineJoin.
Definition: TPDF.cxx:2076
TGeant4Unit::m3
static constexpr double m3
Definition: TGeant4SystemOfUnits.h:124
y
Double_t y[n]
Definition: legend1.C:17
kObjInfo
const Int_t kObjInfo
Definition: TPDF.cxx:81
TVirtualPS::fNByte
Int_t fNByte
Definition: TVirtualPS.h:37
TPDF::TPDF
TPDF()
Default PDF constructor.
Definition: TPDF.cxx:105
kNumberOfFonts
const Int_t kNumberOfFonts
Definition: TPDF.cxx:95
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TPDF::PrintStr
void PrintStr(const char *string="")
Output the string str in the output buffer.
Definition: TPDF.cxx:1821
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:877
kScale
const Float_t kScale
Definition: TPDF.cxx:77
TPDF::fXsize
Float_t fXsize
Page size along X.
Definition: TPDF.h:38
TMath::Min
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
TPDF::DrawPS
void DrawPS(Int_t n, Float_t *xw, Float_t *yw)
Draw a PolyLine.
Definition: TPDF.cxx:1211
unsigned int
TPDF::fCompress
Bool_t fCompress
True when fBuffer must be compressed.
Definition: TPDF.h:50
TAttMarker::GetMarkerStyleBase
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
Definition: TAttMarker.cxx:246
TVirtualPS::PrintStr
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
Definition: TVirtualPS.cxx:72
gVirtualPS
R__EXTERN TVirtualPS * gVirtualPS
Definition: TVirtualPS.h:81
TPDF::WriteCompressedBuffer
void WriteCompressedBuffer()
Write the buffer in a compressed way.
Definition: TPDF.cxx:2423
TPoints.h
TText
Base class for several text objects.
Definition: TText.h:23
Double_t
double Double_t
Definition: RtypesCore.h:57
TPDF::XtoPDF
Double_t XtoPDF(Double_t x)
Convert X from world coordinate to PDF.
Definition: TPDF.cxx:2405
TText::GetTextExtent
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
Definition: TText.cxx:587
TPDF::fType
Int_t fType
Workstation type used to know if the PDF is open.
Definition: TPDF.h:40
TPDF::DrawHatch
void DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t *x, Float_t *y)
Draw Fill area with hatch styles.
Definition: TPDF.cxx:459
TPDF::fStartStream
Int_t fStartStream
Definition: TPDF.h:43
TObjArray.h
TPDF::fNbObj
Int_t fNbObj
Number of objects.
Definition: TPDF.h:47
TPDF::fObjPosSize
Int_t fObjPosSize
Real size of fObjPos.
Definition: TPDF.h:46
TVirtualPS::fBuffer
char * fBuffer
Definition: TVirtualPS.h:42
kObjPatternList
const Int_t kObjPatternList
Definition: TPDF.cxx:89
kObjOutlines
const Int_t kObjOutlines
Definition: TPDF.cxx:82
TPDF::FontEncode
void FontEncode()
Font encoding.
Definition: TPDF.cxx:1377
TPDF::fPageNotEmpty
Bool_t fPageNotEmpty
True if the current page is not empty.
Definition: TPDF.h:49
TStyle::GetCapLinePS
Int_t GetCapLinePS() const
Returns the line cap method used for PostScript, PDF and SVG output. See TPostScript::SetLineCap for ...
Definition: TStyle.h:277
TPDF::SetAlpha
void SetAlpha(Float_t alpha=1.)
Set the alpha channel value.
Definition: TPDF.cxx:1915
TPDF::Off
void Off()
Deactivate an already open PDF file.
Definition: TPDF.cxx:1629
TAttMarker::fMarkerColor
Color_t fMarkerColor
Marker color.
Definition: TAttMarker.h:22
TPDF::NewPage
void NewPage()
Start a new PDF page.
Definition: TPDF.cxx:1452
TPDF::fBlue
Float_t fBlue
Per cent of blue.
Definition: TPDF.h:35
TPDF::fNbPage
Int_t fNbPage
Number of pages.
Definition: TPDF.h:48
TPDF::fRange
Bool_t fRange
True when a range has been defined.
Definition: TPDF.h:51
kObjColorSpace
const Int_t kObjColorSpace
Definition: TPDF.cxx:87
TVirtualPS::fSizBuffer
Int_t fSizBuffer
Definition: TVirtualPS.h:39
TAttText::fTextFont
Font_t fTextFont
Text font.
Definition: TAttText.h:25
TAttFill::fFillStyle
Style_t fFillStyle
Fill area style.
Definition: TAttFill.h:23
TAttMarker::fMarkerStyle
Style_t fMarkerStyle
Marker style.
Definition: TAttMarker.h:23
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
gPad
#define gPad
Definition: TVirtualPad.h:287
TAttFill::GetFillColor
virtual Color_t GetFillColor() const
Return the fill area color.
Definition: TAttFill.h:30
TStyle::GetColorModelPS
Int_t GetColorModelPS() const
Definition: TStyle.h:186
TDatime::GetDay
Int_t GetDay() const
Definition: TDatime.h:67
TPDF::fAlpha
Float_t fAlpha
Per cent of transparency.
Definition: TPDF.h:36
TDatime
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:37
TPDF::fAlphas
std::vector< float > fAlphas
List of alpha values used.
Definition: TPDF.h:37
TStyle::GetJoinLinePS
Int_t GetJoinLinePS() const
Returns the line join method used for PostScript, PDF and SVG output. See TPostScript::SetLineJoin fo...
Definition: TStyle.h:276
TGeant4Unit::ms
static constexpr double ms
Definition: TGeant4SystemOfUnits.h:163
TDatime::Convert
UInt_t Convert(Bool_t toGMT=kFALSE) const
Convert fDatime from TDatime format to the standard time_t format.
Definition: TDatime.cxx:181
TPDF::Range
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition: TPDF.cxx:1862
TDatime::GetMonth
Int_t GetMonth() const
Definition: TDatime.h:66
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
TPDF::DrawPolyLine
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition: TPDF.cxx:483
TAttLine::fLineStyle
Style_t fLineStyle
Line style.
Definition: TAttLine.h:22
TPDF::CMtoPDF
Double_t CMtoPDF(Double_t u)
Definition: TPDF.h:65
TAttMarker::fMarkerSize
Size_t fMarkerSize
Marker size.
Definition: TAttMarker.h:24
TPDF.h
Riostream.h
kerning
TCanvas * kerning()
Definition: kerning.C:1
TPDF::CellArrayFill
void CellArrayFill(Int_t r, Int_t g, Int_t b)
Paint the Cell Array.
Definition: TPDF.cxx:185
TColor::GetGreen
Float_t GetGreen() const
Definition: TColor.h:58
TAttText::SetTextFont
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:45
TText.h
TPDF::fRed
Float_t fRed
Per cent of red.
Definition: TPDF.h:33
TVirtualPS::WriteInteger
virtual void WriteInteger(Int_t i, Bool_t space=kTRUE)
Write one Integer to the file.
Definition: TVirtualPS.cxx:170
TStyle::GetPaperSize
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
Definition: TStyle.cxx:1131
kObjRoot
const Int_t kObjRoot
Definition: TPDF.cxx:80
TPDF::NewObject
void NewObject(Int_t n)
Create a new object in the PDF file.
Definition: TPDF.cxx:1429
TMath.h
kObjPatternResourses
const Int_t kObjPatternResourses
Definition: TPDF.cxx:88
gROOT
#define gROOT
Definition: TROOT.h:406
int
TVirtualPS::fStream
std::ofstream * fStream
Definition: TVirtualPS.h:41
TDatime::GetYear
Int_t GetYear() const
Definition: TDatime.h:65
TPoints
2-D graphics point (world coordinates).
Definition: TPoints.h:19
g
#define g(i)
Definition: RSha256.hxx:105