public class SVGOutputFormat extends java.lang.Object implements OutputFormat
| Constructor and Description |
|---|
SVGOutputFormat()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected IXMLElement |
createCircle(IXMLElement doc,
double cx,
double cy,
double r,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createEllipse(IXMLElement doc,
double cx,
double cy,
double rx,
double ry,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createG(IXMLElement doc,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createImage(IXMLElement doc,
double x,
double y,
double w,
double h,
byte[] imageData,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createLine(IXMLElement doc,
double x1,
double y1,
double x2,
double y2,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createLinearGradient(IXMLElement doc,
double x1,
double y1,
double x2,
double y2,
double[] stopOffsets,
java.awt.Color[] stopColors,
double[] stopOpacities,
boolean isRelativeToFigureBounds,
java.awt.geom.AffineTransform transform) |
protected IXMLElement |
createPath(IXMLElement doc,
BezierPath[] beziers,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createPolygon(IXMLElement doc,
java.awt.geom.Point2D.Double[] points,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createPolyline(IXMLElement doc,
java.awt.geom.Point2D.Double[] points,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createRadialGradient(IXMLElement doc,
double cx,
double cy,
double fx,
double fy,
double r,
double[] stopOffsets,
java.awt.Color[] stopColors,
double[] stopOpacities,
boolean isRelativeToFigureBounds,
java.awt.geom.AffineTransform transform) |
protected IXMLElement |
createRect(IXMLElement doc,
double x,
double y,
double width,
double height,
double rx,
double ry,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createText(IXMLElement doc,
java.awt.geom.Point2D.Double[] coordinates,
double[] rotate,
javax.swing.text.StyledDocument text,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
protected IXMLElement |
createTextArea(IXMLElement doc,
double x,
double y,
double w,
double h,
javax.swing.text.StyledDocument text,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
java.awt.datatransfer.Transferable |
createTransferable(Drawing drawing,
java.util.List<Figure> figures,
double scaleFactor)
Creates a Transferable for the specified list of Figures.
|
java.lang.String |
getFileExtension()
Returns the file extension for the output format.
|
javax.swing.filechooser.FileFilter |
getFileFilter()
Return a FileFilter that can be used to identify files which can be stored
with this output format.
|
java.lang.String |
getId(IXMLElement element)
Gets a unique ID for the specified element.
|
javax.swing.JComponent |
getOutputFormatAccessory()
Return a JFileChooser accessory that can be used to customize the output
format.
|
boolean |
isPrettyPrint() |
void |
setPrettyPrint(boolean newValue) |
static java.lang.String |
toColor(java.awt.Color color) |
static java.lang.String |
toNumber(double number)
Returns a double array as a number attribute value.
|
static java.lang.String |
toPath(BezierPath[] paths)
Returns a value as a SVG Path attribute.
|
static java.lang.String |
toPoints(java.awt.geom.Point2D.Double[] points)
Returns a Point2D.Double array as a Points attribute value.
|
static java.lang.String |
toTransform(java.awt.geom.AffineTransform t) |
void |
write(java.io.File file,
Drawing drawing) |
void |
write(java.io.OutputStream out,
Drawing drawing)
Writes a Drawing into an output stream.
|
void |
write(java.io.OutputStream out,
Drawing drawing,
java.util.List<Figure> figures)
All other write methods delegate their work to here.
|
void |
write(java.net.URI uri,
Drawing drawing)
Writes a Drawing into an URI.
|
protected void |
writeAttribute(IXMLElement elem,
java.lang.String name,
double value,
double defaultValue) |
protected void |
writeAttribute(IXMLElement elem,
java.lang.String name,
java.lang.String namespace,
double value,
double defaultValue) |
protected void |
writeAttribute(IXMLElement elem,
java.lang.String name,
java.lang.String value,
java.lang.String defaultValue) |
protected void |
writeAttribute(IXMLElement elem,
java.lang.String name,
java.lang.String namespace,
java.lang.String value,
java.lang.String defaultValue) |
protected void |
writeCircleElement(IXMLElement parent,
SVGEllipseFigure f) |
protected void |
writeElement(IXMLElement parent,
Figure f) |
protected void |
writeEllipseElement(IXMLElement parent,
SVGEllipseFigure f) |
protected void |
writeGElement(IXMLElement parent,
SVGGroupFigure f) |
protected void |
writeImageElement(IXMLElement parent,
SVGImageFigure f) |
protected void |
writeLineElement(IXMLElement parent,
SVGPathFigure f) |
protected void |
writeOpacityAttribute(IXMLElement elem,
java.util.Map<AttributeKey,java.lang.Object> m) |
protected void |
writePathElement(IXMLElement parent,
SVGPathFigure f) |
protected void |
writePolygonElement(IXMLElement parent,
SVGPathFigure f) |
protected void |
writePolylineElement(IXMLElement parent,
SVGPathFigure f) |
protected void |
writeRectElement(IXMLElement parent,
SVGRectFigure f) |
protected void |
writeShapeAttributes(IXMLElement elem,
java.util.Map<AttributeKey,java.lang.Object> m) |
protected void |
writeTextAreaElement(IXMLElement parent,
SVGTextAreaFigure f) |
protected void |
writeTextElement(IXMLElement parent,
SVGTextFigure f) |
protected void |
writeTransformAttribute(IXMLElement elem,
java.util.Map<AttributeKey,java.lang.Object> a) |
public javax.swing.filechooser.FileFilter getFileFilter()
OutputFormatgetFileFilter in interface OutputFormatpublic javax.swing.JComponent getOutputFormatAccessory()
OutputFormatgetOutputFormatAccessory in interface OutputFormatpublic void setPrettyPrint(boolean newValue)
public boolean isPrettyPrint()
protected void writeElement(IXMLElement parent, Figure f) throws java.io.IOException
java.io.IOExceptionprotected void writeCircleElement(IXMLElement parent, SVGEllipseFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createCircle(IXMLElement doc, double cx, double cy, double r, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createG(IXMLElement doc, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createLinearGradient(IXMLElement doc, double x1, double y1, double x2, double y2, double[] stopOffsets, java.awt.Color[] stopColors, double[] stopOpacities, boolean isRelativeToFigureBounds, java.awt.geom.AffineTransform transform) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createRadialGradient(IXMLElement doc, double cx, double cy, double fx, double fy, double r, double[] stopOffsets, java.awt.Color[] stopColors, double[] stopOpacities, boolean isRelativeToFigureBounds, java.awt.geom.AffineTransform transform) throws java.io.IOException
java.io.IOExceptionprotected void writeEllipseElement(IXMLElement parent, SVGEllipseFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createEllipse(IXMLElement doc, double cx, double cy, double rx, double ry, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeGElement(IXMLElement parent, SVGGroupFigure f) throws java.io.IOException
java.io.IOExceptionprotected void writeImageElement(IXMLElement parent, SVGImageFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createImage(IXMLElement doc, double x, double y, double w, double h, byte[] imageData, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writePathElement(IXMLElement parent, SVGPathFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createPath(IXMLElement doc, BezierPath[] beziers, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writePolygonElement(IXMLElement parent, SVGPathFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createPolygon(IXMLElement doc, java.awt.geom.Point2D.Double[] points, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writePolylineElement(IXMLElement parent, SVGPathFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createPolyline(IXMLElement doc, java.awt.geom.Point2D.Double[] points, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeLineElement(IXMLElement parent, SVGPathFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createLine(IXMLElement doc, double x1, double y1, double x2, double y2, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeRectElement(IXMLElement parent, SVGRectFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createRect(IXMLElement doc, double x, double y, double width, double height, double rx, double ry, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeTextElement(IXMLElement parent, SVGTextFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createText(IXMLElement doc, java.awt.geom.Point2D.Double[] coordinates, double[] rotate, javax.swing.text.StyledDocument text, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeTextAreaElement(IXMLElement parent, SVGTextAreaFigure f) throws java.io.IOException
java.io.IOExceptionprotected IXMLElement createTextArea(IXMLElement doc, double x, double y, double w, double h, javax.swing.text.StyledDocument text, java.util.Map<AttributeKey,java.lang.Object> attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeShapeAttributes(IXMLElement elem, java.util.Map<AttributeKey,java.lang.Object> m) throws java.io.IOException
java.io.IOExceptionprotected void writeOpacityAttribute(IXMLElement elem, java.util.Map<AttributeKey,java.lang.Object> m) throws java.io.IOException
java.io.IOExceptionprotected void writeTransformAttribute(IXMLElement elem, java.util.Map<AttributeKey,java.lang.Object> a) throws java.io.IOException
java.io.IOExceptionprotected void writeAttribute(IXMLElement elem, java.lang.String name, java.lang.String value, java.lang.String defaultValue)
protected void writeAttribute(IXMLElement elem, java.lang.String name, java.lang.String namespace, java.lang.String value, java.lang.String defaultValue)
protected void writeAttribute(IXMLElement elem, java.lang.String name, double value, double defaultValue)
protected void writeAttribute(IXMLElement elem, java.lang.String name, java.lang.String namespace, double value, double defaultValue)
public static java.lang.String toPath(BezierPath[] paths)
public static java.lang.String toNumber(double number)
public static java.lang.String toPoints(java.awt.geom.Point2D.Double[] points)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toTransform(java.awt.geom.AffineTransform t)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toColor(java.awt.Color color)
public java.lang.String getFileExtension()
OutputFormatgetFileExtension in interface OutputFormatpublic void write(java.net.URI uri,
Drawing drawing)
throws java.io.IOException
OutputFormatwrite in interface OutputFormaturi - The uri.drawing - The drawing.java.io.IOExceptionpublic void write(java.io.File file,
Drawing drawing)
throws java.io.IOException
java.io.IOExceptionpublic void write(java.io.OutputStream out,
Drawing drawing)
throws java.io.IOException
OutputFormatwrite in interface OutputFormatout - The output stream.drawing - The drawing.java.io.IOExceptionpublic void write(java.io.OutputStream out,
Drawing drawing,
java.util.List<Figure> figures)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getId(IXMLElement element)
public java.awt.datatransfer.Transferable createTransferable(Drawing drawing, java.util.List<Figure> figures, double scaleFactor) throws java.io.IOException
OutputFormatcreateTransferable in interface OutputFormatdrawing - The drawing.figures - A list of figures of the drawing.scaleFactor - The factor to be used, when the Transferable creates
an image with a fixed size from the figures.java.io.IOException