Package chemaxon.util
Class ImageExportUtil
- java.lang.Object
-
- chemaxon.util.ImageExportUtil
-
@PublicAPI public class ImageExportUtil extends Object
Utility functions to create format parameter string for molecule export and for usage of .NET based EMF generator.- Since:
- Marvin 5.2.1
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
createEMF(String mrvSource, String exporterParamStr)
Creates a .NET based EMF picture.static String
createImageExporterParameter(Properties settings, String format, MDocument doc)
Creates the Image Exporter parameter String based on the values in the Properties object.static String
createSetColoringParameter(Properties settings, MDocument doc)
static void
disableNewEmfGenerator()
Disables the new .NET based EMF generator.static boolean
generateEMFToFile(String mrvSource, String exporterParamStr, String fileName)
Creates a new .NET based EMF picture and saves it to the given file.static Properties
mergeProperties(UserSettings settings, MPropertyContainer guiprops, Rectangle r)
Merge the properties of UserSettings with the GUI properties.
If both has a value for a given key, the value stored in GUI properties will be used.static void
releaseNewEMFGenerator()
Releases and disposes native resources needed by the .NET based EMF generator.static void
startEMFGenerator()
Starts the initialization of the .NET based EMF generator on a background thread.
-
-
-
Method Detail
-
createImageExporterParameter
public static String createImageExporterParameter(Properties settings, String format, MDocument doc)
Creates the Image Exporter parameter String based on the values in the Properties object.- Parameters:
settings
- seeUserSettings
ormergeProperties(UserSettings, MPropertyContainer, Rectangle)
format
- the format name used by MolExporter in the format string before the ":" signdoc
- the MDocument from which the atom set information can be gathered.- Returns:
- String formed as a proper ImageExporter parameter String
-
createSetColoringParameter
public static String createSetColoringParameter(Properties settings, MDocument doc)
-
mergeProperties
public static Properties mergeProperties(UserSettings settings, MPropertyContainer guiprops, Rectangle r)
Merge the properties of UserSettings with the GUI properties.
If both has a value for a given key, the value stored in GUI properties will be used. The rectangle adds the width and height property to the returned Properties object, for image sizing.- Parameters:
settings
- a UserSettings objectguiprops
- an MPropertyContainer object containing GUI propertiesr
- the Rectangle which will determine the picture size in pixels.- Returns:
- a Properties object merged from UserSettings and GUI properties, and extended with the size information. If any of the parameters are null, those values won't added to the result.
- See Also:
MDocument.getGUIPropertyContainer()
,MarvinPane.getUserSettings()
-
startEMFGenerator
public static void startEMFGenerator()
Starts the initialization of the .NET based EMF generator on a background thread. If the initialization has failed, disables the usage of the generator, in this case, thecreateEMF(String, String)
method will return null.
-
disableNewEmfGenerator
public static void disableNewEmfGenerator()
Disables the new .NET based EMF generator.
-
createEMF
public static byte[] createEMF(String mrvSource, String exporterParamStr)
Creates a .NET based EMF picture.- Parameters:
mrvSource
- the molecule sourceexporterParamStr
- the param string which should be applied to MolExporter.- Returns:
- the EMF picture data as byte[]
-
generateEMFToFile
public static boolean generateEMFToFile(String mrvSource, String exporterParamStr, String fileName)
Creates a new .NET based EMF picture and saves it to the given file.- Parameters:
mrvSource
- the molecule sourceexporterParamStr
- the param string which should be applied to MolExporter.fileName
- the name of the file that should be saved.- Returns:
- true on success, false otherwise
-
releaseNewEMFGenerator
public static void releaseNewEMFGenerator()
Releases and disposes native resources needed by the .NET based EMF generator. If the generator is under initialization, this method has to wait until the initialization is finished.
-
-