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, copyResourceTo
clearRect, 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, translate
copyArea, create, create, create, create, draw, fill, fill, getDeviceConfiguration, getSymbol, getTextAlignment, getXalignment, getYalignment, setPaintMode, setXORMode, toString
draw3DRect, fill3DRect
drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipRect, getFontMetrics, hitClip
public 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 VectorGraphicsIO
public Component getComponent()
public void startExport()
startExport
in class VectorGraphics
public 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
IOException
public void printComment(String comment)
printComment
in class VectorGraphicsIO
public abstract void writeComment(String comment) throws IOException
comment
- to be writtenIOException
protected 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 VectorGraphics
image
- 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 VectorGraphics
image
- to be drawnxform
- transform to be used on the imageprotected 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 VectorGraphics
x
- 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 VectorGraphics
string
- x
- y
- 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
g
- x
- y
- public void drawString(AttributedCharacterIterator iterator, float x, float y)
drawString
in class VectorGraphics
public AffineTransform getTransform()
getTransform
in class VectorGraphics
public void setTransform(AffineTransform transform)
setTransform
in class VectorGraphics
transform
- to be setpublic void transform(AffineTransform transform)
transform
in class VectorGraphics
transform
- to be appliedpublic void translate(double x, double y)
translate
in class VectorGraphics
x
- amount by which to translatey
- amount by which to translatepublic void rotate(double theta)
rotate
in class VectorGraphics
theta
- radians over which to rotatepublic void scale(double sx, double sy)
scale
in class VectorGraphics
sx
- amount used for scalingsy
- amount used for scalingpublic void shear(double shx, double shy)
shear
in class VectorGraphics
shx
- amount for shearingshy
- amount for shearingprotected abstract void writeTransform(AffineTransform transform) throws IOException
transform
- to be writtenIOException
protected void writeSetTransform(AffineTransform transform) throws IOException
transform
- to be writtenIOException
public Shape getClip()
getClip
in class VectorGraphics
public Rectangle getClipBounds()
getClipBounds
in class VectorGraphics
public Rectangle getClipBounds(Rectangle r)
getClipBounds
in class VectorGraphics
public void clipRect(int x, int y, int width, int height)
clipRect
in class VectorGraphics
x
- 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 VectorGraphics
x
- 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 VectorGraphics
x
- 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 VectorGraphics
x
- rectangle for clippingy
- rectangle for clippingwidth
- rectangle for clippingheight
- rectangle for clippingpublic void setClip(Shape s)
setClip
in class VectorGraphics
s
- used for clippingpublic void clip(Shape s)
clip
in class VectorGraphics
s
- used for clippingprotected abstract void writeClip(Shape shape) throws IOException
shape
- to be used for clippingIOException
protected abstract void writeSetClip(Shape shape) throws IOException
shape
- to be used for clippingIOException
public Stroke getStroke()
getStroke
in class VectorGraphics
public void setStroke(Stroke stroke)
setStroke
in class VectorGraphics
stroke
- to be setprotected void writeStroke(Stroke stroke) throws IOException
IOException
protected void writeWidth(float width) throws IOException
width
- of the strokeIOException
protected void writeCap(int cap) throws IOException
cap
- of the strokeIOException
protected void writeJoin(int join) throws IOException
join
- of the strokeIOException
protected void writeMiterLimit(float limit) throws IOException
limit
- miter limit of the strokeIOException
protected void writeDash(float[] dash, float phase) throws IOException
dash
- dash pattern, empty array is solid linephase
- of the dash patternIOException
protected void writeDash(double[] dash, double phase) throws IOException
dash
- dash pattern, empty array is solid linephase
- of the dash patternIOException
public void setColor(Color color)
AbstractVectorGraphics
setColor
in class AbstractVectorGraphics
color
- to be setpublic void setPaint(Paint paint)
setPaint
in class AbstractVectorGraphics
paint
- to be setprotected abstract void writePaint(Color color) throws IOException
color
- to be writtenIOException
protected abstract void writePaint(GradientPaint paint) throws IOException
paint
- to be writtenIOException
protected abstract void writePaint(TexturePaint paint) throws IOException
paint
- to be writtenIOException
protected abstract void writePaint(Paint paint) throws IOException
paint
- to be writtenIOException
public FontRenderContext getFontRenderContext()
getFontRenderContext
in class VectorGraphics
public FontMetrics getFontMetrics(Font font)
getFontMetrics
in class VectorGraphics
font
- to be used for retrieving fontmetricspublic RenderingHints getRenderingHints()
getRenderingHints
in class VectorGraphics
public void addRenderingHints(Map<?,?> hints)
addRenderingHints
in class VectorGraphics
hints
- table to be addedpublic void setRenderingHints(Map<?,?> hints)
setRenderingHints
in class VectorGraphics
hints
- table to be setpublic Object getRenderingHint(RenderingHints.Key key)
getRenderingHint
in class VectorGraphics
key
- hint keypublic void setRenderingHint(RenderingHints.Key key, Object hint)
setRenderingHint
in class VectorGraphics
key
- hint keyhint
- to be associated with keypublic void setFont(Font font)
setFont
in class AbstractVectorGraphics
font
- to be setprotected abstract void writeFont(Font font) throws IOException
font
- to be writtenIOException
public Composite getComposite()
getComposite
in class VectorGraphics
public void setComposite(Composite composite)
setComposite
in class VectorGraphics
composite
- 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)
AbstractVectorGraphics
createShape
in class AbstractVectorGraphics
xPoints
- 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.