Package net.i2p.rrd4j
Class SimpleSVGGraphics2D
java.lang.Object
java.awt.Graphics
java.awt.Graphics2D
net.i2p.rrd4j.SimpleSVGGraphics2D
Very simple SVGGraphics2D, only enough for basic rrd4j use, without dependencies.
Plus a few things that rrd4j doesn't use, but not much.
Unsupported things will throw UnsupportedOperationExceptions.
Supports custom RenderingHints for id and class on top-level svg element.
Supports custom RenderingHints for id, class, title, and arbitrary attributes
on all drawn elements.
Supports custom RenderingHints for inner SVG on all drawn elements except text.
No standard Java AWT hints are supported.
Antialiasing is done automatically.
Antialiasing hints have no effect.
License: Apache 2.0 (same as rrd4j)
- Since:
- 0.9.64
- Author:
- zzz
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RenderingHints.KeyValue is a Map of String to String of extra attributes on the next element drawn, one-shot, will be removed after rendering.static final RenderingHints.KeyOn the next element drawn, one-shot, will be removed after rendering.static final RenderingHints.KeyOn the next element drawn, one-shot, will be removed after rendering.static final RenderingHints.KeyPut "inside" the next element drawn, one-shot, will be removed after rendering.static final RenderingHints.KeyOn the next element drawn, one-shot, will be removed after rendering.static final RenderingHints.KeyOn the top svg element.static final RenderingHints.KeyOn the top svg element.static final RenderingHints.KeyOn the top svg element. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRenderingHints(Map<?, ?> hints) voidGraphics2D API bypass, advanced use onlyvoidclearRect(int x, int y, int width, int height) voidvoidclipRect(int x, int y, int width, int height) voidcopyArea(int x, int y, int width, int height, int dx, int dy) create()voiddispose()voidvoiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Circles only for now, must be width == height and arcAngle == 360 Otherwise throws UnsupportedOperationException TODOvoiddrawGlyphVector(GlyphVector g, float x, float y) voiddrawImage(BufferedImage img, BufferedImageOp op, int x, int y) booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver obs) booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver obs) booleandrawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver obs) booleandrawImage(Image img, int x, int y, int width, int height, ImageObserver obs) booleandrawImage(Image img, int x, int y, Color bgcolor, ImageObserver obs) booleandrawImage(Image img, int x, int y, ImageObserver obs) booleandrawImage(Image img, AffineTransform xform, ImageObserver obs) voiddrawLine(int x1, int y1, int x2, int y2) voiddrawOval(int x, int y, int width, int height) voiddrawPolygon(int[] xPoints, int[] yPoints, int nPoints) voiddrawPolyline(int[] xPoints, int[] yPoints, int nPoints) voiddrawRenderableImage(RenderableImage img, AffineTransform xform) voiddrawRenderedImage(RenderedImage img, AffineTransform xform) voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) voiddrawString(String str, float x, float y) voiddrawString(String str, int x, int y) voiddrawString(AttributedCharacterIterator iterator, float x, float y) voiddrawString(AttributedCharacterIterator iterator, int x, int y) voidvoidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Circles only for now, must be width == height and arcAngle == 360 Otherwise throws UnsupportedOperationException TODOvoidfillOval(int x, int y, int width, int height) voidfillPolygon(int[] xPoints, int[] yPoints, int nPoints) voidfillPolyline(int[] xPoints, int[] yPoints, int nPoints) voidfillRect(int x, int y, int width, int height) voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) getClip()getColor()getFont()getMaker()Graphics2D API bypass, advanced use onlygetPaint()getRenderingHint(RenderingHints.Key hintKey) getSVG()booleanvoidrotate(double theta) voidrotate(double theta, double x, double y) voidscale(double sx, double sy) voidsetBackground(Color color) voidsetClip(int x, int y, int width, int height) voidvoidvoidsetComposite(Composite comp) voidvoidvoidvoidsetRenderingHint(RenderingHints.Key hintKey, Object hintValue) voidsetRenderingHints(Map<?, ?> hints) voidvoidvoidsetXORMode(Color color) voidshear(double shx, double shy) voidvoidtranslate(double tx, double ty) voidtranslate(int x, int y) Methods inherited from class java.awt.Graphics2D
draw3DRect, fill3DRectMethods inherited from class java.awt.Graphics
create, drawBytes, drawChars, drawPolygon, drawRect, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString
-
Field Details
-
KEY_SVG_ID
On the top svg element. Value is a string and will be XML-escaped when rendering. -
KEY_SVG_CLASS
On the top svg element. Value is a string and will be XML-escaped when rendering. -
KEY_SVG_TITLE
On the top svg element. Value is a string and will be XML-escaped when rendering. -
KEY_ELEMENT_ID
On the next element drawn, one-shot, will be removed after rendering. Value is a string and will be XML-escaped when rendering. -
KEY_ELEMENT_CLASS
On the next element drawn, one-shot, will be removed after rendering. Value is a string and will be XML-escaped when rendering. -
KEY_ELEMENT_ATTMAP
Value is a Map of String to String of extra attributes on the next element drawn, one-shot, will be removed after rendering. Map keys must be XML-escaped by caller if necessary. Map values will be XML-escaped when rendering. -
KEY_ELEMENT_TITLE
On the next element drawn, one-shot, will be removed after rendering. Value is a string and will be XML-escaped when rendering. -
KEY_ELEMENT_INNERSVG
Put "inside" the next element drawn, one-shot, will be removed after rendering. Value is an XML string and must be XML-escaped by caller if necessary.
-
-
Constructor Details
-
SimpleSVGGraphics2D
public SimpleSVGGraphics2D(int width, int height)
-
-
Method Details
-
getSVG
-
dispose
public void dispose() -
getMaker
Graphics2D API bypass, advanced use only -
append
Graphics2D API bypass, advanced use only -
drawLine
public void drawLine(int x1, int y1, int x2, int y2) -
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
drawPolylinein classGraphics
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
fillPolygonin classGraphics
-
fillRect
public void fillRect(int x, int y, int width, int height) -
drawString
- Specified by:
drawStringin classGraphics2D
-
drawString
- Specified by:
drawStringin classGraphics2D
-
getFontRenderContext
- Specified by:
getFontRenderContextin classGraphics2D
-
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Circles only for now, must be width == height and arcAngle == 360 Otherwise throws UnsupportedOperationException TODO -
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Circles only for now, must be width == height and arcAngle == 360 Otherwise throws UnsupportedOperationException TODO -
clearRect
public void clearRect(int x, int y, int width, int height) -
draw
- Specified by:
drawin classGraphics2D
-
fill
- Specified by:
fillin classGraphics2D
-
setClip
public void setClip(int x, int y, int width, int height) -
setClip
-
translate
public void translate(int x, int y) - Specified by:
translatein classGraphics2D
-
translate
public void translate(double tx, double ty) - Specified by:
translatein classGraphics2D
-
rotate
public void rotate(double theta) - Specified by:
rotatein classGraphics2D
-
rotate
public void rotate(double theta, double x, double y) - Specified by:
rotatein classGraphics2D
-
scale
public void scale(double sx, double sy) - Specified by:
scalein classGraphics2D
-
shear
public void shear(double shx, double shy) - Specified by:
shearin classGraphics2D
-
setTransform
- Specified by:
setTransformin classGraphics2D
-
getTransform
- Specified by:
getTransformin classGraphics2D
-
setFont
-
setPaint
- Specified by:
setPaintin classGraphics2D
-
setStroke
- Specified by:
setStrokein classGraphics2D
-
setBackground
- Specified by:
setBackgroundin classGraphics2D
-
getBackground
- Specified by:
getBackgroundin classGraphics2D
-
getClip
-
getClipBounds
- Specified by:
getClipBoundsin classGraphics
-
setColor
-
getColor
-
getFont
-
getPaint
- Specified by:
getPaintin classGraphics2D
-
getStroke
- Specified by:
getStrokein classGraphics2D
-
addRenderingHints
- Specified by:
addRenderingHintsin classGraphics2D
-
getRenderingHint
- Specified by:
getRenderingHintin classGraphics2D
-
setRenderingHint
- Specified by:
setRenderingHintin classGraphics2D
-
setRenderingHints
- Specified by:
setRenderingHintsin classGraphics2D
-
clipRect
public void clipRect(int x, int y, int width, int height) -
clip
- Specified by:
clipin classGraphics2D
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy) -
create
-
drawGlyphVector
- Specified by:
drawGlyphVectorin classGraphics2D
-
drawImage
- Specified by:
drawImagein classGraphics2D
-
drawImage
- Specified by:
drawImagein classGraphics2D
-
drawImage
-
drawImage
-
drawImage
-
drawImage
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver obs) -
drawImage
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver obs) -
drawImage
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver obs) -
drawOval
public void drawOval(int x, int y, int width, int height) -
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
drawPolygonin classGraphics
-
drawRenderableImage
- Specified by:
drawRenderableImagein classGraphics2D
-
drawRenderedImage
- Specified by:
drawRenderedImagein classGraphics2D
-
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - Specified by:
drawRoundRectin classGraphics
-
drawString
- Specified by:
drawStringin classGraphics2D
-
drawString
- Specified by:
drawStringin classGraphics2D
-
fillOval
public void fillOval(int x, int y, int width, int height) -
fillPolyline
public void fillPolyline(int[] xPoints, int[] yPoints, int nPoints) -
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - Specified by:
fillRoundRectin classGraphics
-
getComposite
- Specified by:
getCompositein classGraphics2D
-
getDeviceConfiguration
- Specified by:
getDeviceConfigurationin classGraphics2D
-
getFontMetrics
- Specified by:
getFontMetricsin classGraphics
-
getRenderingHints
- Specified by:
getRenderingHintsin classGraphics2D
-
hit
- Specified by:
hitin classGraphics2D
-
setComposite
- Specified by:
setCompositein classGraphics2D
-
setPaintMode
public void setPaintMode()- Specified by:
setPaintModein classGraphics
-
setXORMode
- Specified by:
setXORModein classGraphics
-
transform
- Specified by:
transformin classGraphics2D
-