Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::GhostScript Class Reference

#include <GhostScript.h>

Collaboration diagram for PLearn::GhostScript:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GhostScript (int width=200, int height=200)
 opens an X11 ghostscript window

 GhostScript (const string &filename, real x1, real y1, real x2, real y2)
 creates an eps file with the (x1,y1;x2,y2) bounding box

 ~GhostScript ()
void flush ()
PStream & operator<< (char *str)
void run (const char *filename)
void copypage ()
void showpage ()
void gsave ()
void grestore ()
void translate (real x, real y)
void scale (real x, real y)
void moveto (real x, real y)
void rotate (real angle)
void mapping (real sourcex, real sourcey, real sourcewidth, real sourceheight, real destx, real desty, real destwidth, real destheight)
void show (const char *str)
void show (real x, real y, const char *str, char halign='l', char valign='b')
 halign can be 'l' (left), 'c' (center) or 'r' (right) valign can be 't' (top), 'm' (middle) or 'b' (bottom)

void centerShow (real x, real y, const char *str)
void multilineShow (real x, real y, const string &text, real newlinesize, char halign='l', char valign='b')
 accepts multiple line text (lines separated by
)

void show (real x, real y, Vec v)
void centerShow (real x, real y, Vec v)
void erasepage ()
void setcolor (real r, real g, real b)
void setcolor (real rgb)
 takes color in rgb real as returned by rgb2real

void setcolor (char *colorname)
void setgray (real g)
void setlinewidth (real w)
void setdash (Vec ary, real x=0)
 sets the dash pattern: ary contains the cyclic on-off distances of the dashes, which begin after an offset_of x units from the current point

void drawLine (real x1, real y1, real x2, real y2)
void drawArrow (real x1, real y1, real x2, real y2)
void drawBox (real x, real y, real width, real height)
void fillBox (real x, real y, real width, real height)
void drawCross (real x, real y, real r, bool vertical=false, real ry=-1)
void drawCircle (real x, real y, real r)
void fillCircle (real x, real y, real r)
void displayBlack (const Mat &bm, real x, real y, real w, real h, bool painton1=true)
void displayGray (const Mat &bm, real x, real y, real w, real h)
 values in bm indicate quantity of light between 0.0 (black) and 1.0 (white)

void displayRGB (const Mat &bm, real x, real y, real w, real h)
 values in bm are those obtained using the rgb2real function (see above)

void usefont (const char *fontname="Times-Roman", real pointsize=12.0)

Protected Types

typedef ios::char_type char_type

Static Protected Member Functions

void writeBitmapHexString1Bit (const Mat &bm, PStream &out, bool lastrowfirst=false)
void writeBitmapHexString8Bits (const Mat &bm, PStream &out, bool lastrowfirst=false)
void writeBitmapHexString24Bits (const Mat &bm, PStream &out, bool lastrowfirst=false)

Protected Attributes

FILE * gs_cstream
PStream togs
char command_string [1000]
bool isfile

Member Typedef Documentation

typedef ios::char_type PLearn::GhostScript::char_type [protected]
 

Definition at line 82 of file GhostScript.h.


Constructor & Destructor Documentation

PLearn::GhostScript::GhostScript (  int  width = 200,
int  height = 200
) 
 

opens an X11 ghostscript window

Definition at line 80 of file GhostScript.cc.

References PLearn::PStream::attach(), command_string, gs_cstream, PLearn::isfile(), PLearn::PStream::outmode, and togs.

PLearn::GhostScript::GhostScript (  const string &  filename,
real  x1,
real  y1,
real  x2,
real  y2
) 
 

creates an eps file with the (x1,y1;x2,y2) bounding box

Definition at line 92 of file GhostScript.cc.

References PLearn::PStream::attach(), PLearn::endl(), gs_cstream, PLearn::isfile(), PLearn::PStream::outmode, and togs.

PLearn::GhostScript::~GhostScript (   ) 
 

Definition at line 103 of file GhostScript.cc.

References PLearn::endl(), gs_cstream, isfile, and togs.


Member Function Documentation

void PLearn::GhostScript::centerShow (  real  x,
real  y,
Vec  v
)  [inline]
 

Definition at line 160 of file GhostScript.h.

References PLearn::endl(), togs, and x.

void PLearn::GhostScript::centerShow (  real  x,
real  y,
const char *  str
)  [inline]
 

Definition at line 151 of file GhostScript.h.

References centerShow(), and x.

Referenced by centerShow(), PLearn::displayVarGraph(), and PLearn::OldDisplayVarGraph().

void PLearn::GhostScript::copypage (   )  [inline]
 

Definition at line 109 of file GhostScript.h.

References PLearn::endl(), and togs.

Referenced by flush().

void PLearn::GhostScript::displayBlack (  const Mat &  bm,
real  x,
real  y,
real  w,
real  h,
bool  painton1 = true
) 
 

if painton1 is true, then all matrix cells that are different from 0 will be painted in the current color. If painton1 is false, then all cells that are equal to 0 will be painted

Definition at line 177 of file GhostScript.cc.

References PLearn::endl(), PLearn::TMat< T >::length(), togs, PLearn::TMat< T >::width(), writeBitmapHexString1Bit(), and x.

void PLearn::GhostScript::displayGray (  const Mat &  bm,
real  x,
real  y,
real  w,
real  h
) 
 

values in bm indicate quantity of light between 0.0 (black) and 1.0 (white)

Definition at line 195 of file GhostScript.cc.

References PLearn::endl(), PLearn::TMat< T >::length(), togs, PLearn::TMat< T >::width(), writeBitmapHexString8Bits(), and x.

Referenced by PLearn::displayDecisionSurface(), and PLearn::Grapher::plot_2D_classification().

void PLearn::GhostScript::displayRGB (  const Mat &  bm,
real  x,
real  y,
real  w,
real  h
) 
 

values in bm are those obtained using the rgb2real function (see above)

Definition at line 213 of file GhostScript.cc.

References PLearn::TMat< T >::length(), togs, PLearn::TMat< T >::width(), writeBitmapHexString24Bits(), and x.

Referenced by PLearn::Grapher::plot_2D_classification().

void PLearn::GhostScript::drawArrow (  real  x1,
real  y1,
real  x2,
real  y2
)  [inline]
 

Definition at line 197 of file GhostScript.h.

References drawArrow(), and drawCircle().

Referenced by PLearn::displayVarGraph(), drawArrow(), and PLearn::OldDisplayVarGraph().

void PLearn::GhostScript::drawBox (  real  x,
real  y,
real  width,
real  height
) 
 

Definition at line 297 of file GhostScript.cc.

References PLearn::endl(), togs, and x.

Referenced by PLearn::displayVarGraph(), and PLearn::OldDisplayVarGraph().

void PLearn::GhostScript::drawCircle (  real  x,
real  y,
real  r
) 
 

Definition at line 317 of file GhostScript.cc.

References PLearn::endl(), moveto(), togs, and x.

Referenced by PLearn::displayDecisionSurface(), and drawArrow().

void PLearn::GhostScript::drawCross (  real  x,
real  y,
real  r,
bool  vertical = false,
real  ry = -1
) 
 

Definition at line 323 of file GhostScript.cc.

References drawLine(), PLearn::sqrt(), and x.

Referenced by PLearn::displayPoints().

void PLearn::GhostScript::drawLine (  real  x1,
real  y1,
real  x2,
real  y2
)  [inline]
 

Definition at line 194 of file GhostScript.h.

References drawLine(), PLearn::endl(), and togs.

Referenced by drawCross(), and drawLine().

void PLearn::GhostScript::erasepage (   )  [inline]
 

Definition at line 163 of file GhostScript.h.

References PLearn::endl(), and togs.

void PLearn::GhostScript::fillBox (  real  x,
real  y,
real  width,
real  height
) 
 

Definition at line 307 of file GhostScript.cc.

References PLearn::endl(), togs, and x.

void PLearn::GhostScript::fillCircle (  real  x,
real  y,
real  r
) 
 

Definition at line 343 of file GhostScript.cc.

References PLearn::endl(), moveto(), togs, and x.

Referenced by PLearn::Grapher::plot_2D_classification().

void PLearn::GhostScript::flush (   ) 
 

Definition at line 113 of file GhostScript.cc.

References copypage(), PLearn::PStream::flush(), gs_cstream, and togs.

void PLearn::GhostScript::grestore (   )  [inline]
 

Definition at line 118 of file GhostScript.h.

References togs.

Referenced by PLearn::displayDecisionSurface().

void PLearn::GhostScript::gsave (   )  [inline]
 

Definition at line 115 of file GhostScript.h.

References togs.

Referenced by PLearn::displayDecisionSurface().

void PLearn::GhostScript::mapping (  real  sourcex,
real  sourcey,
real  sourcewidth,
real  sourceheight,
real  destx,
real  desty,
real  destwidth,
real  destheight
)  [inline]
 

transforms coordinate system such that the source rectangle will be mapped to the destination rectangle (i.e. you can then use the source coordinate system to do your drawings, and they will be rendered in the destination rectangle).

Definition at line 137 of file GhostScript.h.

References mapping().

Referenced by PLearn::displayDecisionSurface(), mapping(), and PLearn::Grapher::plot_2D_classification().

void PLearn::GhostScript::moveto (  real  x,
real  y
)  [inline]
 

Definition at line 127 of file GhostScript.h.

References moveto(), togs, and x.

Referenced by drawCircle(), fillCircle(), and moveto().

void PLearn::GhostScript::multilineShow (  real  x,
real  y,
const string &  text,
real  newlinesize,
char  halign = 'l',
char  valign = 'b'
) 
 

accepts multiple line text (lines separated by
)

Definition at line 286 of file GhostScript.cc.

References c_str(), show(), PLearn::split(), and x.

PStream& PLearn::GhostScript::operator<< (  char *  str  )  [inline]
 

Definition at line 103 of file GhostScript.h.

References togs.

void PLearn::GhostScript::rotate (  real  angle  )  [inline]
 

Definition at line 130 of file GhostScript.h.

References rotate(), and togs.

Referenced by rotate().

void PLearn::GhostScript::run (  const char *  filename  )  [inline]
 

Definition at line 106 of file GhostScript.h.

References PLearn::endl(), run(), and togs.

Referenced by run().

void PLearn::GhostScript::scale (  real  x,
real  y
)  [inline]
 

Definition at line 124 of file GhostScript.h.

References scale(), togs, and x.

Referenced by scale().

void PLearn::GhostScript::setcolor (  char *  colorname  ) 
 

< default is black

Definition at line 270 of file GhostScript.cc.

References setcolor().

void PLearn::GhostScript::setcolor (  real  rgb  )  [inline]
 

takes color in rgb real as returned by rgb2real

Definition at line 170 of file GhostScript.h.

References PLearn::real2rgb().

void PLearn::GhostScript::setcolor (  real  r,
real  g,
real  b
)  [inline]
 

Definition at line 166 of file GhostScript.h.

References setcolor(), and togs.

Referenced by PLearn::displayPoints(), PLearn::Grapher::plot_2D_classification(), and setcolor().

void PLearn::GhostScript::setdash (  Vec  ary,
real  x = 0
)  [inline]
 

sets the dash pattern: ary contains the cyclic on-off distances of the dashes, which begin after an offset_of x units from the current point

Definition at line 186 of file GhostScript.h.

References PLearn::TVec< T >::isEmpty(), setdash(), togs, and x.

Referenced by PLearn::displayDecisionSurface(), and setdash().

void PLearn::GhostScript::setgray (  real  g  )  [inline]
 

Definition at line 179 of file GhostScript.h.

References setgray(), and togs.

Referenced by PLearn::Grapher::plot_2D_classification(), and setgray().

void PLearn::GhostScript::setlinewidth (  real  w  )  [inline]
 

Definition at line 182 of file GhostScript.h.

References setlinewidth(), and togs.

Referenced by PLearn::displayDecisionSurface(), and setlinewidth().

void PLearn::GhostScript::show (  real  x,
real  y,
Vec  v
)  [inline]
 

Definition at line 157 of file GhostScript.h.

References PLearn::endl(), togs, PLearn::Vec, and x.

void PLearn::GhostScript::show (  real  x,
real  y,
const char *  str,
char  halign = 'l',
char  valign = 'b'
) 
 

halign can be 'l' (left), 'c' (center) or 'r' (right) valign can be 't' (top), 'm' (middle) or 'b' (bottom)

Definition at line 231 of file GhostScript.cc.

References PLearn::endl(), PLERROR, togs, and x.

void PLearn::GhostScript::show (  const char *  str  )  [inline]
 

Definition at line 144 of file GhostScript.h.

References PLearn::endl(), show(), and togs.

Referenced by multilineShow(), and show().

void PLearn::GhostScript::showpage (   )  [inline]
 

Definition at line 112 of file GhostScript.h.

References PLearn::endl(), and togs.

void PLearn::GhostScript::translate (  real  x,
real  y
)  [inline]
 

Definition at line 121 of file GhostScript.h.

References togs, translate(), and x.

Referenced by translate().

void PLearn::GhostScript::usefont (  const char *  fontname = "Times-Roman",
real  pointsize = 12.0
)  [inline]
 

Definition at line 223 of file GhostScript.h.

References PLearn::endl(), togs, and usefont().

Referenced by PLearn::displayVarGraph(), PLearn::OldDisplayVarGraph(), and usefont().

void PLearn::GhostScript::writeBitmapHexString1Bit (  const Mat &  bm,
PStream &  out,
bool  lastrowfirst = false
)  [static, protected]
 

Definition at line 120 of file GhostScript.cc.

References PLearn::TMat< T >::length(), PLearn::Mat, PLearn::PStream::put(), PLearn::TMat< T >::rowdata(), PLearn::TMat< T >::width(), and PLearn::PStream::writeAsciiHexNum().

Referenced by displayBlack().

void PLearn::GhostScript::writeBitmapHexString24Bits (  const Mat &  bm,
PStream &  out,
bool  lastrowfirst = false
)  [static, protected]
 

Definition at line 160 of file GhostScript.cc.

References PLearn::TMat< T >::length(), PLearn::real2rgb(), PLearn::TMat< T >::rowdata(), PLearn::TMat< T >::width(), and PLearn::PStream::writeAsciiHexNum().

Referenced by displayRGB().

void PLearn::GhostScript::writeBitmapHexString8Bits (  const Mat &  bm,
PStream &  out,
bool  lastrowfirst = false
)  [static, protected]
 

Definition at line 149 of file GhostScript.cc.

References PLearn::TMat< T >::length(), PLearn::TMat< T >::rowdata(), PLearn::TMat< T >::width(), and PLearn::PStream::writeAsciiHexNum().

Referenced by displayGray().


Member Data Documentation

char PLearn::GhostScript::command_string[1000] [protected]
 

Definition at line 72 of file GhostScript.h.

Referenced by GhostScript().

FILE* PLearn::GhostScript::gs_cstream [protected]
 

Definition at line 70 of file GhostScript.h.

Referenced by flush(), GhostScript(), and ~GhostScript().

bool PLearn::GhostScript::isfile [protected]
 

Definition at line 73 of file GhostScript.h.

Referenced by ~GhostScript().

PStream PLearn::GhostScript::togs [protected]
 

Definition at line 71 of file GhostScript.h.

Referenced by centerShow(), copypage(), displayBlack(), displayGray(), displayRGB(), drawBox(), drawCircle(), drawLine(), erasepage(), fillBox(), fillCircle(), flush(), GhostScript(), grestore(), gsave(), moveto(), operator<<(), rotate(), run(), scale(), setcolor(), setdash(), setgray(), setlinewidth(), show(), showpage(), translate(), usefont(), and ~GhostScript().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:05 2004 for PLearn by doxygen 1.3.7