|
||||||||||
| 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
public abstract class AbstractVectorGraphicsIO
This class provides an abstract VectorGraphicsIO class for specific output drivers.
| Field Summary | |
|---|---|
static java.lang.String |
CLIP
|
static java.lang.String |
EMIT_ERRORS
|
static java.lang.String |
EMIT_WARNINGS
|
static java.lang.String |
TEXT_AS_SHAPES
|
| 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(java.awt.Component component,
boolean doRestoreOnDispose)
Constructs a Graphics context with the following graphics state: Paint: The color of the component. |
protected |
AbstractVectorGraphicsIO(java.awt.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(java.util.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(java.awt.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 java.awt.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(java.awt.font.GlyphVector g,
float x,
float y)
Use the transformation of the glyphvector and draw it |
void |
drawImage(java.awt.image.BufferedImage img,
java.awt.image.BufferedImageOp op,
int x,
int y)
|
boolean |
drawImage(java.awt.Image image,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
java.awt.Color bgColor,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.Color bgColor,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
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)
Draw and resizes (transparent) image. |
boolean |
drawImage(java.awt.Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.image.ImageObserver observer)
|
void |
drawRenderableImage(java.awt.image.renderable.RenderableImage image,
java.awt.geom.AffineTransform xform)
|
void |
drawRenderedImage(java.awt.image.RenderedImage image,
java.awt.geom.AffineTransform xform)
Draws a rendered image using a transform. |
void |
drawString(java.text.AttributedCharacterIterator iterator,
float x,
float y)
|
void |
drawString(java.lang.String string,
double x,
double y)
Draws the string at (x, y). |
void |
endExport()
|
java.awt.Shape |
getClip()
Gets the current clip in form of a Shape (Rectangle). |
java.awt.Rectangle |
getClipBounds()
Gets the current clip in form of a Rectangle. |
java.awt.Rectangle |
getClipBounds(java.awt.Rectangle r)
Gets the current clip in form of a Rectangle. |
java.awt.Component |
getComponent()
|
java.awt.Composite |
getComposite()
Gets current composite. |
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font)
Deprecated. |
java.awt.font.FontRenderContext |
getFontRenderContext()
Gets the current font render context. |
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key key)
Gets a given rendering hint. |
java.awt.RenderingHints |
getRenderingHints()
Gets a copy of the rendering hints. |
java.awt.Dimension |
getSize()
|
java.awt.Stroke |
getStroke()
Get the current stroke. |
java.awt.geom.AffineTransform |
getTransform()
Get the current transform. |
protected void |
handleException(java.lang.Exception exception)
Handles an exception which has been caught. |
protected void |
overLine(java.lang.String text,
java.awt.Font font,
float x,
float y)
Draws an overline for the text at (x, y). |
void |
printComment(java.lang.String comment)
|
protected void |
resetClip(java.awt.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(java.awt.Shape s)
Clips shape. |
void |
setColor(java.awt.Color color)
Sets the current color and the current paint. |
void |
setComposite(java.awt.Composite composite)
Sets current composite. |
void |
setFont(java.awt.Font font)
Sets the current font. |
void |
setPaint(java.awt.Paint paint)
Sets the current paint. |
void |
setRenderingHint(java.awt.RenderingHints.Key key,
java.lang.Object hint)
Sets a given rendering hint. |
void |
setRenderingHints(java.util.Map hints)
Sets table of rendering hints. |
void |
setStroke(java.awt.Stroke stroke)
Sets the current stroke. |
void |
setTransform(java.awt.geom.AffineTransform transform)
Set the current transform. |
void |
shear(double shx,
double shy)
Shears the current transform. |
void |
startExport()
|
void |
transform(java.awt.geom.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 abstract void |
writeClip(java.awt.Shape shape)
Write out Shape clip. |
abstract void |
writeComment(java.lang.String comment)
Called to Write out a comment. |
protected void |
writeDash(double[] dash,
double phase)
Deprecated. use writeDash(float[], float) |
protected void |
writeDash(float[] dash,
float phase)
Writes out the dash of the stroke. |
protected void |
writeError(java.lang.Exception exception)
Writes out an error, by default the stack trace is printed. |
protected abstract void |
writeFont(java.awt.Font font)
Writes the font |
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(java.awt.image.RenderedImage image,
java.awt.geom.AffineTransform xform,
java.awt.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(java.awt.Color color)
Writes out paint as the given color. |
protected abstract void |
writePaint(java.awt.GradientPaint paint)
Writes out paint as the given gradient. |
protected abstract void |
writePaint(java.awt.Paint paint)
Writes out paint. |
protected abstract void |
writePaint(java.awt.TexturePaint paint)
Writes out paint as the given texture. |
protected abstract void |
writeSetClip(java.awt.Shape shape)
Write out Shape clip. |
protected void |
writeSetTransform(java.awt.geom.AffineTransform transform)
Clears any existing transformation and sets the a new one. |
protected abstract void |
writeString(java.lang.String string,
double x,
double y)
|
protected void |
writeStroke(java.awt.Stroke stroke)
Writes the current stroke. |
abstract void |
writeTrailer()
Called to write the trailing part of the output. |
protected abstract void |
writeTransform(java.awt.geom.AffineTransform transform)
Writes out the transform as it needs to be concatenated to the internal transform of the output format. |
protected void |
writeWarning(java.lang.Exception exception)
Writes out a warning, by default to System.err. |
protected void |
writeWarning(java.lang.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, fill, getDeviceConfiguration, getSymbol, getTextAlignment, getXalignment, getYalignment, 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 java.lang.String EMIT_WARNINGS
public static final java.lang.String TEXT_AS_SHAPES
public static final java.lang.String EMIT_ERRORS
public static final java.lang.String CLIP
| Constructor Detail |
|---|
protected AbstractVectorGraphicsIO(java.awt.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(java.awt.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 java.awt.Dimension getSize()
getSize in class VectorGraphicsIOpublic java.awt.Component getComponent()
public void startExport()
startExport in class VectorGraphicspublic void endExport()
endExport in class VectorGraphics
public abstract void writeHeader()
throws java.io.IOException
java.io.IOException
public void writeGraphicsState()
throws java.io.IOException
java.io.IOException
public abstract void writeBackground()
throws java.io.IOException
java.io.IOException
public abstract void writeTrailer()
throws java.io.IOException
java.io.IOException
public abstract void closeStream()
throws java.io.IOException
java.io.IOExceptionpublic void printComment(java.lang.String comment)
printComment in class VectorGraphicsIO
public abstract void writeComment(java.lang.String comment)
throws java.io.IOException
comment - to be written
java.io.IOExceptionprotected void resetClip(java.awt.Rectangle clip)
public void dispose()
dispose in class VectorGraphics
protected abstract void writeGraphicsSave()
throws java.io.IOException
java.io.IOException
protected abstract void writeGraphicsRestore()
throws java.io.IOException
java.io.IOException
public boolean drawImage(java.awt.Image image,
int x,
int y,
java.awt.image.ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.Color bgColor,
java.awt.image.ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(java.awt.Image image,
int x,
int y,
java.awt.Color bgColor,
java.awt.image.ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(java.awt.Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.image.ImageObserver observer)
drawImage in class VectorGraphics
public boolean drawImage(java.awt.Image image,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver observer)
drawImage in class VectorGraphics
public void drawImage(java.awt.image.BufferedImage img,
java.awt.image.BufferedImageOp op,
int x,
int y)
drawImage in class VectorGraphics
public void drawRenderableImage(java.awt.image.renderable.RenderableImage image,
java.awt.geom.AffineTransform xform)
drawRenderableImage in class VectorGraphics
public boolean drawImage(java.awt.Image image,
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)
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(java.awt.image.RenderedImage image,
java.awt.geom.AffineTransform xform)
drawRenderedImage in class VectorGraphicsimage - to be drawnxform - transform to be used on the image
protected abstract void writeImage(java.awt.image.RenderedImage image,
java.awt.geom.AffineTransform xform,
java.awt.Color bkg)
throws java.io.IOException
java.io.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(java.lang.String string,
double x,
double y)
drawGlyphVector(java.awt.font.GlyphVector, float, float) is used, otherwise
writeString(String, double, double) for a more direct output of the string.
drawString in class VectorGraphicsstring - x - y -
protected abstract void writeString(java.lang.String string,
double x,
double y)
throws java.io.IOException
java.io.IOException
public void drawGlyphVector(java.awt.font.GlyphVector g,
float x,
float y)
drawGlyphVector in class VectorGraphicsg - x - y -
public void drawString(java.text.AttributedCharacterIterator iterator,
float x,
float y)
drawString in class VectorGraphicspublic java.awt.geom.AffineTransform getTransform()
getTransform in class VectorGraphicspublic void setTransform(java.awt.geom.AffineTransform transform)
setTransform in class VectorGraphicstransform - to be setpublic void transform(java.awt.geom.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(java.awt.geom.AffineTransform transform)
throws java.io.IOException
transform - to be written
java.io.IOException
protected void writeSetTransform(java.awt.geom.AffineTransform transform)
throws java.io.IOException
transform - to be written
java.io.IOExceptionpublic java.awt.Shape getClip()
getClip in class VectorGraphicspublic java.awt.Rectangle getClipBounds()
getClipBounds in class VectorGraphicspublic java.awt.Rectangle getClipBounds(java.awt.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(java.awt.Shape s)
setClip in class VectorGraphicss - used for clippingpublic void clip(java.awt.Shape s)
clip in class VectorGraphicss - used for clipping
protected abstract void writeClip(java.awt.Shape shape)
throws java.io.IOException
shape - to be used for clipping
java.io.IOException
protected abstract void writeSetClip(java.awt.Shape shape)
throws java.io.IOException
shape - to be used for clipping
java.io.IOExceptionpublic java.awt.Stroke getStroke()
getStroke in class VectorGraphicspublic void setStroke(java.awt.Stroke stroke)
setStroke in class VectorGraphicsstroke - to be set
protected void writeStroke(java.awt.Stroke stroke)
throws java.io.IOException
java.io.IOException
protected void writeWidth(float width)
throws java.io.IOException
width - of the stroke
java.io.IOException
protected void writeCap(int cap)
throws java.io.IOException
cap - of the stroke
java.io.IOException
protected void writeJoin(int join)
throws java.io.IOException
join - of the stroke
java.io.IOException
protected void writeMiterLimit(float limit)
throws java.io.IOException
limit - miter limit of the stroke
java.io.IOException
protected void writeDash(float[] dash,
float phase)
throws java.io.IOException
dash - dash pattern, empty array is solid linephase - of the dash pattern
java.io.IOException
protected void writeDash(double[] dash,
double phase)
throws java.io.IOException
dash - dash pattern, empty array is solid linephase - of the dash pattern
java.io.IOExceptionpublic void setColor(java.awt.Color color)
AbstractVectorGraphics
setColor in class AbstractVectorGraphicscolor - to be setpublic void setPaint(java.awt.Paint paint)
setPaint in class AbstractVectorGraphicspaint - to be set
protected abstract void writePaint(java.awt.Color color)
throws java.io.IOException
color - to be written
java.io.IOException
protected abstract void writePaint(java.awt.GradientPaint paint)
throws java.io.IOException
paint - to be written
java.io.IOException
protected abstract void writePaint(java.awt.TexturePaint paint)
throws java.io.IOException
paint - to be written
java.io.IOException
protected abstract void writePaint(java.awt.Paint paint)
throws java.io.IOException
paint - to be written
java.io.IOExceptionpublic java.awt.font.FontRenderContext getFontRenderContext()
getFontRenderContext in class VectorGraphicspublic java.awt.FontMetrics getFontMetrics(java.awt.Font font)
getFontMetrics in class VectorGraphicsfont - to be used for retrieving fontmetrics
public java.awt.RenderingHints getRenderingHints()
getRenderingHints in class VectorGraphicspublic void addRenderingHints(java.util.Map hints)
addRenderingHints in class VectorGraphicshints - table to be addedpublic void setRenderingHints(java.util.Map hints)
setRenderingHints in class VectorGraphicshints - table to be setpublic java.lang.Object getRenderingHint(java.awt.RenderingHints.Key key)
getRenderingHint in class VectorGraphicskey - hint key
public void setRenderingHint(java.awt.RenderingHints.Key key,
java.lang.Object hint)
setRenderingHint in class VectorGraphicskey - hint keyhint - to be associated with keypublic void setFont(java.awt.Font font)
setFont in class AbstractVectorGraphicsfont - to be set
protected abstract void writeFont(java.awt.Font font)
throws java.io.IOException
font - to be written
java.io.IOExceptionpublic java.awt.Composite getComposite()
getComposite in class VectorGraphicspublic void setComposite(java.awt.Composite composite)
setComposite in class VectorGraphicscomposite - to be setprotected void handleException(java.lang.Exception exception)
exception - to be handledprotected void writeWarning(java.lang.Exception exception)
exception - warning to be writtenprotected void writeWarning(java.lang.String warning)
warning - to be writtenprotected void writeError(java.lang.Exception exception)
exception - error to be reported
protected java.awt.Shape createShape(double[] xPoints,
double[] yPoints,
int nPoints,
boolean close)
AbstractVectorGraphics
createShape in class AbstractVectorGraphicsxPoints - X coordinates of the polyline.yPoints - Y coordinates of the polyline.nPoints - number of points of the polyline.close - is shape closed
protected void overLine(java.lang.String text,
java.awt.Font font,
float x,
float y)
text - text for width calulationfont - font for width calulationx - position of texty - position of text
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||