|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Graphics
java.awt.Graphics2D
weka.gui.visualize.PostscriptGraphics
public class PostscriptGraphics
The PostscriptGraphics class extends the Graphics2D class to produce an encapsulated postscript file rather than on-screen display.
Currently only a small (but useful) subset of Graphics methods have been implemented. To handle the ability to Clone a Graphics object, the graphics state of the eps is set from the graphics state of the local PostscriptGraphics before output. To use, create a PostscriptGraphics object, and pass it to the PaintComponent method of a JComponent.
If necessary additional font replacements can be inserted, since some fonts might be displayed incorrectly.
addPSFontReplacement(String, String),
m_PSFontReplacement| Constructor Summary | |
|---|---|
PostscriptGraphics(int width,
int height,
OutputStream os)
Constructor Creates a new PostscriptGraphics object, given dimensions and output file. |
|
| Method Summary | |
|---|---|
static void |
addPSFontReplacement(String replace,
String with)
adds the PS font name to replace and its replacement in the replacement hashtable |
void |
addRenderingHints(Map m)
|
void |
clearRect(int x,
int y,
int width,
int height)
Draw a filled rectangle with the background color. |
void |
clip(Shape s)
|
void |
clipRect(int x,
int y,
int width,
int height)
Not implemented |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Not implemented |
Graphics |
create()
Clone a PostscriptGraphics object |
void |
dispose()
Not implemented |
void |
draw(Shape s)
|
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draw an outlined rectangle with 3D effect in current pen color. |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Not implemented |
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
simply calls drawString(String,int,int) |
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
simply calls drawString(String,int,int) |
void |
drawGlyphVector(GlyphVector gv,
float f1,
float f2)
|
void |
drawImage(BufferedImage bi,
BufferedImageOp bio,
int i1,
int i2)
|
boolean |
drawImage(Image im,
AffineTransform at,
ImageObserver io)
|
boolean |
drawImage(Image img,
int x,
int y,
Color bgcolor,
ImageObserver observer)
calls drawImage(Image,int,int,int,int,Color,ImageObserver) |
boolean |
drawImage(Image img,
int x,
int y,
ImageObserver observer)
calls drawImage(Image,int,int,Color,ImageObserver) with Color.WHITE as background color |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
ImageObserver observer)
PS see http://astronomy.swin.edu.au/~pbourke/geomformats/postscript/ Java http://show.docjava.com:8086/book/cgij/doc/ip/graphics/SimpleImageFrame.java.html |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver observer)
calls drawImage(Image,int,int,int,int,Color,ImageObserver) with the color WHITE as background |
boolean |
drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgcolor,
ImageObserver observer)
Not implemented |
boolean |
drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
calls drawImage(Image,int,int,int,int,int,int,int,int,Color,ImageObserver) with Color.WHITE as background color |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draw a line in current pen color. |
void |
drawOval(int x,
int y,
int width,
int height)
Draw an Oval outline in current pen color. |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Not implemented |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
Not implemented |
void |
drawRect(int x,
int y,
int width,
int height)
Draw an outlined rectangle in current pen color. |
void |
drawRenderableImage(RenderableImage ri,
AffineTransform at)
|
void |
drawRenderedImage(RenderedImage ri,
AffineTransform af)
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Not implemented |
void |
drawString(AttributedCharacterIterator aci,
float f1,
float f2)
|
void |
drawString(AttributedCharacterIterator iterator,
int x,
int y)
Not implemented |
void |
drawString(String str,
float x,
float y)
|
void |
drawString(String str,
int x,
int y)
Draw text in current pen color. |
void |
fill(Shape s)
|
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draw a filled rectangle with 3D effect in current pen color. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Not implemented |
void |
fillOval(int x,
int y,
int width,
int height)
Draw a filled Oval in current pen color. |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Not implemented |
void |
fillPolygon(Polygon p)
Not implemented |
void |
fillRect(int x,
int y,
int width,
int height)
Draw a filled rectangle in current pen color. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Not implemented |
void |
finalize()
Not implemented |
void |
finished()
Finalizes output file. |
Color |
getBackground()
|
Shape |
getClip()
Not implemented |
Rectangle |
getClipBounds()
This returns the full current drawing area |
Rectangle |
getClipBounds(Rectangle r)
This returns the full current drawing area |
Rectangle |
getClipRect()
Not implemented |
Color |
getColor()
Get current pen color. |
Composite |
getComposite()
|
GraphicsConfiguration |
getDeviceConfiguration()
|
Font |
getFont()
Get current font. |
FontMetrics |
getFontMetrics(Font f)
Get Font metrics |
FontRenderContext |
getFontRenderContext()
START overridden Graphics2D methods |
Paint |
getPaint()
|
Object |
getRenderingHint(RenderingHints.Key key)
|
RenderingHints |
getRenderingHints()
|
Stroke |
getStroke()
|
AffineTransform |
getTransform()
|
boolean |
hit(Rectangle r,
Shape s,
boolean onstroke)
|
void |
rotate(double d1)
|
void |
rotate(double d1,
double d2,
double d3)
|
void |
scale(double d1,
double d2)
|
void |
setBackground(Color c)
|
void |
setClip(int x,
int y,
int width,
int height)
Not implemented |
void |
setClip(Shape clip)
Not implemented |
void |
setColor(Color c)
Set current pen color. |
void |
setComposite(Composite c)
|
void |
setFont(Font font)
Set current font. |
void |
setPaint(Paint p)
|
void |
setPaintMode()
Not implemented |
void |
setRenderingHint(RenderingHints.Key key,
Object o)
|
void |
setRenderingHints(Map m)
|
void |
setStroke(Stroke s)
|
void |
setTransform(AffineTransform at)
|
void |
setXORMode(Color c1)
Not implemented |
void |
shear(double d1,
double d2)
|
void |
transform(AffineTransform at)
|
void |
translate(double d1,
double d2)
|
void |
translate(int x,
int y)
Translates the origin of the graphics context to the point (x, y) in the current coordinate system. |
| Methods inherited from class java.awt.Graphics |
|---|
create, drawPolygon, getFontMetrics, hitClip, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PostscriptGraphics(int width,
int height,
OutputStream os)
width - The width of eps in points.height - The height of eps in points.os - File to send postscript to.| Method Detail |
|---|
public void finished()
public static void addPSFontReplacement(String replace,
String with)
replace - the PS font name to replacewith - the PS font name to replace the font with
public void clearRect(int x,
int y,
int width,
int height)
clearRect in class Graphicsx - starting x coordy - starting y coordwidth - rectangle widthheight - rectangle height
public void clipRect(int x,
int y,
int width,
int height)
clipRect in class Graphics
public void copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
copyArea in class Graphicspublic Graphics create()
create in class Graphicspublic void dispose()
dispose in class Graphics
public void draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
draw3DRect in class Graphics2Dx - starting x coordy - starting y coordwidth - rectangle widthheight - rectangle heightraised - True: appear raised, False: appear etched
public void drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
drawArc in class Graphics
public void drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
drawBytes in class GraphicsdrawString(String,int,int)
public void drawChars(char[] data,
int offset,
int length,
int x,
int y)
drawChars in class GraphicsdrawString(String,int,int)
public boolean drawImage(Image img,
int x,
int y,
Color bgcolor,
ImageObserver observer)
drawImage in class GraphicsdrawImage(Image,int,int,int,int,Color,ImageObserver)
public boolean drawImage(Image img,
int x,
int y,
ImageObserver observer)
drawImage in class GraphicsdrawImage(Image,int,int,Color,ImageObserver),
Color.WHITE
public boolean drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
ImageObserver observer)
drawImage in class Graphics
public boolean drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver observer)
drawImage in class GraphicsdrawImage(Image,int,int,int,int,Color,ImageObserver),
Color.WHITE
public boolean drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgcolor,
ImageObserver observer)
drawImage in class Graphics
public boolean drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
drawImage in class GraphicsdrawImage(Image,int,int,int,int,int,int,int,int,Color,ImageObserver)
public void drawLine(int x1,
int y1,
int x2,
int y2)
drawLine in class Graphicsx1 - starting x coordy1 - starting y coordx2 - ending x coordy2 - ending y coord
public void drawOval(int x,
int y,
int width,
int height)
drawOval in class Graphicsx - x-axis center of ovaly - y-axis center of ovalwidth - oval widthheight - oval height
public void drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
drawPolygon in class Graphics
public void drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
drawPolyline in class Graphics
public void drawRect(int x,
int y,
int width,
int height)
drawRect in class Graphicsx - starting x coordy - starting y coordwidth - rectangle widthheight - rectangle height
public void drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
drawRoundRect in class Graphics
public void drawString(AttributedCharacterIterator iterator,
int x,
int y)
drawString in class Graphics2D
public void drawString(String str,
int x,
int y)
drawString in class Graphics2Dstr - Text to outputx - starting x coordy - starting y coord
public void fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
fill3DRect in class Graphics2Dx - starting x coordy - starting y coordwidth - rectangle widthheight - rectangle heightraised - True: appear raised, False: appear etched
public void fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
fillArc in class Graphics
public void fillOval(int x,
int y,
int width,
int height)
fillOval in class Graphicsx - x-axis center of ovaly - y-axis center of ovalwidth - oval widthheight - oval height
public void fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
fillPolygon in class Graphicspublic void fillPolygon(Polygon p)
fillPolygon in class Graphics
public void fillRect(int x,
int y,
int width,
int height)
fillRect in class Graphicsx - starting x coordy - starting y coordwidth - rectangle widthheight - rectangle height
public void fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
fillRoundRect in class Graphicspublic void finalize()
finalize in class Graphicspublic Shape getClip()
getClip in class Graphicspublic Rectangle getClipBounds()
getClipBounds in class Graphicspublic Rectangle getClipBounds(Rectangle r)
getClipBounds in class Graphicspublic Rectangle getClipRect()
getClipRect in class Graphicspublic Color getColor()
getColor in class Graphicspublic Font getFont()
getFont in class Graphicspublic FontMetrics getFontMetrics(Font f)
getFontMetrics in class Graphicsf - Font
public void setClip(int x,
int y,
int width,
int height)
setClip in class Graphicspublic void setClip(Shape clip)
setClip in class Graphicspublic void setColor(Color c)
setColor in class Graphicsc - new pen color.public void setFont(Font font)
setFont in class Graphicsfont - new font.public void setPaintMode()
setPaintMode in class Graphicspublic void setXORMode(Color c1)
setXORMode in class Graphics
public void translate(int x,
int y)
translate in class Graphics2Dx - the x coordinate.y - the y coordinate.public FontRenderContext getFontRenderContext()
getFontRenderContext in class Graphics2Dpublic void clip(Shape s)
clip in class Graphics2Dpublic Stroke getStroke()
getStroke in class Graphics2Dpublic Color getBackground()
getBackground in class Graphics2Dpublic void setBackground(Color c)
setBackground in class Graphics2Dpublic Composite getComposite()
getComposite in class Graphics2Dpublic Paint getPaint()
getPaint in class Graphics2Dpublic AffineTransform getTransform()
getTransform in class Graphics2Dpublic void setTransform(AffineTransform at)
setTransform in class Graphics2Dpublic void transform(AffineTransform at)
transform in class Graphics2D
public void shear(double d1,
double d2)
shear in class Graphics2D
public void scale(double d1,
double d2)
scale in class Graphics2D
public void rotate(double d1,
double d2,
double d3)
rotate in class Graphics2Dpublic void rotate(double d1)
rotate in class Graphics2D
public void translate(double d1,
double d2)
translate in class Graphics2Dpublic RenderingHints getRenderingHints()
getRenderingHints in class Graphics2Dpublic void addRenderingHints(Map m)
addRenderingHints in class Graphics2Dpublic void setRenderingHints(Map m)
setRenderingHints in class Graphics2Dpublic Object getRenderingHint(RenderingHints.Key key)
getRenderingHint in class Graphics2D
public void setRenderingHint(RenderingHints.Key key,
Object o)
setRenderingHint in class Graphics2Dpublic void setStroke(Stroke s)
setStroke in class Graphics2Dpublic void setPaint(Paint p)
setPaint in class Graphics2Dpublic void setComposite(Composite c)
setComposite in class Graphics2Dpublic GraphicsConfiguration getDeviceConfiguration()
getDeviceConfiguration in class Graphics2D
public boolean hit(Rectangle r,
Shape s,
boolean onstroke)
hit in class Graphics2Dpublic void fill(Shape s)
fill in class Graphics2D
public void drawGlyphVector(GlyphVector gv,
float f1,
float f2)
drawGlyphVector in class Graphics2D
public void drawString(AttributedCharacterIterator aci,
float f1,
float f2)
drawString in class Graphics2D
public void drawString(String str,
float x,
float y)
drawString in class Graphics2D
public void drawRenderableImage(RenderableImage ri,
AffineTransform at)
drawRenderableImage in class Graphics2D
public void drawRenderedImage(RenderedImage ri,
AffineTransform af)
drawRenderedImage in class Graphics2D
public void drawImage(BufferedImage bi,
BufferedImageOp bio,
int i1,
int i2)
drawImage in class Graphics2D
public boolean drawImage(Image im,
AffineTransform at,
ImageObserver io)
drawImage in class Graphics2Dpublic void draw(Shape s)
draw in class Graphics2D
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||