1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.image;
14 import java.awt.Shape;
15 import java.awt.geom.Rectangle2D;
16 import java.util.EnumSet;
18 import org.simantics.scenegraph.Node;
19 import org.simantics.scenegraph.g2d.G2DParentNode;
22 * Interface for paintable graphics - either vector or raster.
25 * @See {@link ImageUtils} Image handling utilities
26 * @author Toni Kalajainen
28 public interface Image {
31 * Paint the image to a graphics 2d context.
33 * @param g graphics context
35 Node init(G2DParentNode parent);
38 * Get rectangle that contains the whole image.
42 Rectangle2D getBounds();
45 * Get an outline of the image.
47 * @return boundary of the image
52 Vector, // Vector image, unlimited quality
53 Volatile // The content of the image may change
56 EnumSet<Feature> VECTOR = EnumSet.of(Feature.Vector);
57 EnumSet<Feature> VOLATILE = EnumSet.of(Feature.Volatile);
58 EnumSet<Feature> VOLATILE_VECTOR = EnumSet.of(Feature.Vector, Feature.Volatile);
60 public EnumSet<Feature> getFeatures();
62 public interface ImageListener {
64 * Notification signaling that the content (size, of content)
65 * of an image has changed.
66 * This notification can occur only to images with Volatile feature.
70 void onContentChangedNotification(Image image);
77 void addImageListener(ImageListener listener);
80 * Remove image listener
83 void removeImageListener(ImageListener listener);