//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::../../../_part_attributes.asciidoc[]

:leveloffset: -2

[[tools-cifsim-output-svgviz-chapter-viewer]]
== SVG viewer and visualizer

indexterm:[SVG,viewer]
indexterm:[SVG viewer]
indexterm:[SVG visualization,visualizer]
indexterm:[see: SVG visualizer,SVG visualization]
indexterm:[see: SVG visualizer,SVG viewer]
The Eclipse ESCET IDE comes with an SVG viewer.
SVG image files can be opened for viewing.
This same viewer is used as a basis for the <<tools-cifsim-output-svgviz-chapter-index,SVG visualizer>> used by the CIF simulator.

=== SVG viewer

Opening SVG files in the ESCET IDE results in them being opened by the SVG viewer.
The SVG viewer can be used to preview SVG images from within the ESCET IDE.

If the SVG viewer can not open an SVG image, for instance because it contains <<tools-cifsim-output-svgviz-simulation-unsupported,unsupported features>> such as <<lang-tut-svg-chapter-inkscape-textarea,text areas>>, the SVG viewer will indicate this.
Therefore, to some extent, you can open an SVG image in the ESCET IDE to verify that it can be used for SVG visualization.
Note however that not all unsupported features are reported this way, such as unsupported style properties in `style` attributes.

indexterm:[SVG viewer,refresh]

=== Refresh

The SVG viewer does _not_ refresh its display if the image file is changed.
To refresh the image, close the image, and open it again.

indexterm:[SVG viewer,save as]
indexterm:[SVG viewer,export]
indexterm:[SVG viewer,PNG]
indexterm:[SVG viewer,JPEG]
indexterm:[SVG viewer,GIF]
indexterm:[SVG viewer,SVG]

[[tools-cifsim-output-svgviz-viewer-saveas]]
=== Save as

The SVG viewer and SVG visualizer can export the currently visible image to several different image formats.
To export the image, first make sure that the SVG viewer or SVG visualizer has the focus.
Then select menu:File[Save As...] to open the _Save SVG as_ dialog.
Alternatively, right click the SVG image itself, and choose menu:Save As...[] from the popup menu, to open the _Save SVG as_ dialog.
In the dialog, specify the file name of the exported image.
Click btn:[OK] to confirm and to actually export the image.

The following link:https://en.wikipedia.org/wiki/Raster_graphics[raster image] formats are supported:

* link:https://en.wikipedia.org/wiki/Portable_Network_Graphics[Portable Network Graphics] (`+*.png+`)

* link:https://en.wikipedia.org/wiki/JPEG[JPEG] (`+*.jpg+`)

* link:https://en.wikipedia.org/wiki/Graphics_Interchange_Format[Graphics Interchange Format] (`+*.gif+`)

The following link:https://en.wikipedia.org/wiki/Vector_graphics[vector image] formats are supported:

* link:https://en.wikipedia.org/wiki/Scalable_Vector_Graphics[Scalable Vector Graphics] (`*.svg`)

The image format that is used to export the image, is derived from the file extension that is used.
For each of the supported file formats, the allowed file names (with file extensions) are indicated above (between parentheses).

After the image is exported, the workspace is refreshed to show that new image file, if the image was saved in a project that is visible in the _Project Explorer_ tab or _Package Explorer_ tab.
