Class ImageExporter
java.lang.Object
com.nomagic.magicdraw.export.image.ImageExporter
The exporter of diagrams to various images formats.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
EMF image format.static final int
EPS image format.static final int
JPEG image format.static final int
PNG image format.static final int
SVG image format.static final int
.static final int
TIFF image format.static final int
WMF image format. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
export
(AbstractDiagramPresentationElement diagram, boolean justSelected) Exports diagram into the BufferedImage.static BufferedImage
export
(AbstractDiagramPresentationElement diagram, boolean justSelected, int scalePercent) Exports diagram into the BufferedImage.static Rectangle
export
(AbstractDiagramPresentationElement diagram, int format, File file) Exports diagram into given format image.static Rectangle
export
(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected) Exports diagram into given format image.static Rectangle
export
(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, boolean saveBackground) Exports diagram into given format image.static Rectangle
export
(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, int dpi, int scalePercent) Exports diagram into given format image.static Rectangle
export
(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, ProgressStatus progressStatus) Exports diagram into given format image.static BufferedImage
export
(PresentationElement element, int scalePercent) Exports single PresentationElement (for example Class) into the BufferedImage.static Rectangle
export
(PresentationElement element, int format, File file, int dpi, int scalePercent) Exports single PresentationElement(for example Class) into the given format image.static ImageExportResult
exportForResult
(AbstractDiagramPresentationElement diagram, int format, File file) Exports diagram into given format image.static ImageExportResult
exportForResult
(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, int dpi, int scalePercent) Exports diagram into given format image.static ImageExportResult
exportForResult
(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, ProgressStatus progressStatus) Exports diagram into given format image.static ImageExportResult
exportForResult
(PresentationElement element, int format, File file, int dpi, int scalePercent) Exports single PresentationElement(for example Class) into the given format image.static boolean
Checks if any selected symbol (in given diagram) can be exported into image.
-
Field Details
-
JPEG
public static final int JPEGJPEG image format.- See Also:
-
PNG
public static final int PNGPNG image format.- See Also:
-
WMF
public static final int WMFWMF image format.- See Also:
-
EPS
public static final int EPSEPS image format.- See Also:
-
SVG
public static final int SVGSVG image format.- See Also:
-
EMF
public static final int EMFEMF image format.- See Also:
-
TIFF
public static final int TIFFTIFF image format.- See Also:
-
SVG_NO_BOUNDS_CHANGE
public static final int SVG_NO_BOUNDS_CHANGE. SVG image format without bounds change. Used to preview changes in diagrams in merge dialog.- See Also:
-
-
Constructor Details
-
ImageExporter
public ImageExporter()
-
-
Method Details
-
export
@CheckForNull public static BufferedImage export(AbstractDiagramPresentationElement diagram, boolean justSelected) throws IOException Exports diagram into the BufferedImage. Exports all symbols from the diagram.- Parameters:
diagram
- the given diagram.justSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exported- Returns:
- the BufferedImage instance of the diagram.
- Throws:
IOException
- in case of some io error.
-
export
@CheckForNull public static BufferedImage export(AbstractDiagramPresentationElement diagram, boolean justSelected, int scalePercent) throws IOException Exports diagram into the BufferedImage. Exports all symbols from the diagram.- Parameters:
diagram
- the given diagram.justSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exportedscalePercent
- defines scaling the output image to given percentage. Value of 100 does not scale image.- Returns:
- the BufferedImage instance of the diagram.
- Throws:
IOException
- in case of some io error.
-
export
public static Rectangle export(AbstractDiagramPresentationElement diagram, int format, File file) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output file- Returns:
- saved image bounds(start point in the diagram and dimension of image).
- Throws:
IOException
- in case of some io error.
-
exportForResult
public static ImageExportResult exportForResult(AbstractDiagramPresentationElement diagram, int format, File file) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output file- Returns:
- Image export result.
- Throws:
IOException
- in case of some io error.
-
export
public static Rectangle export(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all or just selected symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output filejustSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exported- Returns:
- saved image bounds(start point in the diagram and dimension of image).
- Throws:
IOException
- in case of some io error.
-
export
@CheckForNull public static Rectangle export(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, @CheckForNull ProgressStatus progressStatus) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all or just selected symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output filejustSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exportedprogressStatus
- instance ofProgressStatus
can be null.- Returns:
- saved image bounds(start point in the diagram and dimension of image).
- Throws:
IOException
- in case of some io error.
-
exportForResult
@CheckForNull public static ImageExportResult exportForResult(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, @CheckForNull ProgressStatus progressStatus) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all or just selected symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output filejustSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exportedprogressStatus
- instance ofProgressStatus
can be null.- Returns:
- Image export result.
- Throws:
IOException
- in case of some io error.
-
export
public static Rectangle export(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, boolean saveBackground) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all or just selected symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output filejustSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exportedsaveBackground
- save diagram background in image.- Returns:
- saved image bounds(start point in the diagram and dimension of image).
- Throws:
IOException
- in case of some io error.
-
exportForResult
public static ImageExportResult exportForResult(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, int dpi, int scalePercent) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all or just selected symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output filejustSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exporteddpi
- sets the DPI flag in output image. Parameter is ignored for vector images.scalePercent
- defines scaling the output image to given percentage. Value of 100 does not scale image. Is ignored by WMF file format.- Returns:
- Image export result.
- Throws:
IOException
- in case of some io error.
-
export
public static Rectangle export(AbstractDiagramPresentationElement diagram, int format, File file, boolean justSelected, int dpi, int scalePercent) throws IOException Exports diagram into given format image. Writes this image into given file. Exports all or just selected symbols from the diagram.- Parameters:
diagram
- the given diagram.format
- format of the image.file
- the output filejustSelected
- export only selected symbols in the diagram. If diagram does not have selected symbols, all symbols are exporteddpi
- sets the DPI flag in output image. Parameter is ignored for vector images.scalePercent
- defines scaling the output image to given percentage. Value of 100 does not scale image. Is ignored by WMF file format.- Returns:
- saved image bounds(start point in the diagram and dimension of image).
- Throws:
IOException
- in case of some io error.
-
isSelectedSymbolsExportable
Checks if any selected symbol (in given diagram) can be exported into image. E.g. the selected link can not be exported if the connected elements symbols are not selected.- Parameters:
diagram
- given diagram.- Returns:
true
- if any of selected symbols can be exported; otherwise -false
.
-
export
@CheckForNull public static Rectangle export(PresentationElement element, int format, File file, int dpi, int scalePercent) throws IOException Exports single PresentationElement(for example Class) into the given format image. Writes this image into the given file.- Parameters:
element
- the given presentation element.format
- format of the image.file
- the output filedpi
- sets the DPI flag in output image. Parameter is ignored for vector images.scalePercent
- defines scaling the output image to given percentage. Value of 100 does not scale image. Is ignored by WMF file format.- Returns:
- saved image bounds(start point in the diagram and dimension of image).
- Throws:
IOException
- in case of some io error.
-
exportForResult
@CheckForNull public static ImageExportResult exportForResult(PresentationElement element, int format, File file, int dpi, int scalePercent) throws IOException Exports single PresentationElement(for example Class) into the given format image. Writes this image into the given file.- Parameters:
element
- the given presentation element.format
- format of the image.file
- the output filedpi
- sets the DPI flag in output image. Parameter is ignored for vector images.scalePercent
- defines scaling the output image to given percentage. Value of 100 does not scale image. Is ignored by WMF file format.- Returns:
- Image export result.
- Throws:
IOException
- in case of some io error.
-
export
@CheckForNull public static BufferedImage export(PresentationElement element, int scalePercent) throws IOException Exports single PresentationElement (for example Class) into the BufferedImage.- Parameters:
element
- the given element.scalePercent
- defines scaling the output image to given percentage. Value of 100 does not scale image.- Returns:
- the BufferedImage instance of the diagram.
- Throws:
IOException
- in case of some io error.
-