org.jhotdraw8.draw.tool.ImageCreationTool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jhotdraw8.draw Show documentation
Show all versions of org.jhotdraw8.draw Show documentation
JHotDraw8 Drawing Framework
The newest version!
/*
* @(#)ImageCreationTool.java
* Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
*/
package org.jhotdraw8.draw.tool;
import javafx.geometry.Dimension2D;
import javafx.stage.FileChooser;
import org.jspecify.annotations.Nullable;
import org.jhotdraw8.application.controls.urichooser.FileURIChooser;
import org.jhotdraw8.application.controls.urichooser.URIChooser;
import org.jhotdraw8.application.resources.Resources;
import org.jhotdraw8.draw.DrawingEditor;
import org.jhotdraw8.draw.figure.Figure;
import org.jhotdraw8.draw.figure.ImageFigure;
import org.jhotdraw8.draw.figure.Layer;
import org.jhotdraw8.fxcollection.typesafekey.MapAccessor;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.AbstractMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Supplier;
/**
* ImageCreationTool.
*
* @author Werner Randelshofer
*/
public class ImageCreationTool extends CreationTool {
private final MapAccessor uriKey = ImageFigure.IMAGE_URI;
private URIChooser uriChooser;
private @Nullable URI uri;
private Future dimensionFuture;
public ImageCreationTool(String name, Resources rsrc, Supplier