Package ptolemy.plot
Class EPSGraphics
- java.lang.Object
 - 
- java.awt.Graphics
 - 
- ptolemy.plot.EPSGraphics
 
 
 
- 
public class EPSGraphics extends java.awt.GraphicsGraphics class supporting EPS export from plots. If this is used from within an applet, then the output goes to the standard output. Unfortunately, with standard browsers, this is not useful. With MS Internet Explorer, standard output is not available. With Netscape Navigator, standard output is available in the Java console, but is limited to fewer lines than what is usually generated. Thus, we recommend using this within Sun's appletviewer, and redirecting its standard output to a file.- Since:
 - Ptolemy II 0.2
 - Version:
 - $Id$
 - Author:
 - Edward A. Lee
 - Pt.AcceptedRating:
 - Yellow (cxh)
 - Pt.ProposedRating:
 - Yellow (cxh)
 
 
- 
- 
Constructor Summary
Constructors Constructor Description EPSGraphics(java.io.OutputStream out, int width, int height)Constructor for a graphics object that writes encapsulated PostScript to the specified output stream. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearRect(int x, int y, int width, int height)voidclipRect(int x, int y, int width, int height)voidcopyArea(int x, int y, int width, int height, int dx, int dy)java.awt.Graphicscreate()voiddispose()voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)booleandrawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)voiddrawLine(int x1, int y1, int x2, int y2)Draw a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.voiddrawOval(int x, int y, int width, int height)Draw an oval bounded by the specified rectangle with the current color.voiddrawPolygon(int[] xPoints, int[] yPoints, int nPoints)Draw a closed polygon defined by arrays of x and y coordinates.voiddrawPolyline(int[] xPoints, int[] yPoints, int nPoints)voiddrawRect(int x, int y, int width, int height)voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)voiddrawString(java.lang.String str, int x, int y)Draw a string.voiddrawString(java.text.AttributedCharacterIterator iterator, int x, int y)voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)voidfillOval(int x, int y, int width, int height)Fill an oval bounded by the specified rectangle with the current color.voidfillPolygon(int[] xPoints, int[] yPoints, int nPoints)Draw a filled polygon defined by arrays of x and y coordinates.voidfillRect(int x, int y, int width, int height)Fill the specified rectangle and draw a thin outline around it.voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)java.awt.ShapegetClip()java.awt.RectanglegetClipBounds()java.awt.ColorgetColor()Get the current color.java.awt.FontgetFont()java.awt.FontMetricsgetFontMetrics(java.awt.Font f)voidsetClip(int x, int y, int width, int height)voidsetClip(java.awt.Shape clip)voidsetColor(java.awt.Color c)Set the current color.voidsetFont(java.awt.Font font)voidsetPaintMode()voidsetXORMode(java.awt.Color c1)voidshowpage()Issue the PostScript showpage command, then write and flush the output.voidtranslate(int x, int y) 
 - 
 
- 
- 
Constructor Detail
- 
EPSGraphics
public EPSGraphics(java.io.OutputStream out, int width, int height)Constructor for a graphics object that writes encapsulated PostScript to the specified output stream. If the out argument is null, then it writes to standard output (it would write it to the clipboard, but as of this writing, writing to the clipboard does not work in Java).- Parameters:
 out- The stream to write to, or null to write to standard out.width- The width of the plot graphic, in units of 1/72 inch.height- The height of the plot graphic, in units of 1/72 inch.
 
 - 
 
- 
Method Detail
- 
clearRect
public void clearRect(int x, int y, int width, int height)- Specified by:
 clearRectin classjava.awt.Graphics
 
- 
clipRect
public void clipRect(int x, int y, int width, int height)- Specified by:
 clipRectin classjava.awt.Graphics
 
- 
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)- Specified by:
 copyAreain classjava.awt.Graphics
 
- 
create
public java.awt.Graphics create()
- Specified by:
 createin classjava.awt.Graphics
 
- 
dispose
public void dispose()
- Specified by:
 disposein classjava.awt.Graphics
 
- 
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Specified by:
 drawArcin classjava.awt.Graphics
 
- 
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)- Specified by:
 drawImagein classjava.awt.Graphics
 
- 
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)- Specified by:
 drawImagein classjava.awt.Graphics
 
- 
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
 drawImagein classjava.awt.Graphics
 
- 
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
 drawImagein classjava.awt.Graphics
 
- 
drawImage
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)- Specified by:
 drawImagein classjava.awt.Graphics
 
- 
drawImage
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
 drawImagein classjava.awt.Graphics
 
- 
drawLine
public void drawLine(int x1, int y1, int x2, int y2)Draw a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.- Specified by:
 drawLinein classjava.awt.Graphics- Parameters:
 x1- the x coordinate of the first point.y1- the y coordinate of the first point.x2- the x coordinate of the second point.y2- the y coordinate of the second point.
 
- 
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)- Specified by:
 drawPolylinein classjava.awt.Graphics
 
- 
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)Draw a closed polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a vertex. The third argument gives the number of vertices. If the arrays are not long enough to define this many vertices, or if the third argument is less than three, then nothing is drawn.- Specified by:
 drawPolygonin classjava.awt.Graphics- Parameters:
 xPoints- An array of x coordinates.yPoints- An array of y coordinates.nPoints- The total number of vertices.
 
- 
drawOval
public void drawOval(int x, int y, int width, int height)Draw an oval bounded by the specified rectangle with the current color.- Specified by:
 drawOvalin classjava.awt.Graphics- Parameters:
 x- The x coordinate of the upper left cornery- The y coordinate of the upper left cornerwidth- The width of the oval to be filled.height- The height of the oval to be filled.
 
- 
drawRect
public void drawRect(int x, int y, int width, int height)- Overrides:
 drawRectin classjava.awt.Graphics
 
- 
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Specified by:
 drawRoundRectin classjava.awt.Graphics
 
- 
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)- Specified by:
 drawStringin classjava.awt.Graphics
 
- 
drawString
public void drawString(java.lang.String str, int x, int y)Draw a string. "(" is converted to "\(" and ")" is converted to "\) so as to avoid EPS Syntax errors.- Specified by:
 drawStringin classjava.awt.Graphics- Parameters:
 str- The string to draw.x- The x location of the string.y- The y location of the string.
 
- 
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Specified by:
 fillArcin classjava.awt.Graphics
 
- 
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)Draw a filled polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a vertex. The third argument gives the number of vertices. If the arrays are not long enough to define this many vertices, or if the third argument is less than three, then nothing is drawn.- Specified by:
 fillPolygonin classjava.awt.Graphics- Parameters:
 xPoints- An array of x coordinates.yPoints- An array of y coordinates.nPoints- The total number of vertices.
 
- 
fillOval
public void fillOval(int x, int y, int width, int height)Fill an oval bounded by the specified rectangle with the current color.- Specified by:
 fillOvalin classjava.awt.Graphics- Parameters:
 x- The x coordinate of the upper left cornery- The y coordinate of the upper left cornerwidth- The width of the oval to be filled.height- The height of the oval to be filled.
 
- 
fillRect
public void fillRect(int x, int y, int width, int height)Fill the specified rectangle and draw a thin outline around it. The left and right edges of the rectangle are at x and x + width - 1. The top and bottom edges are at y and y + height - 1. The resulting rectangle covers an area width pixels wide by height pixels tall. The rectangle is filled using the brightness of the current color to set the level of gray.- Specified by:
 fillRectin classjava.awt.Graphics- Parameters:
 x- The x coordinate of the top left corner.y- The y coordinate of the top left corner.width- The width of the rectangle.height- The height of the rectangle.
 
- 
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Specified by:
 fillRoundRectin classjava.awt.Graphics
 
- 
getClip
public java.awt.Shape getClip()
- Specified by:
 getClipin classjava.awt.Graphics
 
- 
getClipBounds
public java.awt.Rectangle getClipBounds()
- Specified by:
 getClipBoundsin classjava.awt.Graphics
 
- 
getColor
public java.awt.Color getColor()
Get the current color.- Specified by:
 getColorin classjava.awt.Graphics- Returns:
 - The current color.
 - See Also:
 setColor(Color)
 
- 
getFont
public java.awt.Font getFont()
- Specified by:
 getFontin classjava.awt.Graphics
 
- 
getFontMetrics
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
- Specified by:
 getFontMetricsin classjava.awt.Graphics
 
- 
setFont
public void setFont(java.awt.Font font)
- Specified by:
 setFontin classjava.awt.Graphics
 
- 
setClip
public void setClip(java.awt.Shape clip)
- Specified by:
 setClipin classjava.awt.Graphics
 
- 
setClip
public void setClip(int x, int y, int width, int height)- Specified by:
 setClipin classjava.awt.Graphics
 
- 
setColor
public void setColor(java.awt.Color c)
Set the current color. Since we are generating gray scale postscript, set a line style. Set the gray level to zero (black).- Specified by:
 setColorin classjava.awt.Graphics- Parameters:
 c- The desired current color.- See Also:
 getColor()
 
- 
setPaintMode
public void setPaintMode()
- Specified by:
 setPaintModein classjava.awt.Graphics
 
- 
setXORMode
public void setXORMode(java.awt.Color c1)
- Specified by:
 setXORModein classjava.awt.Graphics
 
- 
showpage
public void showpage()
Issue the PostScript showpage command, then write and flush the output. If the output argument of the constructor was null, then write to the clipboard. 
- 
translate
public void translate(int x, int y)- Specified by:
 translatein classjava.awt.Graphics
 
 - 
 
 -