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