|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Graphics java.awt.Graphics2D comirva.visu.epsgraphics.EpsGraphics2D
public class EpsGraphics2D
This class provides postscript generation.
Use this class just like the Graphics2D
class
to draw geometric figures.
Usage: Process every drawing operation (except redrawing after
resizing/restoring the window), coordinate system transformation,
color or font setting, clipping, stroke type changing etc.
that you perform on the standard graphics object (for screen
output) on this class too. This class will save every information
necessary for postscript output. Moreover, you can add comments
to the postscript source file. If you want to generate the
output just call either the toPS()
or toEPS()
method.
Constructor Summary | |
---|---|
EpsGraphics2D()
|
Method Summary | |
---|---|
void |
addComment(String comment)
Adds an eps comment. |
void |
addRenderingHints(Map<?,?> hints)
|
void |
clearRect(int x,
int y,
int width,
int height)
|
void |
clip(Shape s)
|
void |
clipRect(int x,
int y,
int width,
int height)
|
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
|
Graphics |
create()
|
void |
dispose()
|
void |
draw(Shape shp)
|
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
|
void |
drawArc(int xpos,
int ypos,
int width,
int height,
int start,
int extend)
|
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
|
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
|
void |
drawGlyphVector(GlyphVector g,
float x,
float y)
|
void |
drawImage(BufferedImage img,
BufferedImageOp op,
int x,
int y)
|
boolean |
drawImage(Image img,
AffineTransform xform,
ImageObserver obs)
|
boolean |
drawImage(Image img,
int x,
int y,
Color bgcolor,
ImageObserver observer)
|
boolean |
drawImage(Image img,
int x,
int y,
ImageObserver obs)
|
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
ImageObserver observer)
|
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver obs)
|
boolean |
drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgcolor,
ImageObserver observer)
|
boolean |
drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
|
void |
drawLine(int x1,
int y1,
int x2,
int y2)
|
void |
drawOval(int x,
int y,
int width,
int height)
|
void |
drawPolygon(int[] x,
int[] y,
int n)
|
void |
drawPolygon(Polygon p)
|
void |
drawPolyline(int[] x,
int[] y,
int n)
|
void |
drawRect(int x,
int y,
int width,
int height)
|
void |
drawRenderableImage(RenderableImage img,
AffineTransform xform)
|
void |
drawRenderedImage(RenderedImage img,
AffineTransform xform)
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
|
void |
drawString(AttributedCharacterIterator iterator,
float x,
float y)
|
void |
drawString(AttributedCharacterIterator iterator,
int x,
int y)
|
void |
drawString(String str,
float x,
float y)
|
void |
drawString(String str,
int x,
int y)
|
void |
fill(Shape shp)
|
void |
fillArc(int xpos,
int ypos,
int width,
int height,
int start,
int extend)
|
void |
fillOval(int x,
int y,
int width,
int height)
|
void |
fillPolygon(int[] x,
int[] y,
int n)
|
void |
fillRect(int x,
int y,
int width,
int height)
|
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
|
Color |
getBackground()
|
Shape |
getClip()
|
Rectangle |
getClipBounds()
|
Color |
getColor()
|
Composite |
getComposite()
|
GraphicsConfiguration |
getDeviceConfiguration()
|
Font |
getFont()
|
FontMetrics |
getFontMetrics(Font f)
|
FontRenderContext |
getFontRenderContext()
|
Paint |
getPaint()
|
Object |
getRenderingHint(RenderingHints.Key hintKey)
|
RenderingHints |
getRenderingHints()
|
Stroke |
getStroke()
|
AffineTransform |
getTransform()
|
Color |
getXORColor()
|
boolean |
hit(Rectangle rect,
Shape s,
boolean onStroke)
|
boolean |
paintMode()
|
void |
rotate(double theta)
|
void |
rotate(double theta,
double x,
double y)
|
void |
rotateGrade(double theta)
just the same as the rotate(double) method,
except that the parameter is treated as degree value (0..360) |
void |
rotateGrade(double theta,
double x,
double y)
just the same as the rotate(double, double, double) method,
except that the angle parameter is treated as a degree value (0..360) |
void |
scale(double sx,
double sy)
|
void |
setBackground(Color bgcolor)
|
void |
setClip(int x,
int y,
int width,
int height)
|
void |
setClip(Shape clip)
|
void |
setColor(Color c)
If no other operation has been performed since the last call to setColor() , the last color object will be replaced
by that one given now. |
void |
setComposite(Composite comp)
|
void |
setFamilyFont(Font f)
sets the current font to f. |
void |
setFont(Font f)
|
void |
setPaint(Paint paint)
|
void |
setPaintMode()
|
void |
setPSFont(Font f)
sets the current font to f. |
void |
setRenderingHint(RenderingHints.Key hintKey,
Object hintValue)
|
void |
setRenderingHints(Map<?,?> hints)
|
void |
setStroke(Stroke s)
|
void |
setTransform(AffineTransform tx)
|
void |
setXORMode(Color cl)
|
void |
shear(double shx,
double shy)
|
String |
toEPS()
Creates the eps code representing the current graphics. |
String |
toEPS(Rectangle boundingBox)
Creates the eps code representing the current graphics. |
String |
toEPS(Rectangle boundingBox,
Writer w)
Creates the eps code representing the current graphics. |
String |
toEps(String title,
Rectangle boundingBox)
Creates the eps code representing the current graphics. |
String |
toEps(String title,
Rectangle boundingBox,
Writer w)
Creates the eps code representing the current graphics. |
String |
toEPS(String title,
String filename,
Rectangle boundingBox)
Creates the eps code representing the current graphics and using the given parameters |
String |
toEPS(String title,
String filename,
Rectangle boundingBox,
Writer w)
Constructs a string representing the current graphics as encapsulated postscript data. |
String |
toEPS(Writer w)
Creates the eps code representing the current graphics. |
String |
toPS()
Constructs PS string that represents the current graphics as postscript data. |
String |
toPS(Writer w)
Constructs PS string that represents the current graphics as postscript data. |
void |
transform(AffineTransform tx)
|
void |
translate(double x,
double y)
|
void |
translate(int x,
int y)
|
Methods inherited from class java.awt.Graphics2D |
---|
fill3DRect |
Methods inherited from class java.awt.Graphics |
---|
create, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EpsGraphics2D()
Method Detail |
---|
public void draw3DRect(int x, int y, int width, int height, boolean raised)
draw3DRect
in class Graphics2D
public void drawBytes(byte[] data, int offset, int length, int x, int y)
drawBytes
in class Graphics
public void drawChars(char[] data, int offset, int length, int x, int y)
drawChars
in class Graphics
public void drawPolygon(Polygon p)
drawPolygon
in class Graphics
public void draw(Shape shp)
draw
in class Graphics2D
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
drawImage
in class Graphics2D
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
drawImage
in class Graphics2D
public void drawRenderedImage(RenderedImage img, AffineTransform xform)
drawRenderedImage
in class Graphics2D
public void drawRenderableImage(RenderableImage img, AffineTransform xform)
drawRenderableImage
in class Graphics2D
public void drawString(String str, int x, int y)
drawString
in class Graphics2D
public void drawString(String str, float x, float y)
drawString
in class Graphics2D
public void drawString(AttributedCharacterIterator iterator, int x, int y)
drawString
in class Graphics2D
public void drawString(AttributedCharacterIterator iterator, float x, float y)
drawString
in class Graphics2D
public void drawGlyphVector(GlyphVector g, float x, float y)
drawGlyphVector
in class Graphics2D
public void fill(Shape shp)
fill
in class Graphics2D
public boolean hit(Rectangle rect, Shape s, boolean onStroke)
hit
in class Graphics2D
public GraphicsConfiguration getDeviceConfiguration()
getDeviceConfiguration
in class Graphics2D
public void setComposite(Composite comp)
setComposite
in class Graphics2D
public void setPaint(Paint paint)
setPaint
in class Graphics2D
public void setStroke(Stroke s)
setStroke
in class Graphics2D
public void setRenderingHints(Map<?,?> hints)
setRenderingHints
in class Graphics2D
public void addRenderingHints(Map<?,?> hints)
addRenderingHints
in class Graphics2D
public RenderingHints getRenderingHints()
getRenderingHints
in class Graphics2D
public void translate(int x, int y)
translate
in class Graphics2D
public void translate(double x, double y)
translate
in class Graphics2D
public void rotate(double theta)
rotate
in class Graphics2D
public void rotateGrade(double theta)
rotate(double)
method,
except that the parameter is treated as degree value (0..360)
theta
- angle in degreerotate(double)
public void rotate(double theta, double x, double y)
rotate
in class Graphics2D
public void rotateGrade(double theta, double x, double y)
rotate(double, double, double)
method,
except that the angle parameter is treated as a degree value (0..360)
theta
- angle in degreex
- the x positiony
- the y positionrotate(double, double, double)
public void scale(double sx, double sy)
scale
in class Graphics2D
public void shear(double shx, double shy)
shear
in class Graphics2D
public void transform(AffineTransform tx)
transform
in class Graphics2D
public void setTransform(AffineTransform tx)
setTransform
in class Graphics2D
public AffineTransform getTransform()
getTransform
in class Graphics2D
public Paint getPaint()
getPaint
in class Graphics2D
public Composite getComposite()
getComposite
in class Graphics2D
public void setBackground(Color bgcolor)
setBackground
in class Graphics2D
public Color getBackground()
getBackground
in class Graphics2D
public Stroke getStroke()
getStroke
in class Graphics2D
public void clip(Shape s)
clip
in class Graphics2D
public FontRenderContext getFontRenderContext()
getFontRenderContext
in class Graphics2D
public Graphics create()
create
in class Graphics
public Color getColor()
getColor
in class Graphics
public void setColor(Color c)
setColor()
, the last color object will be replaced
by that one given now.
setColor
in class Graphics
public void setPaintMode()
setPaintMode
in class Graphics
public void setXORMode(Color cl)
setXORMode
in class Graphics
public Font getFont()
getFont
in class Graphics
public void setFont(Font f)
setFont
in class Graphics
public void setPSFont(Font f)
Font.getPSName()
) will be used
in the findfont
command.
f
- the new fontpublic void setFamilyFont(Font f)
Font.getFamily()
) will be used
in the findfont
command.
f
- the new fontpublic FontMetrics getFontMetrics(Font f)
getFontMetrics
in class Graphics
public Rectangle getClipBounds()
getClipBounds
in class Graphics
public void clipRect(int x, int y, int width, int height)
clipRect
in class Graphics
public void setClip(int x, int y, int width, int height)
setClip
in class Graphics
public Shape getClip()
getClip
in class Graphics
public void setClip(Shape clip)
setClip
in class Graphics
public void copyArea(int x, int y, int width, int height, int dx, int dy)
copyArea
in class Graphics
public void drawLine(int x1, int y1, int x2, int y2)
drawLine
in class Graphics
public void fillRect(int x, int y, int width, int height)
fillRect
in class Graphics
public void clearRect(int x, int y, int width, int height)
clearRect
in class Graphics
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect
in class Graphics
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
fillRoundRect
in class Graphics
public void drawOval(int x, int y, int width, int height)
drawOval
in class Graphics
public void fillOval(int x, int y, int width, int height)
fillOval
in class Graphics
public void drawArc(int xpos, int ypos, int width, int height, int start, int extend)
drawArc
in class Graphics
public void fillArc(int xpos, int ypos, int width, int height, int start, int extend)
fillArc
in class Graphics
public void drawPolyline(int[] x, int[] y, int n)
drawPolyline
in class Graphics
public void drawPolygon(int[] x, int[] y, int n)
drawPolygon
in class Graphics
public void fillPolygon(int[] x, int[] y, int n)
fillPolygon
in class Graphics
public boolean drawImage(Image img, int x, int y, ImageObserver obs)
drawImage
in class Graphics
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver obs)
drawImage
in class Graphics
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
drawImage
in class Graphics
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 dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, 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, Color bgcolor, ImageObserver observer)
drawImage
in class Graphics
public void dispose()
dispose
in class Graphics
public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
setRenderingHint
in class Graphics2D
public Object getRenderingHint(RenderingHints.Key hintKey)
getRenderingHint
in class Graphics2D
public void addComment(String comment)
comment
- The comment text. The comment indicator '%' is automatically
added in every new line. You do not have to include it in the String parameter!public String toPS() throws IOException
IOException
public String toPS(Writer w) throws IOException
w
- the writer that the code should be printed to
IOException
public String toEPS(String title, String filename, Rectangle boundingBox, Writer w) throws IOException
title
- the Document title. If null an empty title is addedfilename
- the name of the file the code is going to be written to.
If null
no filename comment will be addedboundingBox
- the bounding box information. If null
,
a DIN A4 page (612x792 mm) is assumed as bounding box.
IOException
public String toEPS(String title, String filename, Rectangle boundingBox) throws IOException
title
- graphics titlefilename
- the filenameboundingBox
- the bounding box
IOException
public String toEPS(Writer w) throws IOException
w
- the output stream that the code should be printed to
IOException
public String toEPS() throws IOException
IOException
toEPS(String title, String filename, Rectangle boundingBox)
public String toEPS(Rectangle boundingBox) throws IOException
boundingBox
- The bounding box of the graphics
IOException
toEPS(String title, String filename, Rectangle boundingBox)
public String toEPS(Rectangle boundingBox, Writer w) throws IOException
boundingBox
- The bounding box of the graphicsw
- the outputstream that the code should be printed to
IOException
toEPS(String title, String filename, Rectangle boundingBox)
public String toEps(String title, Rectangle boundingBox) throws IOException
title
- The title of the graphicboundingBox
- The bounding box
IOException
toEPS(String title, String filename, Rectangle boundingBox)
public String toEps(String title, Rectangle boundingBox, Writer w) throws IOException
title
- The title of the graphicboundingBox
- The bounding boxw
- The outputstream the code should be printed to
IOException
toEPS(String title, String filename, Rectangle boundingBox)
public void drawRect(int x, int y, int width, int height)
drawRect
in class Graphics
Graphics.drawRect(int, int, int, int)
public Color getXORColor()
public boolean paintMode()
true
for standard paint mode
false
for xor mode.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |