ROOT logo
ROOT » GRAF2D » POSTSCRIPT » TPostScript

class TPostScript: public TVirtualPS


TPostScript: Graphics interface to PostScript

This code was initially developed in the context of HIGZ and PAW by Olivier Couet and Pierre Juillot. It has been converted to a C++ class by Rene Brun.

To generate a Postscript (or encapsulated ps) file corresponding to a single image in a canvas, you can:

  • Select the Print PostScript item in the canvas File menu. By default, a Postscript file with the name of the canvas.ps is generated.
  • Click in the canvas area, near the edges, with the right mouse button and select the Print item. You can select the name of the Postscript file. If the file name is xxx.ps, you will generate a Postscript file named xxx.ps. If the file name is xxx.eps, you generate an encapsulated Postscript file instead.
  • In your program (or macro), you can type:

    c1->Print("xxx.ps") or c1->Print("xxx.eps")

    This will generate a file corresponding to the picture in the canvas pointed by c1.

    pad1->Print("xxx.ps")

    prints only the picture in the pad pointed by pad1. The size of the Postscript picture, by default, is computed to keep the aspect ratio of the picture on the screen, where the size along x is always 20cm. You can set the size of the PostScript picture before generating the picture with a command such as:

     TPostScript myps("myfile.ps",111)
     myps.Range(xsize,ysize);
     object->Draw();
     myps.Close();
     

    You can set the default paper size with:

     gStyle->SetPaperSize(xsize,ysize);
     

    You can resume writing again in this file with myps.Open();. Note that you may have several Postscript files opened simultaneously.

Output type

The output type allows to define how the PostScript output will looks like. It allows to define the page format (A4, Legal etc..), the orientation (Portrait, Landscape) and the number of images (zones) per page. The output type has the following form:
 [Format][Nx][Ny][Type]
 
Where:
  • Format : Is an integer between 0 and 99 defining the page format. Example:
    Format = 3 the paper is in the standard A3 format.
    Format = n (1 Format = 4 and Format=0 are the same and define an A4 page.
    The A0 format is selected by Format=99.
    The US format Letter is selected by Format = 100.
    The US format Legal is selected by Format = 200.
    The US format Ledger is selected by Format = 300.
  • Nx, Ny : Specify respectively the number of zones on the x and y axis. Nx and Ny are integers between 1 and 9.
  • Type : Can be equal to:
    • 1 : Portrait mode with a small margin at the bottom of the page.
    • 2 : Landscape mode with a small margin at the bottom of the page.
    • 4 : Portrait mode with a large margin at the bottom of the page.
    • 5 : Landscape mode with a large margin at the bottom of the page. The large margin is useful for some PostScript printers (very often for the colour printers) as they need more space to grip the paper for mechanical reasons. Note that some PostScript colour printers can also use the so called special A4 format permitting the full usage of the A4 area; in this case larger margins are not necessary and Type=1 or 2 can be used.
    • 3 : Encapsulated PostScript. This Type permits the generation of files which can be included in other documents, for example in LaTeX files.

Making several pictures in the same Postscript file: case 1

The following macro is an example illustrating how to open a Postscript file and draw several pictures. The generation of a new Postscript page is automatic when TCanvas::Clear is called by object->Draw().

 {
 TFile f("hsimple.root");
 TCanvas c1("c1","canvas",800,600);
 // select postscript output type
 // type = 111   portrait  ps
 // type = 112   landscape ps
 // type = 113   eps
 Int_t type = 111;
 // create a postscript file and set the paper size
 TPostScript ps("test.ps",type);
 ps.Range(16,24);  //set x,y of printed page
 // draw 3 histograms from file hsimple.root on separate pages
 hpx->Draw();
 c1.Update();      //force drawing in a macro
 hprof->Draw();
 c1.Update();
 hpx->Draw("lego1");
 c1.Update();
 ps.Close();
 }
 

Making several pictures in the same Postscript file: case 2

This example shows 2 pages. The canvas is divided. TPostScript::NewPage must be called before starting a new picture.object->Draw does not clear the canvas in this case because we clear only the pads and not the main canvas. Note that c1->Update must be called at the end of the first picture.

 {
 TFile *f1 = new TFile("hsimple.root");
 TCanvas *c1 = new TCanvas("c1");
 TPostScript *ps = new TPostScript("file.ps",112);
 c1->Divide(2,1);
 // picture 1
 ps->NewPage();
 c1->cd(1);
 hpx->Draw();
 c1->cd(2);
 hprof->Draw();
 c1->Update();
 // picture 2
 ps->NewPage();
 c1->cd(1);
 hpxpy->Draw();
 c1->cd(2);
 ntuple->Draw("px");
 c1->Update();
 ps->Close();
 // invoke Postscript viewer
 gSystem->Exec("gs file.ps");
 }
 

Making several pictures in the same Postscript file: case 3

This is the recommended way. If the Postscript file name finishes with "(", the file remains opened (it is not closed). If the Postscript file name finishes with ")" and the file has been opened with "(", the file is closed.

Example:

 {
 TCanvas c1("c1");
 h1.Draw();
 c1.Print("c1.ps(");  // write canvas and keep the ps file open
 h2.Draw();
 c1.Print("c1.ps");   // canvas is added to "c1.ps"
 h3.Draw();
 c1.Print("c1.ps)");  // canvas is added to "c1.ps" and ps file is closed
 }
 
The TCanvas::Print("file.ps(") mechanism is very useful, but it can be a little inconvenient to have the action of opening/closing a file being atomic with printing a page. Particularly if pages are being generated in some loop one needs to detect the special cases of first and last page and then munge the argument to Print() accordingly.
The "[" and "]" can be used instead of "(" and ")" as shown below.

Example:

 c1.Print("file.ps[");        // No actual print, just open file.ps
 for (int i=0; i<10; ++i) {
 // fill canvas for context i
 // ...
 c1.Print("file.ps");      // Actually print canvas to the file
 }
 c1.Print("file.ps]");        // No actual print, just close the file
 

Color Model

TPostScript support two color model RGB and CMYK. CMY and CMYK models are subtractive color models unlike RGB which is an additive. They are mainly used for printing purposes. CMY means Cyan Magenta Yellow to convert RGB to CMY it is enough to do: C=1-R, M=1-G and Y=1-B. CMYK has one more component K (black). The conversion from RGB to CMYK is:
 Double_t Black   = TMath::Min(TMath::Min(1-Red,1-Green),1-Blue);
 Double_t Cyan    = (1-Red-Black)/(1-Black);
 Double_t Magenta = (1-Green-Black)/(1-Black);
 Double_t Yellow  = (1-Blue-Black)/(1-Black);
 
CMYK add the black component which allows to have a better quality for black printing. PostScript support the CMYK model.
To change the color model use gStyle->SetColorModelPS(c).
  • c = 0 means TPostScript will use RGB color model (default)
  • c = 1 means TPostScript will use CMYK color model
 

Function Members (Methods)

public:
TPostScript()
TPostScript(const char* filename, Int_t type = -111)
virtual~TPostScript()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
virtual voidCellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
virtual voidCellArrayEnd()
virtual voidCellArrayFill(Int_t r, Int_t g, Int_t b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual voidClose(Option_t* opt = "")
Int_tCMtoPS(Double_t u)
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
voidDefineMarkers()
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidDrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidDrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt, Int_t mode, Int_t border, Int_t dark, Int_t light)
voidDrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t* x, Float_t* y)
voidDrawHatch(Float_t dy, Float_t angle, Int_t n, Double_t* x, Double_t* y)
voidDrawPolyLine(Int_t n, TPoints* xy)
voidDrawPolyLineNDC(Int_t n, TPoints* uv)
virtual voidDrawPolyMarker(Int_t n, Float_t* x, Float_t* y)
virtual voidDrawPolyMarker(Int_t n, Double_t* x, Double_t* y)
virtual voidDrawPS(Int_t n, Float_t* xw, Float_t* yw)
virtual voidDrawPS(Int_t n, Double_t* xw, Double_t* yw)
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
voidFontEmbed()
boolFontEmbedType1(const char* filename)
boolFontEmbedType2(const char* filename)
boolFontEmbedType42(const char* filename)
voidFontEncode()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
virtual Color_tTAttMarker::GetMarkerColor() const
virtual Size_tTAttMarker::GetMarkerSize() const
virtual Style_tTAttMarker::GetMarkerStyle() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual void*TVirtualPS::GetStream() const
virtual Short_tTAttText::GetTextAlign() const
virtual Float_tTAttText::GetTextAngle() const
virtual Color_tTAttText::GetTextColor() const
virtual Font_tTAttText::GetTextFont() const
virtual Float_tTAttText::GetTextSize() const
virtual const char*TNamed::GetTitle() const
virtual Int_tTVirtualPS::GetType() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
voidInitialize()
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttLine::Modify()
voidMovePS(Int_t x, Int_t y)
virtual voidNewPage()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidOff()
voidOn()
virtual voidOpen(const char* filename, Int_t type = -111)
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TNamed&TNamed::operator=(const TNamed& rhs)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidTVirtualPS::PrintFast(Int_t nch, const char* string = "")
virtual voidTVirtualPS::PrintRaw(Int_t len, const char* str)
virtual voidTVirtualPS::PrintStr(const char* string = "")
voidRange(Float_t xrange, Float_t yrange)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
virtual voidTAttMarker::ResetAttMarker(Option_t* toption = "")
virtual voidTAttText::ResetAttText(Option_t* toption = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidTAttMarker::SaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1)
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidSaveRestore(Int_t flag)
virtual voidTAttText::SaveTextAttributes(ostream& out, const char* name, Int_t alidef = 12, Float_t angdef = 0, Int_t coldef = 1, Int_t fondef = 61, Float_t sizdef = 1)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetColor(Int_t color = 1)
virtual voidSetColor(Float_t r, Float_t g, Float_t b)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidSetFillColor(Color_t cindex = 1)
virtual voidTAttFill::SetFillColorAlpha(Color_t fcolor, Float_t falpha)
voidSetFillPatterns(Int_t ipat, Int_t color)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidSetLineColor(Color_t cindex = 1)
virtual voidTAttLine::SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
voidSetLineJoin(Int_t linejoin = 0)
voidSetLineScale(Float_t scale = 3)
virtual voidSetLineStyle(Style_t linestyle = 1)
virtual voidSetLineWidth(Width_t linewidth = 1)
virtual voidTAttMarker::SetMarkerAttributes()MENU
virtual voidSetMarkerColor(Color_t cindex = 1)
virtual voidTAttMarker::SetMarkerColorAlpha(Color_t mcolor, Float_t malpha)
virtual voidTAttMarker::SetMarkerSize(Size_t msize = 1)
virtual voidTAttMarker::SetMarkerStyle(Style_t mstyle = 1)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTVirtualPS::SetStream(ofstream* os)
virtual voidTAttText::SetTextAlign(Short_t align = 11)
virtual voidTAttText::SetTextAngle(Float_t tangle = 0)MENU
virtual voidTAttText::SetTextAttributes()MENU
virtual voidSetTextColor(Color_t cindex = 1)
virtual voidTAttText::SetTextColorAlpha(Color_t tcolor, Float_t talpha)
virtual voidTAttText::SetTextFont(Font_t tfont = 62)
virtual voidTAttText::SetTextSize(Float_t tsize = 1)
virtual voidTAttText::SetTextSizePixels(Int_t npixels)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTVirtualPS::SetType(Int_t = -111)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidText(Double_t x, Double_t y, const char* string)
virtual voidText(Double_t x, Double_t y, const wchar_t* string)
voidTextNDC(Double_t u, Double_t v, const char* string)
voidTextNDC(Double_t u, Double_t v, const wchar_t* string)
virtual voidTObject::UseCurrentStyle()
Int_tUtoPS(Double_t u)
Int_tVtoPS(Double_t v)
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidTVirtualPS::WriteInteger(Int_t i, Bool_t space = kTRUE)
virtual voidTVirtualPS::WriteReal(Float_t r, Bool_t space = kTRUE)
Int_tXtoPS(Double_t x)
Int_tYtoPS(Double_t y)
voidZone()
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
Float_tfBluePer cent of blue
Bool_tfBoundingBoxTrue for Encapsulated PostScript
char*TVirtualPS::fBufferFile buffer
Bool_tfClearTrue when page must be cleared
Int_tfClipClipping mode
Bool_tfClipStatusClipping Indicator
Int_tfCurrentColorcurrent Postscript color index
Float_tfDXC
Float_tfDYC
Float_tfFX
Float_tfFY
TStringfFileNamePS file name
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
Bool_tfFontEmbedTrue is FontEmbed has been called
Float_tfGreenPer cent of green
Int_tfIXzoneCurrent zone along X
Int_tfIYzoneCurrent zone along Y
const char*TVirtualPS::fImplicitCREscEscape symbol before enforced new line
Int_tfLastCellBlueLast blue value
Int_tfLastCellGreenLast green value
Int_tfLastCellRedLast red value
Int_tTVirtualPS::fLenBufferBuffer length
Color_tTAttLine::fLineColorline color
Int_tfLineJoinAppearance of joining lines
Float_tfLineScaleLine width scale factor
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
Color_tTAttMarker::fMarkerColorMarker color index
Size_tTAttMarker::fMarkerSizeMarker size
Float_tfMarkerSizeCurcurrent transformed value of marker size
Style_tTAttMarker::fMarkerStyleMarker style
Int_tfMaxLinesMaximum number of lines in a PS array
Float_tfMaxsizeLargest dimension of X and Y
Int_tfModePostScript mode
Int_tfNBSameColorCellNumber of boxes with the same color
Int_tTVirtualPS::fNByteNumber of bytes written in the file (PDF)
Int_tfNXzoneNumber of zones along X
Int_tfNYzoneNumber of zones along Y
TStringTNamed::fNameobject identifier
Int_tfNbCellLineNumber of boxes in the current line
Int_tfNbCellWNumber of boxes per line
Int_tfNbinCTNumber of entries in the current Cell Array
Int_tfNpagesnumber of pages
charfPatterns[32]Indicate if pattern n is defined
Bool_tTVirtualPS::fPrintedTrue when a page must be printed
Bool_tfRangeTrue when a range has been defined
Float_tfRedPer cent of red
Int_tfSaveNumber of gsave for restore
Int_tTVirtualPS::fSizBufferBuffer size
ofstream*TVirtualPS::fStreamFile stream identifier
Short_tTAttText::fTextAlignText alignment
Float_tTAttText::fTextAngleText angle
Color_tTAttText::fTextColorText color index
Font_tTAttText::fTextFontText font number
Float_tTAttText::fTextSizeText size
TStringTNamed::fTitleobject title
Int_tfTypePostScript workstation type
Float_tfX1vX bottom left corner of paper
Float_tfX1w
Float_tfX2vX top right corner of paper
Float_tfX2w
Float_tfXC
Float_tfXVP1
Float_tfXVP2
Float_tfXVS1
Float_tfXVS2
Float_tfXsizePage size along X
Float_tfY1vY bottom left corner of paper
Float_tfY1w
Float_tfY2vY top right corner of paper
Float_tfY2w
Float_tfYC
Float_tfYVP1
Float_tfYVP2
Float_tfYVS1
Float_tfYVS2
Float_tfYsizePage size along Y
Bool_tfZoneZone indicator
static Int_tfgLineJoinAppearance of joining lines

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TPostScript()
 Default PostScript constructor
TPostScript(const char* filename, Int_t type = -111)
 Initialize the PostScript interface

  fname : PostScript file name
  wtype : PostScript workstation type


  The possible workstation types are:
     111 ps  Portrait
     112 ps  Landscape
     113 eps
void Open(const char* filename, Int_t type = -111)
 Open a PostScript file
~TPostScript()
 Default PostScript destructor
void Close(Option_t* opt = "")
 Close a PostScript file
void On()
 Activate an already open PostScript file
void Off()
 Deactivate an already open PostScript file
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
 Draw a Cell Array

 Drawing a PostScript Cell Array is in fact done thanks to three
 procedures: CellArrayBegin, CellArrayFill, and CellArrayEnd.

 CellArrayBegin: Initiate the Cell Array by writing the necessary
                 PostScript procedures and the initial values of the
                 required parameters. The input parameters are:
                 W: number of boxes along the width.
                 H: number of boxes along the height
                 x1,x2,y1,y2: First box coordinates.
 CellArrayFill:  Is called for each box of the Cell Array. The first
                 box is the top left one and the last box is the
                 bottom right one. The input parameters are the Red,
                 Green, and Blue components of the box colour. These
                 Levels are between 0 and 255.
 CellArrayEnd:   Finishes the Cell Array.

 PostScript cannot handle arrays larger than 65535. So the Cell Array
 is drawn in several pieces.
void CellArrayFill(Int_t r, Int_t g, Int_t b)
 Paint the Cell Array
void CellArrayEnd()
 End the Cell Array painting
void DefineMarkers()
 Define the markers
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
 Draw a Box
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

 mode = -1  box looks as it is behind the screen
 mode =  1  box looks as it is in front of the screen
 border is the border size in already precomputed PostScript units
 dark  is the color for the dark part of the frame
 light is the color for the light part of the frame
void DrawPolyLine(Int_t n, TPoints* xy)
 Draw a PolyLine

  Draw a polyline through  the points xy.
  If nn=1 moves only to point x,y.
  If nn=0 the x,y are  written  in the PostScript file
          according to the current transformation.
  If nn>0 the line is clipped as a line.
  If nn<0 the line is clipped as a fill area.
void DrawPolyLineNDC(Int_t n, TPoints* uv)
 Draw a PolyLine in NDC space

  Draw a polyline through the points xy.
  If nn=1 moves only to point x,y.
  If nn=0 the x,y are  written  in the PostScript file
          according to the current transformation.
  If nn>0 the line is clipped as a line.
  If nn<0 the line is clipped as a fill area.
void DrawPolyMarker(Int_t n, Float_t* x, Float_t* y)
 Draw markers at the n WC points x, y
void DrawPolyMarker(Int_t n, Double_t* x, Double_t* y)
 Draw markers at the n WC points x, y
void DrawPS(Int_t n, Float_t* xw, Float_t* yw)
 Draw a PolyLine

  Draw a polyline through the points xw,yw.
  If nn=1 moves only to point xw,yw.
  If nn=0 the XW(1) and YW(1) are  written  in the PostScript file
          according to the current NT.
  If nn>0 the line is clipped as a line.
  If nn<0 the line is clipped as a fill area.
void DrawPS(Int_t n, Double_t* xw, Double_t* yw)
 Draw a PolyLine

 Draw a polyline through  the points xw,yw.
 If nn=1 moves only to point xw,yw.
 If nn=0 the xw(1) and YW(1) are  written  in the PostScript file
         according to the current NT.
 If nn>0 the line is clipped as a line.
 If nn<0 the line is clipped as a fill area.
void DrawHatch(Float_t dy, Float_t angle, Int_t n, Float_t* x, Float_t* y)
 Draw Fill area with hatch styles
void DrawHatch(Float_t dy, Float_t angle, Int_t n, Double_t* x, Double_t* y)
 Draw Fill area with hatch styles
Bool_t FontEmbedType1(const char* filename)
Bool_t FontEmbedType2(const char* filename)
Bool_t FontEmbedType42(const char* filename)
void FontEmbed(void)
 Embed font in PS file.
void FontEncode()
 Font Reencoding
void Initialize()
 PostScript Initialisation

 This routine initialize the following PostScript procedures:

 +------------+------------------+-----------------------------------+
 | Macro Name | Input parameters |            Explanation            |
 +------------+------------------+-----------------------------------+
 |     l      | x y              | Draw a line to the x y position   |
 +------------+------------------+-----------------------------------+
 |     m      | x y              | Move to the position x y          |
 +------------+------------------+-----------------------------------+
 |     box    | dx dy x y        | Define a box                      |
 +------------+------------------+-----------------------------------+
 |     bl     | dx dy x y        | Draw a line box                   |
 +------------+------------------+-----------------------------------+
 |     bf     | dx dy x y        | Draw a filled box                 |
 +------------+------------------+-----------------------------------+
 |     t      | x y              | Translate                         |
 +------------+------------------+-----------------------------------+
 |     r      | angle            | Rotate                            |
 +------------+------------------+-----------------------------------+
 |     rl     | i j              | Roll the stack                    |
 +------------+------------------+-----------------------------------+
 |     d      | x y              | Draw a relative line to x y       |
 +------------+------------------+-----------------------------------+
 |     X      | x                | Draw a relative line to x (y=0)   |
 +------------+------------------+-----------------------------------+
 |     Y      | y                | Draw a relative line to y (x=0)   |
 +------------+------------------+-----------------------------------+
 |     rm     | x y              | Move relatively to x y            |
 +------------+------------------+-----------------------------------+
 |     gr     |                  | Restore the graphic context       |
 +------------+------------------+-----------------------------------+
 |     lw     | lwidth           | Set line width to lwidth          |
 +------------+------------------+-----------------------------------+
 |     sd     | [] 0             | Set dash line define by []        |
 +------------+------------------+-----------------------------------+
 |     s      |                  | Stroke mode                       |
 +------------+------------------+-----------------------------------+
 |     c      | r g b            | Set rgb color to r g b            |
 +------------+------------------+-----------------------------------+
 |     cl     |                  | Close path                        |
 +------------+------------------+-----------------------------------+
 |     f      |                  | Fill the last describe path       |
 +------------+------------------+-----------------------------------+
 |     mXX    | x y              | Draw the marker type XX at (x,y)  |
 +------------+------------------+-----------------------------------+
 |     Zone   | ix iy            | Define the current zone           |
 +------------+------------------+-----------------------------------+
 |     black  |                  | The color is black                |
 +------------+------------------+-----------------------------------+
 |     C      | dx dy x y        | Clipping on                       |
 +------------+------------------+-----------------------------------+
 |     NC     |                  | Clipping off                      |
 +------------+------------------+-----------------------------------+
 |     R      |                  | repeat                            |
 +------------+------------------+-----------------------------------+
 |     ita    |                  | Used to make the symbols italic   |
 +------------+------------------+-----------------------------------+
 |     K      |                  | kshow                             |
 +------------+------------------+-----------------------------------+
void MovePS(Int_t x, Int_t y)
 Move to a new position
void NewPage()
 Move to a new PostScript page
void Range(Float_t xrange, Float_t yrange)
 Set the range for the paper in centimeters
void SaveRestore(Int_t flag)
 Compute number of gsaves for restore
 This allows to write the correct number of grestore at the
 end of the PS file.
void SetFillColor(Color_t cindex = 1)
 Set color index for fill areas
void SetFillPatterns(Int_t ipat, Int_t color)
 Patterns definition

 Define the pattern ipat in the current PS file. ipat can vary from
 1 to 25. Together with the pattern, the color (color) in which the
 pattern has to be drawn is also required. A pattern is defined in the
 current PS file only the first time it is used. Some level 2
 Postscript functions are used, so on level 1 printers, patterns will
 not work. This is not a big problem because patterns are
 defined only if they are used, so if they are not used a PS level 1
 file will not be polluted by level 2 features, and in any case the old
 patterns used a lot of memory which made them almost unusable on old
 level 1 printers. Finally we should say that level 1 devices are
 becoming very rare. The official PostScript is now level 3 !
void SetLineColor(Color_t cindex = 1)
 Set color index for lines
void SetLineJoin(Int_t linejoin = 0)
 Set the value of the global parameter TPostScript::fgLineJoin.
 This parameter determines the appearance of joining lines in a PostScript
 output.
 It takes one argument which may be:
   - 0 (miter join)
   - 1 (round join)
   - 2 (bevel join)
 The default value is 0 (miter join).


/* */

 To change the line join behaviour just do:
 TPostScript::SetLineJoin(2); // Set the PS line join to bevel.
void SetLineStyle(Style_t linestyle = 1)
 Change the line style

   linestyle = 2 dashed
             = 3  dotted
             = 4  dash-dotted
              else = solid

 See TStyle::SetLineStyleString for style definition
void SetLineWidth(Width_t linewidth = 1)
 Change the line width
void SetMarkerColor(Color_t cindex = 1)
 Set color index for markers
void SetColor(Int_t color = 1)
 Set the current color.
void SetColor(Float_t r, Float_t g, Float_t b)
 Set directly current color (don't go via TColor).
void SetTextColor(Color_t cindex = 1)
 Set color index for text
void Text(Double_t x, Double_t y, const char* string)
 Write a string of characters

 This routine writes the string chars into a PostScript file
 at position xx,yy in world coordinates.
void Text(Double_t x, Double_t y, const wchar_t* string)
 Write a string of characters

 This routine writes the string chars into a PostScript file
 at position xx,yy in world coordinates.
void TextNDC(Double_t u, Double_t v, const char* string)
 Write a string of characters in NDC
void TextNDC(Double_t u, Double_t v, const wchar_t* string)
 Write a string of characters in NDC
Int_t UtoPS(Double_t u)
 Convert U from NDC coordinate to PostScript
Int_t VtoPS(Double_t v)
 Convert V from NDC coordinate to PostScript
Int_t XtoPS(Double_t x)
 Convert X from world coordinate to PostScript
Int_t YtoPS(Double_t y)
 Convert Y from world coordinate to PostScript
void Zone()
 Initialize the PostScript page in zones
Int_t CMtoPS(Double_t u)
{return Int_t(0.5 + 72*u/2.54);}
void SetLineScale(Float_t scale = 3)
{fLineScale = scale;}