/**
  * {@inheritDoc}
  *
  * <p>Redirect to the scilab code implementation.
  */
 @Override
 public String convertToImage(
     String currentFile,
     String code,
     Map<String, String> attributes,
     File imageFile,
     String imageName) {
   return conv.getImageConverter()
       .getScilabImageConverter()
       .convertToImage(currentFile, code, attributes, imageFile, imageName);
 }
  private final String convertToPNG(
      final String helpID,
      final String xcosFile,
      Map<String, String> attributes,
      final File imageFile,
      final String imageName)
      throws Exception {
    /*
     * use a delegate method to avoid a static dependency
     */
    final Class<?> export = Class.forName("org.scilab.modules.xcos.utils.XcosDelegates");
    final Method convertToPNG =
        export.getDeclaredMethod(
            "convertToPNG", String.class, String.class, File.class, String.class);
    try {
      convertToPNG.invoke(null, helpID, xcosFile, imageFile, imageName);
    } catch (InvocationTargetException e) {
      e.getCause().printStackTrace();
    }

    return conv.generateImageCode(xcosFile, conv.getBaseImagePath() + imageName, attributes);
  }