Package org.openscience.cdk.depict
Class Depiction
java.lang.Object
org.openscience.cdk.depict.Depiction
Base class of a pre-rendered depiction. The class allows introspection of
depiction size (decided at generation time) and serialization to raster
and vector graphic formats.
- Author:
- John May
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final double
When no fixed padding value is specified we use margin multiplied by this value.static final String
Encapsulated PostScript (EPS) format key.static final String
Graphics Interchange Format (GIF) format key.static final String
Joint Photographic Experts Group (JPG) format key.protected static final double
For converting MM coordinates to PS Point (1/72 inch)static final String
Portable Document Format (PDF) format key.static final String
Portable Network Graphics (PNG) format key.static final String
PostScript (PS) format key.static final String
Structured Vector Graphics (SVG) format key.static final String
Units in MM (specific to SVG).static final String
Units in PX (specific to SVG). -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
draw
(IDrawVisitor visitor, double zoom, Bounds bounds, Rectangle2D viewBounds) Low-level draw method used by other rendering methods.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) final String
toEpsStr()
Render the image to an EPS (Encapsulated PostScript) format string.abstract BufferedImage
toImg()
Render the depiction to a Java AWTBufferedImage
.final String
toPdfStr()
Render the image to an PDF format string.final String
toPsStr()
Render the image to an PS (PostScript) format string.final String
toSvgStr()
Render the image to an SVG image.final String
Render the image to an SVG image.final void
Write the depiction to the provided file path, the format is determined by the path suffix.final void
Write the depiction to the provided output stream.final void
writeTo
(String fmt, OutputStream out) Write the depiction to the provided output stream.final void
Write the depiction to the provided file path.
-
Field Details
-
MM_TO_POINT
protected static final double MM_TO_POINTFor converting MM coordinates to PS Point (1/72 inch)- See Also:
-
DEFAULT_PADDING_FACTOR
protected static final double DEFAULT_PADDING_FACTORWhen no fixed padding value is specified we use margin multiplied by this value.- See Also:
-
SVG_FMT
Structured Vector Graphics (SVG) format key.- See Also:
-
PS_FMT
PostScript (PS) format key.- See Also:
-
EPS_FMT
Encapsulated PostScript (EPS) format key.- See Also:
-
PDF_FMT
Portable Document Format (PDF) format key.- See Also:
-
JPG_FMT
Joint Photographic Experts Group (JPG) format key.- See Also:
-
PNG_FMT
Portable Network Graphics (PNG) format key.- See Also:
-
GIF_FMT
Graphics Interchange Format (GIF) format key.- See Also:
-
UNITS_MM
Units in MM (specific to SVG).- See Also:
-
UNITS_PX
Units in PX (specific to SVG).- See Also:
-
-
Method Details
-
toImg
Render the depiction to a Java AWTBufferedImage
.- Returns:
- AWT buffered image
-
toSvgStr
Render the image to an SVG image.- Returns:
- svg XML content
-
toSvgStr
Render the image to an SVG image.- Parameters:
units
- the units for SVG - 'px' or 'mm'- Returns:
- svg XML content
-
toPsStr
Render the image to an PS (PostScript) format string.- Returns:
- PS content
-
toEpsStr
Render the image to an EPS (Encapsulated PostScript) format string.- Returns:
- EPS content
-
toPdfStr
Render the image to an PDF format string.- Returns:
- pdf content
-
listFormats
List the available formats that can be rendered.- Returns:
- supported formats
-
writeTo
Write the depiction to the provided output stream.- Parameters:
fmt
- formatout
- output stream- Throws:
IOException
- depiction could not be written, low level IO problem- See Also:
-
writeTo
Write the depiction to the provided output stream.- Parameters:
fmt
- formatfile
- output destination- Throws:
IOException
- depiction could not be written, low level IO problem- See Also:
-
writeTo
Write the depiction to the provided file path.- Parameters:
fmt
- formatpath
- output destination path- Throws:
IOException
- depiction could not be written, low level IO problem- See Also:
-
writeTo
Write the depiction to the provided file path, the format is determined by the path suffix.- Parameters:
path
- output destination path- Throws:
IOException
- depiction could not be written, low level IO problem- See Also:
-
draw
Low-level draw method used by other rendering methods.- Parameters:
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 bounds
-
svgPrevisit
protected void svgPrevisit(String fmt, double rescale, org.openscience.cdk.depict.SvgDrawVisitor visitor, List<? extends IRenderingElement> elements)
-