Package com.isomorphic.rpc
Interface IImageExporter
- All Known Implementing Classes:
ImageExport
public interface IImageExporter
Interface to an SVG rendering service. An
IImageExporter
object has methods for converting SVG source (String) to PNG or JPEG format and either return an InputStream
to read the image's bytes, or write the image bytes to a given OutputStream
.-
Method Summary
Modifier and TypeMethodDescriptionParses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and returns anInputStream
for reading theBufferedImage
in JPEG format at the given quality level.Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and returns anInputStream
for reading theBufferedImage
in PNG format.void
writeJPEG
(OutputStream os, String svgString, Float quality) Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and writes theBufferedImage
as a JPEG toos
at the given quality level.void
writePNG
(OutputStream os, String svgString) Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and writes theBufferedImage
as a PNG toos
.
-
Method Details
-
writePNG
Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and writes theBufferedImage
as a PNG toos
.- Parameters:
os
- theOutputStream
where the PNG data is written.svgString
- the SVG graphic source.- Throws:
IOException
-
writeJPEG
Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and writes theBufferedImage
as a JPEG toos
at the given quality level.- Parameters:
os
- theOutputStream
where the JPEG data is written.svgString
- the SVG graphic source.quality
- a number between 0 and 1, with 1 representing the best quality and 0 representing the least quality but smallest file size. Passnull
to use the default quality.- Throws:
IOException
-
getPNG
Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and returns anInputStream
for reading theBufferedImage
in PNG format.- Parameters:
svgString
- the SVG graphic source.- Returns:
- an
InputStream
for reading a rasterization of the SVG graphic in PNG format. - Throws:
IOException
-
getJPEG
Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-createdBufferedImage
, and returns anInputStream
for reading theBufferedImage
in JPEG format at the given quality level.- Parameters:
svgString
- the SVG graphic source.quality
- a number between 0 and 1, with 1 representing the best quality and 0 representing the least quality but smallest file size. Passnull
to use the default quality.- Returns:
- an
InputStream
for reading a rasterization of the SVG graphic in JPEG format. - Throws:
IOException
-