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 <cstdlib>
57 #include <cstring>
58 #include <cctype>
59 #include <fstream>
60 
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 "TObjArray.h"
74 #include "snprintf.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  fXsize = xsize;
1865  fYsize = ysize;
1866  fRange = kTRUE;
1867 }
1868 
1869 ////////////////////////////////////////////////////////////////////////////////
1870 /// Set the alpha channel value.
1871 
1873 {
1874  if (a == fAlpha) return;
1875  fAlpha = a;
1876  if (fAlpha <= 0.000001) fAlpha = 0;
1877 
1878  Bool_t known = kFALSE;
1879  for (int i=0; i<(int)fAlphas.size(); i++) {
1880  if (fAlpha == fAlphas[i]) {
1881  known = kTRUE;
1882  break;
1883  }
1884  }
1885  if (!known) fAlphas.push_back(fAlpha);
1886  PrintStr(Form(" /ca%3.2f gs /CA%3.2f gs",fAlpha,fAlpha));
1887 }
1888 
1889 ////////////////////////////////////////////////////////////////////////////////
1890 /// Set color with its color index.
1891 
1893 {
1894  if (color < 0) color = 0;
1895  TColor *col = gROOT->GetColor(color);
1896 
1897  if (col) {
1898  SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
1899  SetAlpha(col->GetAlpha());
1900  } else {
1901  SetColor(1., 1., 1.);
1902  SetAlpha(1.);
1903  }
1904 }
1905 
1906 ////////////////////////////////////////////////////////////////////////////////
1907 /// Set color with its R G B components:
1908 ///
1909 /// - r: % of red in [0,1]
1910 /// - g: % of green in [0,1]
1911 /// - b: % of blue in [0,1]
1912 
1914 {
1915  if (r == fRed && g == fGreen && b == fBlue) return;
1916 
1917  fRed = r;
1918  fGreen = g;
1919  fBlue = b;
1920  if (fRed <= 0.000001) fRed = 0;
1921  if (fGreen <= 0.000001) fGreen = 0;
1922  if (fBlue <= 0.000001) fBlue = 0;
1923 
1924  if (gStyle->GetColorModelPS()) {
1925  Double_t colCyan, colMagenta, colYellow;
1926  Double_t colBlack = TMath::Min(TMath::Min(1-fRed,1-fGreen),1-fBlue);
1927  if (colBlack==1) {
1928  colCyan = 0;
1929  colMagenta = 0;
1930  colYellow = 0;
1931  } else {
1932  colCyan = (1-fRed-colBlack)/(1-colBlack);
1933  colMagenta = (1-fGreen-colBlack)/(1-colBlack);
1934  colYellow = (1-fBlue-colBlack)/(1-colBlack);
1935  }
1936  if (colCyan <= 0.000001) colCyan = 0;
1937  if (colMagenta <= 0.000001) colMagenta = 0;
1938  if (colYellow <= 0.000001) colYellow = 0;
1939  if (colBlack <= 0.000001) colBlack = 0;
1940  WriteReal(colCyan);
1941  WriteReal(colMagenta);
1942  WriteReal(colYellow);
1943  WriteReal(colBlack);
1944  PrintFast(2," K");
1945  WriteReal(colCyan);
1946  WriteReal(colMagenta);
1947  WriteReal(colYellow);
1948  WriteReal(colBlack);
1949  PrintFast(2," k");
1950  } else {
1951  WriteReal(fRed);
1952  WriteReal(fGreen);
1953  WriteReal(fBlue);
1954  PrintFast(3," RG");
1955  WriteReal(fRed);
1956  WriteReal(fGreen);
1957  WriteReal(fBlue);
1958  PrintFast(3," rg");
1959  }
1960 }
1961 
1962 ////////////////////////////////////////////////////////////////////////////////
1963 /// Set color index for fill areas
1964 
1966 {
1967  fFillColor = cindex;
1968 }
1969 
1970 ////////////////////////////////////////////////////////////////////////////////
1971 /// Set the fill patterns (1 to 25) for fill areas
1972 
1974 {
1975  char cpat[10];
1976  TColor *col = gROOT->GetColor(color);
1977  if (!col) return;
1978  PrintStr(" /Cs8 cs");
1979  Double_t colRed = col->GetRed();
1980  Double_t colGreen = col->GetGreen();
1981  Double_t colBlue = col->GetBlue();
1982  if (gStyle->GetColorModelPS()) {
1983  Double_t colBlack = TMath::Min(TMath::Min(1-colRed,1-colGreen),1-colBlue);
1984  if (colBlack==1) {
1985  WriteReal(0);
1986  WriteReal(0);
1987  WriteReal(0);
1988  WriteReal(colBlack);
1989  } else {
1990  Double_t colCyan = (1-colRed-colBlack)/(1-colBlack);
1991  Double_t colMagenta = (1-colGreen-colBlack)/(1-colBlack);
1992  Double_t colYellow = (1-colBlue-colBlack)/(1-colBlack);
1993  WriteReal(colCyan);
1994  WriteReal(colMagenta);
1995  WriteReal(colYellow);
1996  WriteReal(colBlack);
1997  }
1998  } else {
1999  WriteReal(colRed);
2000  WriteReal(colGreen);
2001  WriteReal(colBlue);
2002  }
2003  snprintf(cpat,10," /P%2.2d scn", ipat);
2004  PrintStr(cpat);
2005 }
2006 
2007 ////////////////////////////////////////////////////////////////////////////////
2008 /// Set color index for lines
2009 
2011 {
2012  fLineColor = cindex;
2013 }
2014 
2015 ////////////////////////////////////////////////////////////////////////////////
2016 /// Set the value of the global parameter TPDF::fgLineJoin.
2017 /// This parameter determines the appearance of joining lines in a PDF
2018 /// output.
2019 /// It takes one argument which may be:
2020 /// - 0 (miter join)
2021 /// - 1 (round join)
2022 /// - 2 (bevel join)
2023 /// The default value is 0 (miter join).
2024 ///
2025 /// \image html postscript_1.png
2026 ///
2027 /// To change the line join behaviour just do:
2028 /// ~~~ {.cpp}
2029 /// gStyle->SetJoinLinePS(2); // Set the PDF line join to bevel.
2030 /// ~~~
2031 
2032 void TPDF::SetLineJoin( Int_t linejoin )
2033 {
2034  fgLineJoin = linejoin;
2035  if (fgLineJoin<0) fgLineJoin=0;
2036  if (fgLineJoin>2) fgLineJoin=2;
2037 }
2038 
2039 ////////////////////////////////////////////////////////////////////////////////
2040 /// Set the value of the global parameter TPDF::fgLineCap.
2041 /// This parameter determines the appearance of line caps in a PDF
2042 /// output.
2043 /// It takes one argument which may be:
2044 /// - 0 (butt caps)
2045 /// - 1 (round caps)
2046 /// - 2 (projecting caps)
2047 /// The default value is 0 (butt caps).
2048 ///
2049 /// \image html postscript_2.png
2050 ///
2051 /// To change the line cap behaviour just do:
2052 /// ~~~ {.cpp}
2053 /// gStyle->SetCapLinePS(2); // Set the PDF line cap to projecting.
2054 /// ~~~
2055 
2056 void TPDF::SetLineCap( Int_t linecap )
2057 {
2058  fgLineCap = linecap;
2059  if (fgLineCap<0) fgLineCap=0;
2060  if (fgLineCap>2) fgLineCap=2;
2061 }
2062 
2063 ////////////////////////////////////////////////////////////////////////////////
2064 /// Change the line style
2065 ///
2066 /// - linestyle = 2 dashed
2067 /// - linestyle = 3 dotted
2068 /// - linestyle = 4 dash-dotted
2069 /// - linestyle = else solid (1 in is used most of the time)
2070 
2072 {
2073  if ( linestyle == fLineStyle) return;
2074  fLineStyle = linestyle;
2075  TString st = (TString)gStyle->GetLineStyleString(linestyle);
2076  PrintFast(2," [");
2077  TObjArray *tokens = st.Tokenize(" ");
2078  for (Int_t j = 0; j<tokens->GetEntries(); j++) {
2079  Int_t it;
2080  sscanf(((TObjString*)tokens->At(j))->GetName(), "%d", &it);
2081  WriteInteger((Int_t)(it/4));
2082  }
2083  delete tokens;
2084  PrintFast(5,"] 0 d");
2085 }
2086 
2087 ////////////////////////////////////////////////////////////////////////////////
2088 /// Change the line width
2089 
2091 {
2092  if (linewidth == fLineWidth) return;
2093  fLineWidth = linewidth;
2094  if (fLineWidth!=0) {
2096  PrintFast(2," w");
2097  }
2098 }
2099 
2100 ////////////////////////////////////////////////////////////////////////////////
2101 /// Set color index for markers.
2102 
2104 {
2105  fMarkerColor = cindex;
2106 }
2107 
2108 ////////////////////////////////////////////////////////////////////////////////
2109 /// Set color index for text
2110 
2112 {
2113  fTextColor = cindex;
2114 }
2115 
2116 ////////////////////////////////////////////////////////////////////////////////
2117 /// Draw text
2118 ///
2119 /// - xx: x position of the text
2120 /// - yy: y position of the text
2121 /// - chars: text to be drawn
2122 
2123 void TPDF::Text(Double_t xx, Double_t yy, const char *chars)
2124 {
2125  if (fTextSize <= 0) return;
2126 
2127  const Double_t kDEGRAD = TMath::Pi()/180.;
2128  char str[8];
2129  Double_t x = xx;
2130  Double_t y = yy;
2131 
2132  // Font and text size
2133  Int_t font = abs(fTextFont)/10;
2134  if (font > kNumberOfFonts || font < 1) font = 1;
2135 
2136  Double_t wh = (Double_t)gPad->XtoPixel(gPad->GetX2());
2137  Double_t hh = (Double_t)gPad->YtoPixel(gPad->GetY1());
2138  Float_t tsize, ftsize;
2139  if (wh < hh) {
2140  tsize = fTextSize*wh;
2141  Int_t sizeTTF = (Int_t)(tsize*kScale+0.5); // TTF size
2142  ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
2143  } else {
2144  tsize = fTextSize*hh;
2145  Int_t sizeTTF = (Int_t)(tsize*kScale+0.5); // TTF size
2146  ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
2147  }
2148  Double_t fontsize = 72*(ftsize)/2.54;
2149  if (fontsize <= 0) return;
2150 
2151  // Text color
2153 
2154  // Clipping
2155  PrintStr(" q");
2156  Double_t x1 = XtoPDF(gPad->GetX1());
2157  Double_t x2 = XtoPDF(gPad->GetX2());
2158  Double_t y1 = YtoPDF(gPad->GetY1());
2159  Double_t y2 = YtoPDF(gPad->GetY2());
2160  WriteReal(x1);
2161  WriteReal(y1);
2162  WriteReal(x2 - x1);
2163  WriteReal(y2 - y1);
2164  PrintStr(" re W n");
2165 
2166  // Start the text
2167  if (!fCompress) PrintStr("@");
2168 
2169  // Text alignment
2170  Float_t tsizex = gPad->AbsPixeltoX(Int_t(tsize))-gPad->AbsPixeltoX(0);
2171  Float_t tsizey = gPad->AbsPixeltoY(0)-gPad->AbsPixeltoY(Int_t(tsize));
2172  Int_t txalh = fTextAlign/10;
2173  if (txalh < 1) txalh = 1; else if (txalh > 3) txalh = 3;
2174  Int_t txalv = fTextAlign%10;
2175  if (txalv < 1) txalv = 1; else if (txalv > 3) txalv = 3;
2176  if (txalv == 3) {
2177  y -= 0.8*tsizey*TMath::Cos(kDEGRAD*fTextAngle);
2178  x += 0.8*tsizex*TMath::Sin(kDEGRAD*fTextAngle);
2179  } else if (txalv == 2) {
2180  y -= 0.4*tsizey*TMath::Cos(kDEGRAD*fTextAngle);
2181  x += 0.4*tsizex*TMath::Sin(kDEGRAD*fTextAngle);
2182  }
2183 
2184  if (txalh > 1) {
2185  TText t;
2186  UInt_t w=0, h;
2189  t.GetTextExtent(w, h, chars);
2190  Double_t twx = gPad->AbsPixeltoX(w)-gPad->AbsPixeltoX(0);
2191  Double_t twy = gPad->AbsPixeltoY(0)-gPad->AbsPixeltoY(w);
2192  if (txalh == 2) {
2193  x = x-(twx/2)*TMath::Cos(kDEGRAD*fTextAngle);
2194  y = y-(twy/2)*TMath::Sin(kDEGRAD*fTextAngle);
2195  }
2196  if (txalh == 3) {
2197  x = x-twx*TMath::Cos(kDEGRAD*fTextAngle);
2198  y = y-twy*TMath::Sin(kDEGRAD*fTextAngle);
2199  }
2200  }
2201 
2202  // Text angle
2203  if (fTextAngle == 0) {
2204  PrintStr(" 1 0 0 1");
2205  WriteReal(XtoPDF(x));
2206  WriteReal(YtoPDF(y));
2207  } else if (fTextAngle == 90) {
2208  PrintStr(" 0 1 -1 0");
2209  WriteReal(XtoPDF(x));
2210  WriteReal(YtoPDF(y));
2211  } else if (fTextAngle == 270) {
2212  PrintStr(" 0 -1 1 0");
2213  WriteReal(XtoPDF(x));
2214  WriteReal(YtoPDF(y));
2215  } else {
2216  WriteReal(TMath::Cos(kDEGRAD*fTextAngle));
2217  WriteReal(TMath::Sin(kDEGRAD*fTextAngle));
2218  WriteReal(-TMath::Sin(kDEGRAD*fTextAngle));
2219  WriteReal(TMath::Cos(kDEGRAD*fTextAngle));
2220  WriteReal(XtoPDF(x));
2221  WriteReal(YtoPDF(y));
2222  }
2223  PrintStr(" cm");
2224 
2225  // Symbol Italic tan(15) = .26794
2226  if (font == 15) PrintStr(" 1 0 0.26794 1 0 0 cm");
2227 
2228  PrintStr(" BT");
2229 
2230  snprintf(str,8," /F%d",font);
2231  PrintStr(str);
2232  WriteReal(fontsize);
2233  PrintStr(" Tf");
2234 
2235  const Int_t len=strlen(chars);
2236 
2237  // Calculate the individual character placements.
2238  // Otherwise, if a string is printed in one line the kerning is not
2239  // performed. In order to measure the precise character positions we need to
2240  // trick FreeType into rendering high-resolution characters otherwise it will
2241  // stick to the screen pixel grid which is far worse than we can achieve on
2242  // print.
2243  const Float_t scale = 16.0;
2244  // Save current text attributes.
2245  TText saveAttText;
2246  saveAttText.TAttText::operator=(*this);
2247  TText t;
2248  t.SetTextSize(fTextSize * scale);
2250  UInt_t wa1=0, wa0=0;
2251  t.GetTextAdvance(wa0, chars, kFALSE);
2252  t.GetTextAdvance(wa1, chars);
2253  t.TAttText::Modify();
2254  Bool_t kerning;
2255  if (wa0-wa1 != 0) kerning = kTRUE;
2256  else kerning = kFALSE;
2257  Int_t *charDeltas = 0;
2258  if (kerning) {
2259  charDeltas = new Int_t[len];
2260  for (Int_t i = 0;i < len;i++) {
2261  UInt_t ww=0;
2262  t.GetTextAdvance(ww, chars + i);
2263  charDeltas[i] = wa1 - ww;
2264  }
2265  for (Int_t i = len - 1;i > 0;i--) {
2266  charDeltas[i] -= charDeltas[i-1];
2267  }
2268  char tmp[2];
2269  tmp[1] = 0;
2270  for (Int_t i = 1;i < len;i++) {
2271  tmp[0] = chars[i-1];
2272  UInt_t width=0;
2273  t.GetTextAdvance(width, &tmp[0], kFALSE);
2274  Double_t wwl = gPad->AbsPixeltoX(width - charDeltas[i]) - gPad->AbsPixeltoX(0);
2275  wwl -= 0.5*(gPad->AbsPixeltoX(1) - gPad->AbsPixeltoX(0)); // half a pixel ~ rounding error
2276  charDeltas[i] = (Int_t)((1000.0/Float_t(fontsize))*(XtoPDF(wwl) - XtoPDF(0))/scale);
2277  }
2278  }
2279  // Restore text attributes.
2280  saveAttText.TAttText::Modify();
2281 
2282  // Output the text. Escape some characters if needed
2283  if (kerning) PrintStr(" [");
2284  else PrintStr(" (");
2285 
2286  for (Int_t i=0; i<len;i++) {
2287  if (chars[i]!='\n') {
2288  if (kerning) PrintStr("(");
2289  if (chars[i]=='(' || chars[i]==')') {
2290  snprintf(str,8,"\\%c",chars[i]);
2291  } else {
2292  snprintf(str,8,"%c",chars[i]);
2293  }
2294  PrintStr(str);
2295  if (kerning) {
2296  PrintStr(") ");
2297  if (i < len-1) {
2298  WriteInteger(charDeltas[i+1]);
2299  }
2300  }
2301  }
2302  }
2303 
2304  if (kerning) PrintStr("] TJ ET Q");
2305  else PrintStr(") Tj ET Q");
2306  if (!fCompress) PrintStr("@");
2307  if (kerning) delete [] charDeltas;
2308 }
2309 
2310 ////////////////////////////////////////////////////////////////////////////////
2311 /// Write a string of characters
2312 ///
2313 /// This method writes the string chars into a PDF file
2314 /// at position xx,yy in world coordinates.
2315 
2316 void TPDF::Text(Double_t, Double_t, const wchar_t *)
2317 {
2318 }
2319 
2320 ////////////////////////////////////////////////////////////////////////////////
2321 /// Write a string of characters in NDC
2322 
2323 void TPDF::TextNDC(Double_t u, Double_t v, const char *chars)
2324 {
2325  Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
2326  Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
2327  Text(x, y, chars);
2328 }
2329 
2330 ////////////////////////////////////////////////////////////////////////////////
2331 /// Write a string of characters in NDC
2332 
2333 void TPDF::TextNDC(Double_t u, Double_t v, const wchar_t *chars)
2334 {
2335  Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
2336  Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
2337  Text(x, y, chars);
2338 }
2339 
2340 ////////////////////////////////////////////////////////////////////////////////
2341 /// Convert U from NDC coordinate to PDF
2342 
2344 {
2345  Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
2346  return 72*cm/2.54;
2347 }
2348 
2349 ////////////////////////////////////////////////////////////////////////////////
2350 /// Convert V from NDC coordinate to PDF
2351 
2353 {
2354  Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
2355  return 72*cm/2.54;
2356 }
2357 
2358 ////////////////////////////////////////////////////////////////////////////////
2359 /// Convert X from world coordinate to PDF
2360 
2362 {
2363  Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
2364  return UtoPDF(u);
2365 }
2366 
2367 ////////////////////////////////////////////////////////////////////////////////
2368 /// Convert Y from world coordinate to PDF
2369 
2371 {
2372  Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
2373  return VtoPDF(v);
2374 }
2375 
2376 ////////////////////////////////////////////////////////////////////////////////
2377 /// Write the buffer in a compressed way
2378 
2380 {
2381  z_stream stream;
2382  int err;
2383  char *out = new char[2*fLenBuffer];
2384 
2385  stream.next_in = (Bytef*)fBuffer;
2386  stream.avail_in = (uInt)fLenBuffer;
2387  stream.next_out = (Bytef*)out;
2388  stream.avail_out = (uInt)2*fLenBuffer;
2389  stream.zalloc = (alloc_func)0;
2390  stream.zfree = (free_func)0;
2391  stream.opaque = (voidpf)0;
2392 
2393  err = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
2394  if (err != Z_OK) {
2395  Error("WriteCompressedBuffer", "error in deflateInit (zlib)");
2396  delete [] out;
2397  return;
2398  }
2399 
2400  err = deflate(&stream, Z_FINISH);
2401  if (err != Z_STREAM_END) {
2402  deflateEnd(&stream);
2403  Error("WriteCompressedBuffer", "error in deflate (zlib)");
2404  delete [] out;
2405  return;
2406  }
2407 
2408  err = deflateEnd(&stream);
2409  if (err != Z_OK) {
2410  Error("WriteCompressedBuffer", "error in deflateEnd (zlib)");
2411  }
2412 
2413  fStream->write(out, stream.total_out);
2414 
2415  fNByte += stream.total_out;
2416  fStream->write("\n",1); fNByte++;
2417  fLenBuffer = 0;
2418  delete [] out;
2419  fCompress = kFALSE;
2420 }
2421 
2422 ////////////////////////////////////////////////////////////////////////////////
2423 /// Write a Real number to the file.
2424 /// This method overwrites TVirtualPS::WriteReal. Some PDF reader like
2425 /// Acrobat do not work when a PDF file contains reals with exponent. This
2426 /// method writes the real number "z" using the format "%f" instead of the
2427 /// format "%g" when writing it with "%g" generates a number with exponent.
2428 
2430 {
2431  char str[15];
2432  if (space) {
2433  snprintf(str,15," %g", z);
2434  if (strstr(str,"e") || strstr(str,"E")) snprintf(str,15," %10.8f", z);
2435  } else {
2436  snprintf(str,15,"%g", z);
2437  if (strstr(str,"e") || strstr(str,"E")) snprintf(str,15,"%10.8f", z);
2438  }
2439  PrintStr(str);
2440 }
2441 
2442 ////////////////////////////////////////////////////////////////////////////////
2443 /// Patterns encoding
2444 
2446 {
2447  Int_t patternNb = kObjPattern;
2448 
2450  if (gStyle->GetColorModelPS()) {
2451  PrintStr("[/Pattern /DeviceCMYK]@");
2452  } else {
2453  PrintStr("[/Pattern /DeviceRGB]@");
2454  }
2455  PrintStr("endobj@");
2457  PrintStr("<</ProcSet[/PDF]>>@");
2458  PrintStr("endobj@");
2459 
2461  PrintStr("<<@");
2462  PrintStr(" /P01");
2463  WriteInteger(patternNb++);
2464  PrintStr(" 0 R");
2465  PrintStr(" /P02");
2466  WriteInteger(patternNb++);
2467  PrintStr(" 0 R");
2468  PrintStr(" /P03");
2469  WriteInteger(patternNb++);
2470  PrintStr(" 0 R");
2471  PrintStr(" /P04");
2472  WriteInteger(patternNb++);
2473  PrintStr(" 0 R");
2474  PrintStr(" /P05");
2475  WriteInteger(patternNb++);
2476  PrintStr(" 0 R");
2477  PrintStr(" /P06");
2478  WriteInteger(patternNb++);
2479  PrintStr(" 0 R");
2480  PrintStr(" /P07");
2481  WriteInteger(patternNb++);
2482  PrintStr(" 0 R");
2483  PrintStr(" /P08");
2484  WriteInteger(patternNb++);
2485  PrintStr(" 0 R");
2486  PrintStr(" /P09");
2487  WriteInteger(patternNb++);
2488  PrintStr(" 0 R");
2489  PrintStr(" /P10");
2490  WriteInteger(patternNb++);
2491  PrintStr(" 0 R");
2492  PrintStr(" /P11");
2493  WriteInteger(patternNb++);
2494  PrintStr(" 0 R");
2495  PrintStr(" /P12");
2496  WriteInteger(patternNb++);
2497  PrintStr(" 0 R");
2498  PrintStr(" /P13");
2499  WriteInteger(patternNb++);
2500  PrintStr(" 0 R");
2501  PrintStr(" /P14");
2502  WriteInteger(patternNb++);
2503  PrintStr(" 0 R");
2504  PrintStr(" /P15");
2505  WriteInteger(patternNb++);
2506  PrintStr(" 0 R");
2507  PrintStr(" /P16");
2508  WriteInteger(patternNb++);
2509  PrintStr(" 0 R");
2510  PrintStr(" /P17");
2511  WriteInteger(patternNb++);
2512  PrintStr(" 0 R");
2513  PrintStr(" /P18");
2514  WriteInteger(patternNb++);
2515  PrintStr(" 0 R");
2516  PrintStr(" /P19");
2517  WriteInteger(patternNb++);
2518  PrintStr(" 0 R");
2519  PrintStr(" /P20");
2520  WriteInteger(patternNb++);
2521  PrintStr(" 0 R");
2522  PrintStr(" /P21");
2523  WriteInteger(patternNb++);
2524  PrintStr(" 0 R");
2525  PrintStr(" /P22");
2526  WriteInteger(patternNb++);
2527  PrintStr(" 0 R");
2528  PrintStr(" /P23");
2529  WriteInteger(patternNb++);
2530  PrintStr(" 0 R");
2531  PrintStr(" /P24");
2532  WriteInteger(patternNb++);
2533  PrintStr(" 0 R");
2534  PrintStr(" /P25");
2535  WriteInteger(patternNb++);
2536  PrintStr(" 0 R@");
2537  PrintStr(">>@");
2538  PrintStr("endobj@");
2539 
2540  patternNb = kObjPattern;
2541 
2542  // P01
2543  NewObject(patternNb++);
2544  PrintStr("<</Type/Pattern/Matrix[1 0 0 1 20 28]/PatternType 1/Resources");
2546  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 98 4]/XStep 98/YStep 4/Length 91/Filter/FlateDecode>>");
2547  PrintStr("@");
2548  fStream->write("stream",6); fNByte += 6;
2549  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);
2550  fNByte += 93;
2551  PrintStr("endstream@");
2552  PrintStr("endobj@");
2553 
2554  // P02
2555  NewObject(patternNb++);
2556  PrintStr("<</Type/Pattern/Matrix[0.75 0 0 0.75 20 28]/PatternType 1/Resources");
2558  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 96 4]/XStep 96/YStep 4/Length 92/Filter/FlateDecode>>@");
2559  PrintStr("@");
2560  fStream->write("stream",6); fNByte += 6;
2561  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);
2562  fNByte += 94;
2563  PrintStr("endstream@");
2564  PrintStr("endobj@");
2565 
2566  // P03
2567  NewObject(patternNb++);
2568  PrintStr("<</Type/Pattern/Matrix[0.5 0 0 0.5 20 28]/PatternType 1/Resources");
2570  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 96 16]/XStep 96/YStep 16/Length 93/Filter/FlateDecode>>@");
2571  PrintStr("@");
2572  fStream->write("stream",6); fNByte += 6;
2573  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);
2574  fNByte += 95;
2575  PrintStr("endstream@");
2576  PrintStr("endobj@");
2577 
2578  // P04
2579  NewObject(patternNb++);
2580  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2582  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 63/Filter/FlateDecode>>");
2583  PrintStr("@");
2584  fStream->write("stream",6); fNByte += 6;
2585  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);
2586  fNByte += 65;
2587  PrintStr("endstream@");
2588  PrintStr("endobj@");
2589 
2590  // P05
2591  NewObject(patternNb++);
2592  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2594  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 66/Filter/FlateDecode>>");
2595  PrintStr("@");
2596  fStream->write("stream",6); fNByte += 6;
2597  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);
2598  fNByte += 68;
2599  PrintStr("endstream@");
2600  PrintStr("endobj@");
2601 
2602  // P06
2603  NewObject(patternNb++);
2604  PrintStr("<</Type/Pattern/Matrix[0.03 0 0 0.03 20 28]/PatternType 1/Resources");
2606  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 66/Filter/FlateDecode>>");
2607  PrintStr("@");
2608  fStream->write("stream",6); fNByte += 6;
2609  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);
2610  fNByte += 68;
2611  PrintStr("endstream@");
2612  PrintStr("endobj@");
2613 
2614  // P07
2615  NewObject(patternNb++);
2616  PrintStr("<</Type/Pattern/Matrix[0.03 0 0 0.03 20 28]/PatternType 1/Resources");
2618  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 68/Filter/FlateDecode>>");
2619  PrintStr("@");
2620  fStream->write("stream",6); fNByte += 6;
2621  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);
2622  fNByte += 70;
2623  PrintStr("endstream@");
2624  PrintStr("endobj@");
2625 
2626  // P08
2627  NewObject(patternNb++);
2628  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2630  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 139/Filter/FlateDecode>>");
2631  PrintStr("@");
2632  fStream->write("stream",6); fNByte += 6;
2633  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);
2634  fNByte += 141;
2635  PrintStr("endstream@");
2636  PrintStr("endobj@");
2637 
2638  // P09
2639  NewObject(patternNb++);
2640  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2642  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 108/Filter/FlateDecode>>");
2643  PrintStr("@");
2644  fStream->write("stream",6); fNByte += 6;
2645  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);
2646  fNByte += 110;
2647  PrintStr("endstream@");
2648  PrintStr("endobj@");
2649 
2650  // P10
2651  NewObject(patternNb++);
2652  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2654  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 93/Filter/FlateDecode>>");
2655  PrintStr("@");
2656  fStream->write("stream",6); fNByte += 6;
2657  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);
2658  fNByte += 95;
2659  PrintStr("endstream@");
2660  PrintStr("endobj@");
2661 
2662  // P11
2663  NewObject(patternNb++);
2664  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2666  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 164/Filter/FlateDecode>>");
2667  PrintStr("@");
2668  fStream->write("stream",6); fNByte += 6;
2669  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);
2670  fNByte += 166;
2671  PrintStr("endstream@");
2672  PrintStr("endobj@");
2673 
2674  // P12
2675  NewObject(patternNb++);
2676  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2678  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 226/Filter/FlateDecode>>");
2679  PrintStr("@");
2680  fStream->write("stream",6); fNByte += 6;
2681  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);
2682  fNByte += 228;
2683  PrintStr("endstream@");
2684  PrintStr("endobj@");
2685 
2686  // P13
2687  NewObject(patternNb++);
2688  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2690  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 69/Filter/FlateDecode>>");
2691  PrintStr("@");
2692  fStream->write("stream",6); fNByte += 6;
2693  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);
2694  fNByte += 71;
2695  PrintStr("endstream@");
2696  PrintStr("endobj@");
2697 
2698  // P14
2699  NewObject(patternNb++);
2700  PrintStr("<</Type/Pattern/Matrix[0.15 0 0 0.15 20 28]/PatternType 1/Resources");
2702  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 80/YStep 80/Length 114/Filter/FlateDecode>>");
2703  PrintStr("@");
2704  fStream->write("stream",6); fNByte += 6;
2705  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);
2706  fNByte += 116;
2707  PrintStr("endstream@");
2708  PrintStr("endobj@");
2709 
2710  // P15
2711  NewObject(patternNb++);
2712  PrintStr("<</Type/Pattern/Matrix[0.102 0 0 0.102 20 28]/PatternType 1/Resources");
2714  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 60 60]/XStep 60/YStep 60/Length 218/Filter/FlateDecode>>");
2715  PrintStr("@");
2716  fStream->write("stream",6); fNByte += 6;
2717  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);
2718  fNByte += 220;
2719  PrintStr("endstream@");
2720  PrintStr("endobj@");
2721 
2722  // P16
2723  NewObject(patternNb++);
2724  PrintStr("<</Type/Pattern/Matrix[0.1 0 0 0.05 20 28]/PatternType 1/Resources");
2726  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 123/Filter/FlateDecode>>");
2727  PrintStr("@");
2728  fStream->write("stream",6); fNByte += 6;
2729  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);
2730  fNByte += 125;
2731  PrintStr("endstream@");
2732  PrintStr("endobj@");
2733 
2734  // P17
2735  NewObject(patternNb++);
2736  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2738  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 66/Filter/FlateDecode>>");
2739  PrintStr("@");
2740  fStream->write("stream",6); fNByte += 6;
2741  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);
2742  fNByte += 68;
2743  PrintStr("endstream@");
2744  PrintStr("endobj@");
2745 
2746  // P18
2747  NewObject(patternNb++);
2748  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2750  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 69/Filter/FlateDecode>>");
2751  PrintStr("@");
2752  fStream->write("stream",6); fNByte += 6;
2753  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);
2754  fNByte += 71;
2755  PrintStr("endstream@");
2756  PrintStr("endobj@");
2757 
2758  // P19
2759  NewObject(patternNb++);
2760  PrintStr("<</Type/Pattern/Matrix[0.117 0 0 0.117 20 28]/PatternType 1/Resources");
2762  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 149/Filter/FlateDecode>>");
2763  PrintStr("@");
2764  fStream->write("stream",6); fNByte += 6;
2765  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);
2766  fNByte += 151;
2767  PrintStr("endstream@");
2768  PrintStr("endobj@");
2769 
2770  // P20
2771  NewObject(patternNb++);
2772  PrintStr("<</Type/Pattern/Matrix[0.05 0 0 0.1 20 28]/PatternType 1/Resources");
2774  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 122/Filter/FlateDecode>>");
2775  PrintStr("@");
2776  fStream->write("stream",6); fNByte += 6;
2777  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);
2778  fNByte += 124;
2779  PrintStr("endstream@");
2780  PrintStr("endobj@");
2781 
2782  // P21
2783  NewObject(patternNb++);
2784  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2786  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 117/Filter/FlateDecode>>");
2787  PrintStr("@");
2788  fStream->write("stream",6); fNByte += 6;
2789  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);
2790  fNByte += 119;
2791  PrintStr("endstream@");
2792  PrintStr("endobj@");
2793 
2794  // P22
2795  NewObject(patternNb++);
2796  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2798  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 118/Filter/FlateDecode>>");
2799  PrintStr("@");
2800  fStream->write("stream",6); fNByte += 6;
2801  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);
2802  fNByte += 120;
2803  PrintStr("endstream@");
2804  PrintStr("endobj@");
2805 
2806  // P23
2807  NewObject(patternNb++);
2808  PrintStr("<</Type/Pattern/Matrix[0.06 0 0 0.06 20 28]/PatternType 1/Resources");
2810  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 169/Filter/FlateDecode>>");
2811  PrintStr("@");
2812  fStream->write("stream",6); fNByte += 6;
2813  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);
2814  fNByte += 171;
2815  PrintStr("endstream@");
2816  PrintStr("endobj@");
2817 
2818  // P24
2819  NewObject(patternNb++);
2820  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2822  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 100 100]/XStep 100/YStep 100/Length 280/Filter/FlateDecode>>");
2823  PrintStr("@");
2824  fStream->write("stream",6); fNByte += 6;
2825  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);
2826  fNByte += 282;
2827  PrintStr("endstream@");
2828  PrintStr("endobj@");
2829 
2830  // P25
2831  NewObject(patternNb++);
2832  PrintStr("<</Type/Pattern/Matrix[0.125 0 0 0.125 20 28]/PatternType 1/Resources");
2834  PrintStr(" 0 R/PaintType 2/TilingType 1/BBox[0 0 101 101]/XStep 100/YStep 100/Length 54/Filter/FlateDecode>>");
2835  PrintStr("@");
2836  fStream->write("stream",6); fNByte += 6;
2837  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);
2838  fNByte += 56;
2839  PrintStr("endstream@");
2840  PrintStr("endobj@");
2841 }
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:2123
n
const Int_t n
Definition: legend1.C:16
TPDF::SetLineStyle
void SetLineStyle(Style_t linestyle=1)
Change the line style.
Definition: TPDF.cxx:2071
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:2352
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
Style_t
short Style_t
Definition: RtypesCore.h:89
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:66
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:643
TPDF::SetMarkerColor
void SetMarkerColor(Color_t cindex=1)
Set color index for markers.
Definition: TPDF.cxx:2103
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
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:2370
TObjString.h
TPDF::SetLineWidth
void SetLineWidth(Width_t linewidth=1)
Change the line width.
Definition: TPDF.cxx:2090
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:301
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:280
TPDF::SetLineCap
void SetLineCap(Int_t linecap=0)
Set the value of the global parameter TPDF::fgLineCap.
Definition: TPDF.cxx:2056
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
TMath::Sqrt
Double_t Sqrt(Double_t x)
Definition: TMath.h:691
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:2010
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:57
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:2323
TStyle.h
TPDF::CellArrayEnd
void CellArrayEnd()
End the Cell Array painting.
Definition: TPDF.cxx:193
Int_t
int Int_t
Definition: RtypesCore.h:45
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
TAttText::fTextSize
Float_t fTextSize
Text size.
Definition: TAttText.h:22
TColor.h
TPDF::PatternEncode
void PatternEncode()
Patterns encoding.
Definition: TPDF.cxx:2445
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:136
TPDF::WriteReal
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
Definition: TPDF.cxx:2429
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:1965
Color_t
short Color_t
Definition: RtypesCore.h:92
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:3664
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:104
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:123
TPDF::UtoPDF
Double_t UtoPDF(Double_t u)
Convert U from NDC coordinate to PDF.
Definition: TPDF.cxx:2343
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:37
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:2219
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:412
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:1973
TMath::Floor
Double_t Floor(Double_t x)
Definition: TMath.h:703
a
auto * a
Definition: textangle.C:12
Width_t
short Width_t
Definition: RtypesCore.h:91
TStorage.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
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:2111
TMath::Power
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:735
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:1892
TColor::GetRed
Float_t GetRed() const
Definition: TColor.h:57
TMath::Sin
Double_t Sin(Double_t)
Definition: TMath.h:639
TVirtualPad.h
TPDF::SetLineJoin
void SetLineJoin(Int_t linejoin=0)
Set the value of the global parameter TPDF::fgLineJoin.
Definition: TPDF.cxx:2032
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:879
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:250
TVirtualPS::PrintStr
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
Definition: TVirtualPS.cxx:73
gVirtualPS
R__EXTERN TVirtualPS * gVirtualPS
Definition: TVirtualPS.h:81
TPDF::WriteCompressedBuffer
void WriteCompressedBuffer()
Write the buffer in a compressed way.
Definition: TPDF.cxx:2379
TPoints.h
TText
Base class for several text objects.
Definition: TText.h:22
Double_t
double Double_t
Definition: RtypesCore.h:59
TPDF::XtoPDF
Double_t XtoPDF(Double_t x)
Convert X from world coordinate to PDF.
Definition: TPDF.cxx:2361
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:279
TPDF::SetAlpha
void SetAlpha(Float_t alpha=1.)
Set the alpha channel value.
Definition: TPDF.cxx:1872
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
TStyle::GetColorModelPS
Int_t GetColorModelPS() const
Definition: TStyle.h:188
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:278
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:182
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
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:171
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