| 1 | /* Image.java -- Java class for images
|
|---|
| 2 | Copyright (C) 1999 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 6 | GNU Classpath is free software; you can redistribute it and/or modify
|
|---|
| 7 | it under the terms of the GNU General Public License as published by
|
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | any later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU Classpath is distributed in the hope that it will be useful, but
|
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 14 | General Public License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
|---|
| 18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 19 | 02111-1307 USA.
|
|---|
| 20 |
|
|---|
| 21 | Linking this library statically or dynamically with other modules is
|
|---|
| 22 | making a combined work based on this library. Thus, the terms and
|
|---|
| 23 | conditions of the GNU General Public License cover the whole
|
|---|
| 24 | combination.
|
|---|
| 25 |
|
|---|
| 26 | As a special exception, the copyright holders of this library give you
|
|---|
| 27 | permission to link this library with independent modules to produce an
|
|---|
| 28 | executable, regardless of the license terms of these independent
|
|---|
| 29 | modules, and to copy and distribute the resulting executable under
|
|---|
| 30 | terms of your choice, provided that you also meet, for each linked
|
|---|
| 31 | independent module, the terms and conditions of the license of that
|
|---|
| 32 | module. An independent module is a module which is not derived from
|
|---|
| 33 | or based on this library. If you modify this library, you may extend
|
|---|
| 34 | this exception to your version of the library, but you are not
|
|---|
| 35 | obligated to do so. If you do not wish to do so, delete this
|
|---|
| 36 | exception statement from your version. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package java.awt;
|
|---|
| 40 |
|
|---|
| 41 | import java.awt.image.*;
|
|---|
| 42 |
|
|---|
| 43 | /**
|
|---|
| 44 | * This is the abstract superclass of all image objects in Java.
|
|---|
| 45 | *
|
|---|
| 46 | * @author Aaron M. Renn ([email protected])
|
|---|
| 47 | */
|
|---|
| 48 | public abstract class Image
|
|---|
| 49 | {
|
|---|
| 50 |
|
|---|
| 51 | /*
|
|---|
| 52 | * Static Variables
|
|---|
| 53 | */
|
|---|
| 54 |
|
|---|
| 55 | /**
|
|---|
| 56 | * Constant indicating that the default scaling algorithm should be used.
|
|---|
| 57 | */
|
|---|
| 58 | public static final int SCALE_DEFAULT = 1;
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | * Constant indicating that a fast scaling algorithm should be used.
|
|---|
| 62 | */
|
|---|
| 63 | public static final int SCALE_FAST = 2;
|
|---|
| 64 |
|
|---|
| 65 | /**
|
|---|
| 66 | * Constant indicating that a smooth scaling algorithm should be used.
|
|---|
| 67 | */
|
|---|
| 68 | public static final int SCALE_SMOOTH = 4;
|
|---|
| 69 |
|
|---|
| 70 | /**
|
|---|
| 71 | * Constant indicating that the <code>ReplicateScaleFilter</code> class
|
|---|
| 72 | * algorithm should be used for scaling.
|
|---|
| 73 | */
|
|---|
| 74 | public static final int SCALE_REPLICATE = 8;
|
|---|
| 75 |
|
|---|
| 76 | /**
|
|---|
| 77 | * Constant indicating that the area averaging scaling algorithm should be
|
|---|
| 78 | * used.
|
|---|
| 79 | */
|
|---|
| 80 | public static final int SCALE_AREA_AVERAGING = 16;
|
|---|
| 81 |
|
|---|
| 82 | /**
|
|---|
| 83 | * This variable is returned whenever a property that is not defined
|
|---|
| 84 | * is requested.
|
|---|
| 85 | */
|
|---|
| 86 | public static final Object UndefinedProperty = Image.class;
|
|---|
| 87 |
|
|---|
| 88 | /*************************************************************************/
|
|---|
| 89 |
|
|---|
| 90 | /*
|
|---|
| 91 | * Constructors
|
|---|
| 92 | */
|
|---|
| 93 |
|
|---|
| 94 | /**
|
|---|
| 95 | * A default constructor for subclasses.
|
|---|
| 96 | */
|
|---|
| 97 | public
|
|---|
| 98 | Image()
|
|---|
| 99 | {
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | /*************************************************************************/
|
|---|
| 103 |
|
|---|
| 104 | /*
|
|---|
| 105 | * Instance Methods
|
|---|
| 106 | */
|
|---|
| 107 |
|
|---|
| 108 | /**
|
|---|
| 109 | * Returns the width of the image, or -1 if it is unknown. If the
|
|---|
| 110 | * image width is unknown, the observer object will be notified when
|
|---|
| 111 | * the value is known.
|
|---|
| 112 | *
|
|---|
| 113 | * @param observer The image observer for this object.
|
|---|
| 114 | */
|
|---|
| 115 | public abstract int
|
|---|
| 116 | getWidth(ImageObserver observer);
|
|---|
| 117 |
|
|---|
| 118 | /*************************************************************************/
|
|---|
| 119 |
|
|---|
| 120 | /**
|
|---|
| 121 | * Returns the height of the image, or -1 if it is unknown. If the
|
|---|
| 122 | * image height is unknown, the observer object will be notified when
|
|---|
| 123 | * the value is known.
|
|---|
| 124 | *
|
|---|
| 125 | * @param observer The image observer for this object.
|
|---|
| 126 | */
|
|---|
| 127 | public abstract int
|
|---|
| 128 | getHeight(ImageObserver observer);
|
|---|
| 129 |
|
|---|
| 130 | /*************************************************************************/
|
|---|
| 131 |
|
|---|
| 132 | /**
|
|---|
| 133 | * Returns the image producer object for this object.
|
|---|
| 134 | *
|
|---|
| 135 | * @return The image producer for this object.
|
|---|
| 136 | */
|
|---|
| 137 | public abstract ImageProducer
|
|---|
| 138 | getSource();
|
|---|
| 139 |
|
|---|
| 140 | /*************************************************************************/
|
|---|
| 141 |
|
|---|
| 142 | /**
|
|---|
| 143 | * Returns a graphics context object for drawing an off-screen object.
|
|---|
| 144 | * This method is only valid for off-screen objects.
|
|---|
| 145 | *
|
|---|
| 146 | * @return A graphics context object for an off-screen object.
|
|---|
| 147 | */
|
|---|
| 148 | public abstract Graphics
|
|---|
| 149 | getGraphics();
|
|---|
| 150 |
|
|---|
| 151 | /*************************************************************************/
|
|---|
| 152 |
|
|---|
| 153 | /**
|
|---|
| 154 | * This method requests a named property for an object. The value of the
|
|---|
| 155 | * property is returned. The value <code>UndefinedProperty</code> is
|
|---|
| 156 | * returned if there is no property with the specified name. The value
|
|---|
| 157 | * <code>null</code> is returned if the properties for the object are
|
|---|
| 158 | * not yet known. In this case, the specified image observer is notified
|
|---|
| 159 | * when the properties are known.
|
|---|
| 160 | *
|
|---|
| 161 | * @param name The requested property name.
|
|---|
| 162 | * @param observer The image observer for this object.
|
|---|
| 163 | */
|
|---|
| 164 | public abstract Object
|
|---|
| 165 | getProperty(String name, ImageObserver observer);
|
|---|
| 166 |
|
|---|
| 167 | /*************************************************************************/
|
|---|
| 168 |
|
|---|
| 169 | /**
|
|---|
| 170 | * Scales the image to the requested dimension.
|
|---|
| 171 | *
|
|---|
| 172 | * XXX: FIXME
|
|---|
| 173 | *
|
|---|
| 174 | * @param width The width of the scaled image.
|
|---|
| 175 | * @param height The height of the scaled image.
|
|---|
| 176 | * @param flags A value indicating the algorithm to use, which will be
|
|---|
| 177 | * set from contants defined in this class.
|
|---|
| 178 | *
|
|---|
| 179 | * @return The scaled <code>Image</code> object.
|
|---|
| 180 | */
|
|---|
| 181 | public Image
|
|---|
| 182 | getScaledInstance(int width, int height, int flags)
|
|---|
| 183 | {
|
|---|
| 184 | return null;
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 | /*************************************************************************/
|
|---|
| 188 |
|
|---|
| 189 | /**
|
|---|
| 190 | * Flushes (that is, destroys) any resources used for this image. This
|
|---|
| 191 | * includes the actual image data.
|
|---|
| 192 | */
|
|---|
| 193 | public abstract void
|
|---|
| 194 | flush();
|
|---|
| 195 |
|
|---|
| 196 | } // class Image
|
|---|
| 197 |
|
|---|