public abstract class VectorGraphics2D extends Graphics2D
Modifier and Type | Class and Description |
---|---|
static class |
VectorGraphics2D.FontRendering
Constants to define how fonts are rendered.
|
Constructor and Description |
---|
VectorGraphics2D(double x,
double y,
double width,
double height)
Constructor to initialize a new
VectorGraphics2D document. |
Modifier and Type | Method and Description |
---|---|
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 s) |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle) |
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 observer) |
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 observer) |
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[] xPoints,
int[] yPoints,
int nPoints) |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints) |
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 s) |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle) |
void |
fillOval(int x,
int y,
int width,
int height) |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints) |
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() |
Rectangle2D |
getBounds()
Returns the dimensions of the document.
|
byte[] |
getBytes()
Encodes the painted data into a sequence of bytes.
|
Shape |
getClip() |
Rectangle |
getClipBounds() |
Color |
getColor() |
Composite |
getComposite() |
GraphicsConfiguration |
getDeviceConfiguration() |
Font |
getFont() |
FontMetrics |
getFontMetrics(Font f) |
FontRenderContext |
getFontRenderContext() |
VectorGraphics2D.FontRendering |
getFontRendering()
Returns how fonts should be rendered.
|
protected abstract String |
getFooter()
Returns a string of the footer to end a document.
|
Paint |
getPaint() |
int |
getRasteredImageSizeMaximum()
Returns the maximal size of images which are used to raster paints
like e.g. gradients, or patterns.
|
Object |
getRenderingHint(RenderingHints.Key hintKey) |
RenderingHints |
getRenderingHints() |
double |
getResolution()
Returns the resolution in pixels per inch.
|
Stroke |
getStroke() |
AffineTransform |
getTransform() |
boolean |
hit(Rectangle rect,
Shape s,
boolean onStroke) |
protected boolean |
isDistorted()
Returns whether a distorting transformation has been applied to the
document.
|
protected boolean |
isTransformed()
Returns whether an affine transformation like translation, scaling,
rotation or shearing has been applied to this graphics instance.
|
void |
rotate(double theta) |
void |
rotate(double theta,
double x,
double y) |
void |
scale(double sx,
double sy) |
protected void |
setAffineTransform(AffineTransform tx)
Sets the current transformation.
|
void |
setBackground(Color color) |
void |
setClip(int x,
int y,
int width,
int height) |
void |
setClip(Shape clip) |
void |
setColor(Color c) |
void |
setComposite(Composite comp) |
void |
setFont(Font font) |
void |
setFontRendering(VectorGraphics2D.FontRendering mode)
Sets how fonts should be rendered.
|
void |
setPaint(Paint paint) |
void |
setPaintMode() |
void |
setRasteredImageSizeMaximum(int paintImageSizeMaximum)
Sets the maximal size of images which are used to raster paints
like e.g. gradients, or patterns.
|
void |
setRenderingHint(RenderingHints.Key hintKey,
Object hintValue) |
void |
setRenderingHints(Map<?,?> hints) |
void |
setResolution(double resolution)
Sets the resolution in pixels per inch.
|
void |
setStroke(Stroke s) |
void |
setTransform(AffineTransform tx) |
void |
setXORMode(Color c1) |
void |
shear(double shx,
double shy) |
protected int |
size()
Returns the number of bytes of the document.
|
String |
toString() |
void |
transform(AffineTransform tx) |
void |
translate(double tx,
double ty) |
void |
translate(int x,
int y) |
protected void |
write(Object... strs)
Utility method for writing multiple objects to the SVG document.
|
protected abstract void |
writeClosingDraw(Shape s)
Write a command to draw the outline of a previously inserted shape.
|
protected void |
writeClosingFill(Shape s)
Write a command to fill the outline of a previously inserted shape.
|
protected abstract void |
writeHeader()
Write the header to start a new document.
|
protected abstract void |
writeImage(Image img,
int imgWidth,
int imgHeight,
double x,
double y,
double width,
double height)
Write the specified image to the document.
|
protected void |
writeln(Object... strs)
Utility method for writing a line of multiple objects to the
SVG document.
|
protected abstract void |
writeShape(Shape s)
Write the specified shape to the document.
|
protected abstract void |
writeString(String str,
double x,
double y)
Write a text string to the document at a specified position.
|
draw3DRect, fill3DRect
create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip
public VectorGraphics2D(double x, double y, double width, double height)
VectorGraphics2D
document.
The dimensions of the document must be passed.x
- Horizontal position of document origin.y
- Vertical position of document origin.width
- Width of document.height
- Height of document.public void addRenderingHints(Map<?,?> hints)
addRenderingHints
in class Graphics2D
public void clip(Shape s)
clip
in class Graphics2D
public void draw(Shape s)
draw
in class Graphics2D
public void drawGlyphVector(GlyphVector g, float x, float y)
drawGlyphVector
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 drawRenderableImage(RenderableImage img, AffineTransform xform)
drawRenderableImage
in class Graphics2D
public void drawRenderedImage(RenderedImage img, AffineTransform xform)
drawRenderedImage
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 fill(Shape s)
fill
in class Graphics2D
public Color getBackground()
getBackground
in class Graphics2D
public Composite getComposite()
getComposite
in class Graphics2D
public GraphicsConfiguration getDeviceConfiguration()
getDeviceConfiguration
in class Graphics2D
public FontRenderContext getFontRenderContext()
getFontRenderContext
in class Graphics2D
public Paint getPaint()
getPaint
in class Graphics2D
public Object getRenderingHint(RenderingHints.Key hintKey)
getRenderingHint
in class Graphics2D
public RenderingHints getRenderingHints()
getRenderingHints
in class Graphics2D
public Stroke getStroke()
getStroke
in class Graphics2D
public boolean hit(Rectangle rect, Shape s, boolean onStroke)
hit
in class Graphics2D
public void setBackground(Color color)
setBackground
in class Graphics2D
public void setComposite(Composite comp)
setComposite
in class Graphics2D
public void setPaint(Paint paint)
setPaint
in class Graphics2D
public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
setRenderingHint
in class Graphics2D
public void setRenderingHints(Map<?,?> hints)
setRenderingHints
in class Graphics2D
public void setStroke(Stroke s)
setStroke
in class Graphics2D
public AffineTransform getTransform()
getTransform
in class Graphics2D
public void setTransform(AffineTransform tx)
setTransform
in class Graphics2D
protected void setAffineTransform(AffineTransform tx)
tx
- Current transformationpublic void shear(double shx, double shy)
shear
in class Graphics2D
public void transform(AffineTransform tx)
transform
in class Graphics2D
public void translate(int x, int y)
translate
in class Graphics2D
public void translate(double tx, double ty)
translate
in class Graphics2D
public void rotate(double theta)
rotate
in class Graphics2D
public void rotate(double theta, double x, double y)
rotate
in class Graphics2D
public void scale(double sx, double sy)
scale
in class Graphics2D
public void clearRect(int x, int y, int width, int height)
public void clipRect(int x, int y, int width, int height)
public void copyArea(int x, int y, int width, int height, int dx, int dy)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
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)
public void drawLine(int x1, int y1, int x2, int y2)
public void drawOval(int x, int y, int width, int height)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
drawPolygon
in class Graphics
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
drawPolyline
in class Graphics
public void drawRect(int x, int y, int width, int height)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect
in class Graphics
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
public void fillOval(int x, int y, int width, int height)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
fillPolygon
in class Graphics
public void fillRect(int x, int y, int width, int height)
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
fillRoundRect
in class Graphics
public Rectangle getClipBounds()
getClipBounds
in class Graphics
public FontMetrics getFontMetrics(Font f)
getFontMetrics
in class Graphics
public void setClip(int x, int y, int width, int height)
public void setPaintMode()
setPaintMode
in class Graphics
public void setXORMode(Color c1)
setXORMode
in class Graphics
protected void write(Object... strs)
strs
- Objects to be writtenprotected void writeln(Object... strs)
strs
- Objects to be writtenprotected abstract void writeShape(Shape s)
s
- Shape to be written.protected abstract void writeImage(Image img, int imgWidth, int imgHeight, double x, double y, double width, double height)
img
- Image to be rendered.imgWidth
- Number of pixels in horizontal direction.imgHeight
- Number of pixels in vertical directionx
- Horizontal position in document units where the
upper left corner of the image should be placed.y
- Vertical position in document units where the
upper left corner of the image should be placed.width
- Width of the image in document units.height
- Height of the image in document units.protected abstract void writeString(String str, double x, double y)
str
- Text to be rendered.x
- Horizontal position in document units.y
- Vertical position in document units.protected abstract void writeClosingDraw(Shape s)
s
- Shape that should be drawn.protected void writeClosingFill(Shape s)
s
- Shape that should be filled.protected abstract void writeHeader()
protected abstract String getFooter()
protected boolean isDistorted()
true
if the document is distorted,
otherwise false
.public byte[] getBytes()
public Rectangle2D getBounds()
protected int size()
public VectorGraphics2D.FontRendering getFontRendering()
public void setFontRendering(VectorGraphics2D.FontRendering mode)
mode
- New font rendering mode.protected boolean isTransformed()
true
if the instance has been transformed,
false
otherwisepublic double getResolution()
public void setResolution(double resolution)
resolution
- New resolution in pixels per inch.public int getRasteredImageSizeMaximum()
public void setRasteredImageSizeMaximum(int paintImageSizeMaximum)
paintImageSizeMaximum
- New maximal image size in pixels.Copyright © 2010-2013. All Rights Reserved.