public abstract class AbstractVectorGraphicsIO extends VectorGraphicsIO
| Modifier and Type | Field and Description |
|---|---|
static String |
CLIP |
static String |
EMIT_ERRORS |
static String |
EMIT_WARNINGS |
static String |
TEXT_AS_SHAPES |
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| Modifier | Constructor and Description |
|---|---|
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)
|
| Modifier and Type | Method and Description |
|---|---|
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)
Use the transformation of the glyphvector and draw it
|
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 the string at (x, y).
|
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)
Deprecated.
|
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.
|
protected void |
overLine(String text,
Font font,
float x,
float y)
Draws an overline for the text at (x, y).
|
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 s)
Clips shape.
|
void |
setColor(Color color)
Sets the current color and the current paint.
|
void |
setComposite(Composite composite)
Sets current composite.
|
void |
setFont(Font font)
Sets the current font.
|
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 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)
Deprecated.
use writeDash(float[], float)
|
protected void |
writeDash(float[] dash,
float 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 |
writeFont(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(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 abstract void |
writeSetClip(Shape shape)
Write out Shape clip.
|
protected void |
writeSetTransform(AffineTransform transform)
Clears any existing transformation and sets the a new one.
|
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.
|
copyResourceTo, copyResourceToclearRect, createShape, drawArc, drawArc, drawLine, drawLine, drawOval, drawOval, drawPolygon, drawPolygon, drawPolyline, drawPolyline, drawRect, drawRect, drawRoundRect, drawRoundRect, drawString, drawString, drawString, drawString, drawString, drawString, drawString, drawString, drawSymbol, drawSymbol, drawSymbol, fillAndDraw, fillAndDrawSymbol, fillAndDrawSymbol, fillArc, fillArc, fillOval, fillOval, fillPolygon, fillPolygon, fillRect, fillRect, fillRoundRect, fillRoundRect, fillSymbol, fillSymbol, fillSymbol, getBackground, getColor, getColorMode, getCreator, getFont, getPaint, getPrintColor, getProperties, getProperty, getPropertyColor, getPropertyDimension, getPropertyDouble, getPropertyInsets, getPropertyInt, getPropertyRectangle, hit, initProperties, isDeviceIndependent, isProperty, rotate, setBackground, setColorMode, setCreator, setDeviceIndependent, setLineWidth, setLineWidth, setProperties, translatecopyArea, create, create, create, create, draw, fill, fill, getDeviceConfiguration, getSymbol, getTextAlignment, getXalignment, getYalignment, setPaintMode, setXORMode, toStringdraw3DRect, fill3DRectdrawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipRect, getFontMetrics, hitClippublic static final String EMIT_WARNINGS
public static final String TEXT_AS_SHAPES
public static final String EMIT_ERRORS
public static final String CLIP
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.public Dimension getSize()
getSize in class VectorGraphicsIOpublic Component getComponent()
public void startExport()
startExport in class VectorGraphicspublic void endExport()
endExport in class VectorGraphicspublic abstract void writeHeader()
throws IOException
IOExceptionpublic void writeGraphicsState()
throws IOException
IOExceptionpublic abstract void writeBackground()
throws IOException
IOExceptionpublic abstract void writeTrailer()
throws IOException
IOExceptionpublic abstract void closeStream()
throws IOException
IOExceptionpublic void printComment(String comment)
printComment in class VectorGraphicsIOpublic abstract void writeComment(String comment) throws IOException
comment - to be writtenIOExceptionprotected void resetClip(Rectangle clip)
public void dispose()
dispose in class VectorGraphicsprotected abstract void writeGraphicsSave()
throws IOException
IOExceptionprotected abstract void writeGraphicsRestore()
throws IOException
IOExceptionpublic boolean drawImage(Image image, int x, int y, ImageObserver observer)
drawImage in class VectorGraphicspublic boolean drawImage(Image image, int x, int y, int width, int height, ImageObserver observer)
drawImage in class VectorGraphicspublic boolean drawImage(Image image, int x, int y, int width, int height, Color bgColor, ImageObserver observer)
drawImage in class VectorGraphicspublic boolean drawImage(Image image, int x, int y, Color bgColor, ImageObserver observer)
drawImage in class VectorGraphicspublic 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 VectorGraphicspublic boolean drawImage(Image image, AffineTransform xform, ImageObserver observer)
drawImage in class VectorGraphicspublic void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
drawImage in class VectorGraphicspublic void drawRenderableImage(RenderableImage image, AffineTransform xform)
drawRenderableImage in class VectorGraphicspublic 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 incompletepublic void drawRenderedImage(RenderedImage image, AffineTransform xform)
drawRenderedImage in class VectorGraphicsimage - to be drawnxform - transform to be used on the imageprotected abstract void writeImage(RenderedImage image, AffineTransform xform, Color bkg) throws IOException
IOExceptionpublic 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)
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(String string, double x, double y) throws IOException
IOExceptionpublic void drawGlyphVector(GlyphVector g, float x, float y)
drawGlyphVector in class VectorGraphicsg - x - y - 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 appliedpublic 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 rotatepublic void scale(double sx,
double sy)
scale in class VectorGraphicssx - amount used for scalingsy - amount used for scalingpublic void shear(double shx,
double shy)
shear in class VectorGraphicsshx - amount for shearingshy - amount for shearingprotected abstract void writeTransform(AffineTransform transform) throws IOException
transform - to be writtenIOExceptionprotected void writeSetTransform(AffineTransform transform) throws IOException
transform - to be writtenIOExceptionpublic Shape getClip()
getClip in class VectorGraphicspublic Rectangle getClipBounds()
getClipBounds in class VectorGraphicspublic Rectangle getClipBounds(Rectangle r)
getClipBounds in class VectorGraphicspublic 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 clippingpublic 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 clippingpublic 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 clippingpublic 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 s)
setClip in class VectorGraphicss - used for clippingpublic void clip(Shape s)
clip in class VectorGraphicss - used for clippingprotected abstract void writeClip(Shape shape) throws IOException
shape - to be used for clippingIOExceptionprotected abstract void writeSetClip(Shape shape) throws IOException
shape - to be used for clippingIOExceptionpublic Stroke getStroke()
getStroke in class VectorGraphicspublic void setStroke(Stroke stroke)
setStroke in class VectorGraphicsstroke - to be setprotected void writeStroke(Stroke stroke) throws IOException
IOExceptionprotected void writeWidth(float width)
throws IOException
width - of the strokeIOExceptionprotected void writeCap(int cap)
throws IOException
cap - of the strokeIOExceptionprotected void writeJoin(int join)
throws IOException
join - of the strokeIOExceptionprotected void writeMiterLimit(float limit)
throws IOException
limit - miter limit of the strokeIOExceptionprotected void writeDash(float[] dash,
float phase)
throws IOException
dash - dash pattern, empty array is solid linephase - of the dash patternIOExceptionprotected void writeDash(double[] dash,
double phase)
throws IOException
dash - dash pattern, empty array is solid linephase - of the dash patternIOExceptionpublic void setColor(Color color)
AbstractVectorGraphicssetColor in class AbstractVectorGraphicscolor - to be setpublic void setPaint(Paint paint)
setPaint in class AbstractVectorGraphicspaint - to be setprotected abstract void writePaint(Color color) throws IOException
color - to be writtenIOExceptionprotected abstract void writePaint(GradientPaint paint) throws IOException
paint - to be writtenIOExceptionprotected abstract void writePaint(TexturePaint paint) throws IOException
paint - to be writtenIOExceptionprotected abstract void writePaint(Paint paint) throws IOException
paint - to be writtenIOExceptionpublic FontRenderContext getFontRenderContext()
getFontRenderContext in class VectorGraphicspublic FontMetrics getFontMetrics(Font font)
getFontMetrics in class VectorGraphicsfont - to be used for retrieving fontmetricspublic RenderingHints getRenderingHints()
getRenderingHints in class VectorGraphicspublic void addRenderingHints(Map<?,?> hints)
addRenderingHints in class VectorGraphicshints - table to be addedpublic void setRenderingHints(Map<?,?> hints)
setRenderingHints in class VectorGraphicshints - table to be setpublic Object getRenderingHint(RenderingHints.Key key)
getRenderingHint in class VectorGraphicskey - hint keypublic void setRenderingHint(RenderingHints.Key key, Object hint)
setRenderingHint in class VectorGraphicskey - hint keyhint - to be associated with keypublic void setFont(Font font)
setFont in class AbstractVectorGraphicsfont - to be setprotected abstract void writeFont(Font font) throws IOException
font - to be writtenIOExceptionpublic Composite getComposite()
getComposite in class VectorGraphicspublic void setComposite(Composite composite)
setComposite in class VectorGraphicscomposite - to be setprotected void handleException(Exception exception)
exception - to be handledprotected void writeWarning(Exception exception)
exception - warning to be writtenprotected void writeWarning(String warning)
warning - to be writtenprotected void writeError(Exception exception)
exception - error to be reportedprotected Shape createShape(double[] xPoints, double[] yPoints, int nPoints, boolean close)
AbstractVectorGraphicscreateShape in class AbstractVectorGraphicsxPoints - X coordinates of the polyline.yPoints - Y coordinates of the polyline.nPoints - number of points of the polyline.close - is shape closedprotected void overLine(String text, Font font, float x, float y)
text - text for width calulationfont - font for width calulationx - position of texty - position of textCopyright © 2014. All rights reserved.