|
FreeHEP API Version current |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Graphics
java.awt.Graphics2D
org.freehep.graphics2d.VectorGraphics
org.freehep.graphics2d.AbstractVectorGraphics
org.freehep.graphicsio.VectorGraphicsIO
org.freehep.graphicsio.AbstractVectorGraphicsIO
This class provides an abstract VectorGraphicsIO class for specific output drivers.
| Field Summary | |
static String |
EMIT_ERRORS
|
static String |
EMIT_WARNINGS
|
| Fields inherited from interface org.freehep.graphics2d.VectorGraphicsConstants |
NUMBER_OF_HORIZ_ALIGNMENTS, NUMBER_OF_SYMBOLS, NUMBER_OF_VERTICAL_ALIGNMENTS, SYMBOL_BOX, SYMBOL_CIRCLE, SYMBOL_CROSS, SYMBOL_DIAMOND, SYMBOL_DN_TRIANGLE, SYMBOL_HLINE, SYMBOL_PLUS, SYMBOL_STAR, SYMBOL_UP_TRIANGLE, SYMBOL_VLINE, TEXT_BASELINE, TEXT_BOTTOM, TEXT_CENTER, TEXT_LEFT, TEXT_RIGHT, TEXT_TOP |
| Constructor Summary | |
protected |
AbstractVectorGraphicsIO(AbstractVectorGraphicsIO graphics,
boolean doRestoreOnDispose)
Constructs a subgraphics context. |
protected |
AbstractVectorGraphicsIO(Component component,
boolean doRestoreOnDispose)
Constructs a Graphics context with the following graphics state: Paint: The color of the component. |
protected |
AbstractVectorGraphicsIO(Dimension size,
boolean doRestoreOnDispose)
Constructs a Graphics context with the following graphics state: Paint: black Font: Dailog, Plain, 12pt Stroke: Linewidth 1.0; No Dashing; Miter Join Style; Miter Limit 10; Square Endcaps; Transform: Identity Composite: AlphaComposite.SRC_OVER Clip: Rectangle(0, 0, size.width, size.height) |
| Method Summary | |
void |
addRenderingHints(Map hints)
Adds to table of rendering hints. |
void |
clearRect(double x,
double y,
double width,
double height)
Clears rectangle by painting it with the backgroundColor. |
void |
clip(Shape s)
Clips using given shape. |
void |
clipRect(double x,
double y,
double width,
double height)
Clips rectangle. |
void |
clipRect(int x,
int y,
int width,
int height)
Clips rectangle. |
abstract void |
closeStream()
Called to close the stream you are writing to. |
protected Shape |
createShape(double[] xPoints,
double[] yPoints,
int nPoints,
boolean close)
Creates a polyline/polygon shape from a set of points. |
void |
dispose()
Disposes of the graphics context. |
void |
drawGlyphVector(GlyphVector g,
float x,
float y)
|
void |
drawImage(BufferedImage img,
BufferedImageOp op,
int x,
int y)
|
boolean |
drawImage(Image image,
AffineTransform xform,
ImageObserver observer)
|
boolean |
drawImage(Image image,
int x,
int y,
Color bgColor,
ImageObserver observer)
|
boolean |
drawImage(Image image,
int x,
int y,
ImageObserver observer)
|
boolean |
drawImage(Image image,
int x,
int y,
int width,
int height,
Color bgColor,
ImageObserver observer)
|
boolean |
drawImage(Image image,
int x,
int y,
int width,
int height,
ImageObserver observer)
|
boolean |
drawImage(Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgColor,
ImageObserver observer)
Draw and resizes (transparent) image. |
boolean |
drawImage(Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
|
void |
drawRenderableImage(RenderableImage image,
AffineTransform xform)
|
void |
drawRenderedImage(RenderedImage image,
AffineTransform xform)
Draws a rendered image using a transform. |
void |
drawString(AttributedCharacterIterator iterator,
float x,
float y)
|
void |
drawString(String string,
double x,
double y)
Draws a string. |
void |
drawString(String str,
double x,
double y,
int horizontal,
int vertical,
boolean framed,
Color frameColor,
double frameWidth,
boolean banner,
Color bannerColor)
Draws a string with a lot of parameters. |
void |
drawString(TagString str,
double x,
double y,
int horizontal,
int vertical,
boolean framed,
Color frameColor,
double frameWidth,
boolean banner,
Color bannerColor)
Draws a TagString with a lot of parameters. |
void |
endExport()
|
Shape |
getClip()
Gets the current clip in form of a Shape (Rectangle). |
Rectangle |
getClipBounds()
Gets the current clip in form of a Rectangle. |
Rectangle |
getClipBounds(Rectangle r)
Gets the current clip in form of a Rectangle. |
Component |
getComponent()
|
Composite |
getComposite()
Gets current composite. |
FontMetrics |
getFontMetrics(Font font)
Gets the fontmetrics. |
FontRenderContext |
getFontRenderContext()
Gets the current font render context. |
Object |
getRenderingHint(RenderingHints.Key key)
Gets a given rendering hint. |
RenderingHints |
getRenderingHints()
Gets a copy of the rendering hints. |
Dimension |
getSize()
|
Stroke |
getStroke()
Get the current stroke. |
AffineTransform |
getTransform()
Get the current transform. |
protected void |
handleException(Exception exception)
Handles an exception which has been caught. |
void |
printComment(String comment)
|
protected void |
resetClip(Rectangle clip)
|
void |
rotate(double theta)
Rotate the current transform over the Z-axis. |
void |
scale(double sx,
double sy)
Scales the current transform. |
void |
setClip(double x,
double y,
double width,
double height)
Clips rectangle. |
void |
setClip(int x,
int y,
int width,
int height)
Clips rectangle. |
void |
setClip(Shape shape)
Clips shape. |
void |
setColor(Color color)
Sets the current color and the current paint. |
void |
setComposite(Composite composite)
Sets current composite. |
void |
setPaint(Paint paint)
Sets the current paint. |
void |
setRenderingHint(RenderingHints.Key key,
Object hint)
Sets a given rendering hint. |
void |
setRenderingHints(Map hints)
Sets table of rendering hints. |
void |
setStroke(Stroke stroke)
Sets the current stroke. |
void |
setTransform(AffineTransform transform)
Set the current transform. |
void |
shear(double shx,
double shy)
Shears the current transform. |
void |
startExport()
|
void |
transform(AffineTransform transform)
Transforms the current transform. |
void |
translate(double x,
double y)
Translates the current transform. |
abstract void |
writeBackground()
|
protected void |
writeCap(int cap)
Writes out the cap of the stroke. |
protected void |
writeClip(Rectangle rectangle)
Write out Rectangle clip. |
protected abstract void |
writeClip(Rectangle2D rectangle)
Write out Rectangle2D clip. |
protected abstract void |
writeClip(Shape shape)
Write out Shape clip. |
abstract void |
writeComment(String comment)
Called to Write out a comment. |
protected void |
writeDash(double[] dash,
double phase)
Writes out the dash of the stroke. |
protected void |
writeError(Exception exception)
Writes out an error, by default the stack trace is printed. |
protected abstract void |
writeGraphicsRestore()
Writes out the restore of a graphics context. |
protected abstract void |
writeGraphicsSave()
Writes out the save of a graphics context for a later restore. |
void |
writeGraphicsState()
Called to write the initial graphics state. |
abstract void |
writeHeader()
Called to write the header part of the output. |
protected abstract void |
writeImage(RenderedImage image,
AffineTransform xform,
Color bkg)
|
protected void |
writeJoin(int join)
Writes out the join of the stroke. |
protected void |
writeMiterLimit(float limit)
Writes out the miter limit of the stroke. |
protected abstract void |
writePaint(Color color)
Writes out paint as the given color. |
protected abstract void |
writePaint(GradientPaint paint)
Writes out paint as the given gradient. |
protected abstract void |
writePaint(Paint paint)
Writes out paint. |
protected abstract void |
writePaint(TexturePaint paint)
Writes out paint as the given texture. |
protected void |
writeSetClip(Shape shape)
Called to set a clip, no intersection made. |
protected abstract void |
writeString(String string,
double x,
double y)
|
protected void |
writeStroke(Stroke stroke)
Writes the current stroke. |
abstract void |
writeTrailer()
Called to write the trailing part of the output. |
protected abstract void |
writeTransform(AffineTransform transform)
Writes out the transform as it needs to be concatenated to the internal transform of the output format. |
protected void |
writeWarning(Exception exception)
Writes out a warning, by default to System.err. |
protected void |
writeWarning(String warning)
Writes out a warning, by default to System.err. |
protected void |
writeWidth(float width)
Writes out the width of the stroke. |
| Methods inherited from class org.freehep.graphicsio.VectorGraphicsIO |
copyResourceTo, copyResourceTo |
| Methods inherited from class org.freehep.graphics2d.VectorGraphics |
copyArea, create, create, create, create, draw, fill, getDeviceConfiguration, getSymbol, getTextAlignment, getXalignment, getYalignment, hit, setPaintMode, setXORMode, toString |
| Methods inherited from class java.awt.Graphics2D |
draw3DRect, fill3DRect |
| Methods inherited from class java.awt.Graphics |
drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipRect, getFontMetrics, hitClip |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String EMIT_WARNINGS
public static final String EMIT_ERRORS
| Constructor Detail |
protected AbstractVectorGraphicsIO(Dimension size,
boolean doRestoreOnDispose)
size - rectangle specifying the bounds of the imagedoRestoreOnDispose - true if writeGraphicsRestore() should be called when
this graphics context is disposed of.
protected AbstractVectorGraphicsIO(Component component,
boolean doRestoreOnDispose)
component - to be used to initialize the values of the graphics statedoRestoreOnDispose - true if writeGraphicsRestore() should be called when
this graphics context is disposed of.
protected AbstractVectorGraphicsIO(AbstractVectorGraphicsIO graphics,
boolean doRestoreOnDispose)
graphics - context to clone fromdoRestoreOnDispose - true if writeGraphicsRestore() should be called when
this graphics context is disposed of.| Method Detail |
public Dimension getSize()
getSize in class VectorGraphicsIOpublic Component getComponent()
public void startExport()
startExport in class VectorGraphicspublic void endExport()
endExport in class VectorGraphics
public abstract void writeHeader()
throws IOException
IOException
public void writeGraphicsState()
throws IOException
IOException
public abstract void writeBackground()
throws IOException
IOException
public abstract void writeTrailer()
throws IOException
IOException
public abstract void closeStream()
throws IOException
IOExceptionpublic void printComment(String comment)
printComment in class VectorGraphicsIO
public abstract void writeComment(String comment)
throws IOException
comment - to be written
IOExceptionprotected void resetClip(Rectangle clip)
public void dispose()
dispose in class VectorGraphics
protected abstract void writeGraphicsSave()
throws IOException
IOException
protected abstract void writeGraphicsRestore()
throws IOException
IOException
public boolean drawImage(Image image,
int x,
int y,
ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(Image image,
int x,
int y,
int width,
int height,
ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(Image image,
int x,
int y,
int width,
int height,
Color bgColor,
ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(Image image,
int x,
int y,
Color bgColor,
ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(Image image,
AffineTransform xform,
ImageObserver observer)
drawImage in class VectorGraphics
public void drawImage(BufferedImage img,
BufferedImageOp op,
int x,
int y)
drawImage in class VectorGraphics
public void drawRenderableImage(RenderableImage image,
AffineTransform xform)
drawRenderableImage in class VectorGraphics
public boolean drawImage(Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgColor,
ImageObserver observer)
drawImage in class VectorGraphicsimage - image to be drawndx1 - destination image boundsdy1 - destination image boundsdx2 - destination image boundsdy2 - destination image boundssx1 - source image boundssy1 - source image boundssx2 - source image boundssy2 - source image boundsbgColor - background colorobserver - for updates if image still incomplete
public void drawRenderedImage(RenderedImage image,
AffineTransform xform)
drawRenderedImage in class VectorGraphicsimage - to be drawnxform - transform to be used on the image
protected abstract void writeImage(RenderedImage image,
AffineTransform xform,
Color bkg)
throws IOException
IOException
public void clearRect(double x,
double y,
double width,
double height)
clearRect in class VectorGraphicsx - rectangle to be cleared.y - rectangle to be cleared.width - rectangle to be cleared.height - rectangle to be cleared.
public void drawString(String string,
double x,
double y)
VectorGraphics
drawString in class VectorGraphics
public void drawString(String str,
double x,
double y,
int horizontal,
int vertical,
boolean framed,
Color frameColor,
double frameWidth,
boolean banner,
Color bannerColor)
VectorGraphics
drawString in class VectorGraphicsstr - text to be drawnx - coordinate to draw stringy - coordinate to draw stringhorizontal - alignment of the textvertical - alignment of the textframed - true if text is surrounded by a frameframeColor - color of the frameframeWidth - witdh of the framebanner - true if the frame is filled by a bannerbannerColor - color of the banner
public void drawString(TagString str,
double x,
double y,
int horizontal,
int vertical,
boolean framed,
Color frameColor,
double frameWidth,
boolean banner,
Color bannerColor)
VectorGraphics
drawString in class VectorGraphicsstr - Tagged text to be drawnx - coordinate to draw stringy - coordinate to draw stringhorizontal - alignment of the textvertical - alignment of the textframed - true if text is surrounded by a frameframeColor - color of the frameframeWidth - witdh of the framebanner - true if the frame is filled by a bannerbannerColor - color of the banner
protected abstract void writeString(String string,
double x,
double y)
throws IOException
IOException
public void drawGlyphVector(GlyphVector g,
float x,
float y)
drawGlyphVector in class VectorGraphics
public void drawString(AttributedCharacterIterator iterator,
float x,
float y)
drawString in class VectorGraphicspublic AffineTransform getTransform()
getTransform in class VectorGraphicspublic void setTransform(AffineTransform transform)
setTransform in class VectorGraphicstransform - to be setpublic void transform(AffineTransform transform)
transform in class VectorGraphicstransform - to be applied
public void translate(double x,
double y)
translate in class VectorGraphicsx - amount by which to translatey - amount by which to translatepublic void rotate(double theta)
rotate in class VectorGraphicstheta - radians over which to rotate
public void scale(double sx,
double sy)
scale in class VectorGraphicssx - amount used for scalingsy - amount used for scaling
public void shear(double shx,
double shy)
shear in class VectorGraphicsshx - amount for shearingshy - amount for shearing
protected abstract void writeTransform(AffineTransform transform)
throws IOException
transform - to be written
IOExceptionpublic Shape getClip()
getClip in class VectorGraphicspublic Rectangle getClipBounds()
getClipBounds in class VectorGraphicspublic Rectangle getClipBounds(Rectangle r)
getClipBounds in class VectorGraphics
public void clipRect(int x,
int y,
int width,
int height)
clipRect in class VectorGraphicsx - rectangle for clippingy - rectangle for clippingwidth - rectangle for clippingheight - rectangle for clipping
public void clipRect(double x,
double y,
double width,
double height)
clipRect in class VectorGraphicsx - rectangle for clippingy - rectangle for clippingwidth - rectangle for clippingheight - rectangle for clipping
public void setClip(int x,
int y,
int width,
int height)
setClip in class VectorGraphicsx - rectangle for clippingy - rectangle for clippingwidth - rectangle for clippingheight - rectangle for clipping
public void setClip(double x,
double y,
double width,
double height)
setClip in class VectorGraphicsx - rectangle for clippingy - rectangle for clippingwidth - rectangle for clippingheight - rectangle for clippingpublic void setClip(Shape shape)
setClip in class VectorGraphicsshape - used for clipping
protected void writeSetClip(Shape shape)
throws IOException
IOExceptionpublic void clip(Shape s)
clip in class VectorGraphicss - used for clipping
protected void writeClip(Rectangle rectangle)
throws IOException
rectangle - to be used for clipping
IOException
protected abstract void writeClip(Rectangle2D rectangle)
throws IOException
rectangle - to be used for clipping
IOException
protected abstract void writeClip(Shape shape)
throws IOException
shape - to be used for clipping
IOExceptionpublic Stroke getStroke()
getStroke in class VectorGraphicspublic void setStroke(Stroke stroke)
setStroke in class VectorGraphicsstroke - to be set
protected void writeStroke(Stroke stroke)
throws IOException
IOException
protected void writeWidth(float width)
throws IOException
width - of the stroke
IOException
protected void writeCap(int cap)
throws IOException
cap - of the stroke
IOException
protected void writeJoin(int join)
throws IOException
join - of the stroke
IOException
protected void writeMiterLimit(float limit)
throws IOException
limit - miter limit of the stroke
IOException
protected void writeDash(double[] dash,
double phase)
throws IOException
dash - dash pattern, empty array is solid linephase - of the dash pattern