public abstract class Depiction extends Object
Modifier and Type | Field and Description |
---|---|
protected static double |
DEFAULT_PADDING_FACTOR
When no fixed padding value is specified we use margin
multiplied by this value.
|
static String |
EPS_FMT
Encapsulated PostScript (EPS) format key.
|
static String |
GIF_FMT
Graphics Interchange Format (GIF) format key.
|
static String |
JPG_FMT
Joint Photographic Experts Group (JPG) format key.
|
protected static double |
MM_TO_POINT
For converting MM coordinates to PS Point (1/72 inch)
|
static String |
PDF_FMT
Portable Document Format (PDF) format key.
|
static String |
PNG_FMT
Portable Network Graphics (PNG) format key.
|
static String |
PS_FMT
PostScript (PS) format key.
|
static String |
SVG_FMT
Structured Vector Graphics (SVG) format key.
|
static String |
UNITS_MM
Units in MM (specific to SVG).
|
static String |
UNITS_PX
Units in PX (specific to SVG).
|
Modifier and Type | Method and Description |
---|---|
protected void |
draw(IDrawVisitor visitor,
double zoom,
Bounds bounds,
Rectangle2D viewBounds)
Low-level draw method used by other rendering methods.
|
List<String> |
listFormats()
List the available formats that can be rendered.
|
protected void |
svgPrevisit(String fmt,
double rescale,
org.openscience.cdk.depict.SvgDrawVisitor visitor,
List<? extends IRenderingElement> elements) |
String |
toEpsStr()
Render the image to an EPS (Encapsulated PostScript) format
string.
|
abstract BufferedImage |
toImg()
Render the depiction to a Java AWT
BufferedImage . |
String |
toPdfStr()
Render the image to an PDF format string.
|
String |
toPsStr()
Render the image to an PS (PostScript) format string.
|
String |
toSvgStr()
Render the image to an SVG image.
|
String |
toSvgStr(String units)
Render the image to an SVG image.
|
void |
writeTo(String path)
Write the depiction to the provided file path, the format is determined
by the path suffix.
|
void |
writeTo(String fmt,
File file)
Write the depiction to the provided output stream.
|
void |
writeTo(String fmt,
OutputStream out)
Write the depiction to the provided output stream.
|
void |
writeTo(String fmt,
String path)
Write the depiction to the provided file path.
|
protected static final double MM_TO_POINT
protected static final double DEFAULT_PADDING_FACTOR
public static final String SVG_FMT
public static final String PS_FMT
public static final String EPS_FMT
public static final String PDF_FMT
public static final String JPG_FMT
public static final String PNG_FMT
public static final String GIF_FMT
public static final String UNITS_MM
public static final String UNITS_PX
public abstract BufferedImage toImg()
BufferedImage
.public final String toSvgStr()
public final String toSvgStr(String units)
units
- the units for SVG - 'px' or 'mm'public final String toPsStr()
public final String toEpsStr()
public final String toPdfStr()
public final List<String> listFormats()
public final void writeTo(String fmt, OutputStream out) throws IOException
fmt
- formatout
- output streamIOException
- depiction could not be written, low level IO problemlistFormats()
public final void writeTo(String fmt, File file) throws IOException
fmt
- formatfile
- output destinationIOException
- depiction could not be written, low level IO problemlistFormats()
public final void writeTo(String fmt, String path) throws IOException
fmt
- formatpath
- output destination pathIOException
- depiction could not be written, low level IO problemlistFormats()
public final void writeTo(String path) throws IOException
path
- output destination pathIOException
- depiction could not be written, low level IO problemlistFormats()
protected final void draw(IDrawVisitor visitor, double zoom, Bounds bounds, Rectangle2D viewBounds)
visitor
- the draw visitorbounds
- a bound rendering elementzoom
- if the diagram is zoomed at allviewBounds
- the view bounds - the root will be centered in the boundsprotected void svgPrevisit(String fmt, double rescale, org.openscience.cdk.depict.SvgDrawVisitor visitor, List<? extends IRenderingElement> elements)
Copyright © 2022. All rights reserved.