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