--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.g2d.image;\r
+\r
+ import java.awt.Shape;\r
+import java.awt.geom.Rectangle2D;\r
+import java.util.EnumSet;\r
+\r
+import org.simantics.scenegraph.Node;\r
+import org.simantics.scenegraph.g2d.G2DParentNode;\r
+\r
+/**\r
+ * Interface for paintable graphics - either vector or raster.\r
+ * \r
+ * \r
+ * @See {@link ImageUtils} Image handling utilities\r
+ * @author Toni Kalajainen\r
+ */\r
+public interface Image {\r
+ \r
+ /**\r
+ * Paint the image to a graphics 2d context.\r
+ * \r
+ * @param g graphics context\r
+ */\r
+ Node init(G2DParentNode parent);\r
+ \r
+ /**\r
+ * Get rectangle that contains the whole image.\r
+ * \r
+ * @return bounds\r
+ */\r
+ Rectangle2D getBounds();\r
+ \r
+ /**\r
+ * Get an outline of the image.\r
+ * \r
+ * @return boundary of the image\r
+ */\r
+ Shape getOutline();\r
+ \r
+ public enum Feature {\r
+ Vector, // Vector image, unlimited quality\r
+ Volatile // The content of the image may change\r
+ }\r
+ \r
+ EnumSet<Feature> VECTOR = EnumSet.of(Feature.Vector);\r
+ EnumSet<Feature> VOLATILE = EnumSet.of(Feature.Volatile);\r
+ EnumSet<Feature> VOLATILE_VECTOR = EnumSet.of(Feature.Vector, Feature.Volatile);\r
+ \r
+ public EnumSet<Feature> getFeatures();\r
+ \r
+ public interface ImageListener {\r
+ /**\r
+ * Notification signaling that the content (size, of content) \r
+ * of an image has changed.\r
+ * This notification can occur only to images with Volatile feature. \r
+ * \r
+ * @param image\r
+ */\r
+ void onContentChangedNotification(Image image);\r
+ }\r
+ \r
+ /**\r
+ * Add image listener. \r
+ * @param listener\r
+ */\r
+ void addImageListener(ImageListener listener);\r
+ \r
+ /**\r
+ * Remove image listener\r
+ * @param listener\r
+ */\r
+ void removeImageListener(ImageListener listener);\r
+ \r
+}\r