< prev index next >
src/java.desktop/share/classes/java/awt/Image.java
Print this page
*** 33,43 ****
import sun.awt.image.SurfaceManager;
/**
! * The abstract class <code>Image</code> is the superclass of all
* classes that represent graphical images. The image must be
* obtained in a platform-specific manner.
*
* @author Sami Shaio
* @author Arthur van Hoff
--- 33,43 ----
import sun.awt.image.SurfaceManager;
/**
! * The abstract class {@code Image} is the superclass of all
* classes that represent graphical images. The image must be
* obtained in a platform-specific manner.
*
* @author Sami Shaio
* @author Arthur van Hoff
*** 55,87 ****
/**
* Priority for accelerating this image. Subclasses are free to
* set different default priorities and applications are free to
* set the priority for specific images via the
! * <code>setAccelerationPriority(float)</code> method.
* @since 1.5
*/
protected float accelerationPriority = .5f;
/**
* Determines the width of the image. If the width is not yet known,
! * this method returns <code>-1</code> and the specified
! * <code>ImageObserver</code> object is notified later.
* @param observer an object waiting for the image to be loaded.
! * @return the width of this image, or <code>-1</code>
* if the width is not yet known.
* @see java.awt.Image#getHeight
* @see java.awt.image.ImageObserver
*/
public abstract int getWidth(ImageObserver observer);
/**
* Determines the height of the image. If the height is not yet known,
! * this method returns <code>-1</code> and the specified
! * <code>ImageObserver</code> object is notified later.
* @param observer an object waiting for the image to be loaded.
! * @return the height of this image, or <code>-1</code>
* if the height is not yet known.
* @see java.awt.Image#getWidth
* @see java.awt.image.ImageObserver
*/
public abstract int getHeight(ImageObserver observer);
--- 55,87 ----
/**
* Priority for accelerating this image. Subclasses are free to
* set different default priorities and applications are free to
* set the priority for specific images via the
! * {@code setAccelerationPriority(float)} method.
* @since 1.5
*/
protected float accelerationPriority = .5f;
/**
* Determines the width of the image. If the width is not yet known,
! * this method returns {@code -1} and the specified
! * {@code ImageObserver} object is notified later.
* @param observer an object waiting for the image to be loaded.
! * @return the width of this image, or {@code -1}
* if the width is not yet known.
* @see java.awt.Image#getHeight
* @see java.awt.image.ImageObserver
*/
public abstract int getWidth(ImageObserver observer);
/**
* Determines the height of the image. If the height is not yet known,
! * this method returns {@code -1} and the specified
! * {@code ImageObserver} object is notified later.
* @param observer an object waiting for the image to be loaded.
! * @return the height of this image, or {@code -1}
* if the height is not yet known.
* @see java.awt.Image#getWidth
* @see java.awt.image.ImageObserver
*/
public abstract int getHeight(ImageObserver observer);
*** 110,126 ****
/**
* Gets a property of this image by name.
* <p>
* Individual property names are defined by the various image
* formats. If a property is not defined for a particular image, this
! * method returns the <code>UndefinedProperty</code> object.
* <p>
* If the properties for this image are not yet known, this method
! * returns <code>null</code>, and the <code>ImageObserver</code>
* object is notified later.
* <p>
! * The property name <code>"comment"</code> should be used to store
* an optional comment which can be presented to the application as a
* description of the image, its source, or its author.
* @param name a property name.
* @param observer an object waiting for this image to be loaded.
* @return the value of the named property.
--- 110,126 ----
/**
* Gets a property of this image by name.
* <p>
* Individual property names are defined by the various image
* formats. If a property is not defined for a particular image, this
! * method returns the {@code UndefinedProperty} object.
* <p>
* If the properties for this image are not yet known, this method
! * returns {@code null}, and the {@code ImageObserver}
* object is notified later.
* <p>
! * The property name {@code "comment"} should be used to store
* an optional comment which can be presented to the application as a
* description of the image, its source, or its author.
* @param name a property name.
* @param observer an object waiting for this image to be loaded.
* @return the value of the named property.
*** 129,166 ****
* @see java.awt.Image#UndefinedProperty
*/
public abstract Object getProperty(String name, ImageObserver observer);
/**
! * The <code>UndefinedProperty</code> object should be returned whenever a
* property which was not defined for a particular image is fetched.
*/
public static final Object UndefinedProperty = new Object();
/**
* Creates a scaled version of this image.
! * A new <code>Image</code> object is returned which will render
! * the image at the specified <code>width</code> and
! * <code>height</code> by default. The new <code>Image</code> object
* may be loaded asynchronously even if the original source image
* has already been loaded completely.
*
* <p>
*
! * If either <code>width</code>
! * or <code>height</code> is a negative number then a value is
* substituted to maintain the aspect ratio of the original image
! * dimensions. If both <code>width</code> and <code>height</code>
* are negative, then the original image dimensions are used.
*
* @param width the width to which to scale the image.
* @param height the height to which to scale the image.
* @param hints flags to indicate the type of algorithm to use
* for image resampling.
* @return a scaled version of the image.
! * @exception IllegalArgumentException if <code>width</code>
! * or <code>height</code> is zero.
* @see java.awt.Image#SCALE_DEFAULT
* @see java.awt.Image#SCALE_FAST
* @see java.awt.Image#SCALE_SMOOTH
* @see java.awt.Image#SCALE_REPLICATE
* @see java.awt.Image#SCALE_AREA_AVERAGING
--- 129,166 ----
* @see java.awt.Image#UndefinedProperty
*/
public abstract Object getProperty(String name, ImageObserver observer);
/**
! * The {@code UndefinedProperty} object should be returned whenever a
* property which was not defined for a particular image is fetched.
*/
public static final Object UndefinedProperty = new Object();
/**
* Creates a scaled version of this image.
! * A new {@code Image} object is returned which will render
! * the image at the specified {@code width} and
! * {@code height} by default. The new {@code Image} object
* may be loaded asynchronously even if the original source image
* has already been loaded completely.
*
* <p>
*
! * If either {@code width}
! * or {@code height} is a negative number then a value is
* substituted to maintain the aspect ratio of the original image
! * dimensions. If both {@code width} and {@code height}
* are negative, then the original image dimensions are used.
*
* @param width the width to which to scale the image.
* @param height the height to which to scale the image.
* @param hints flags to indicate the type of algorithm to use
* for image resampling.
* @return a scaled version of the image.
! * @exception IllegalArgumentException if {@code width}
! * or {@code height} is zero.
* @see java.awt.Image#SCALE_DEFAULT
* @see java.awt.Image#SCALE_FAST
* @see java.awt.Image#SCALE_SMOOTH
* @see java.awt.Image#SCALE_REPLICATE
* @see java.awt.Image#SCALE_AREA_AVERAGING
*** 198,209 ****
*/
public static final int SCALE_SMOOTH = 4;
/**
* Use the image scaling algorithm embodied in the
! * <code>ReplicateScaleFilter</code> class.
! * The <code>Image</code> object is free to substitute a different filter
* that performs the same algorithm yet integrates more efficiently
* into the imaging infrastructure supplied by the toolkit.
* @see java.awt.image.ReplicateScaleFilter
* @since 1.1
*/
--- 198,209 ----
*/
public static final int SCALE_SMOOTH = 4;
/**
* Use the image scaling algorithm embodied in the
! * {@code ReplicateScaleFilter} class.
! * The {@code Image} object is free to substitute a different filter
* that performs the same algorithm yet integrates more efficiently
* into the imaging infrastructure supplied by the toolkit.
* @see java.awt.image.ReplicateScaleFilter
* @since 1.1
*/
*** 272,286 ****
* might create a BufferedImage but the system may have
* no video memory left for creating an image of that
* size on the given GraphicsConfiguration, so although the object
* may be acceleratable in general, it
* does not have that capability on this GraphicsConfiguration.
! * @param gc a <code>GraphicsConfiguration</code> object. A value of null
* for this parameter will result in getting the image capabilities
! * for the default <code>GraphicsConfiguration</code>.
! * @return an <code>ImageCapabilities</code> object that contains
! * the capabilities of this <code>Image</code> on the specified
* GraphicsConfiguration.
* @see java.awt.image.VolatileImage#getCapabilities()
* VolatileImage.getCapabilities()
* @since 1.5
*/
--- 272,286 ----
* might create a BufferedImage but the system may have
* no video memory left for creating an image of that
* size on the given GraphicsConfiguration, so although the object
* may be acceleratable in general, it
* does not have that capability on this GraphicsConfiguration.
! * @param gc a {@code GraphicsConfiguration} object. A value of null
* for this parameter will result in getting the image capabilities
! * for the default {@code GraphicsConfiguration}.
! * @return an {@code ImageCapabilities} object that contains
! * the capabilities of this {@code Image} on the specified
* GraphicsConfiguration.
* @see java.awt.image.VolatileImage#getCapabilities()
* VolatileImage.getCapabilities()
* @since 1.5
*/
*** 311,321 ****
* @param priority a value between 0 and 1, inclusive, where higher
* values indicate more importance for acceleration. A value of 0
* means that this Image should never be accelerated. Other values
* are used simply to determine acceleration priority relative to other
* Images.
! * @throws IllegalArgumentException if <code>priority</code> is less
* than zero or greater than 1.
* @since 1.5
*/
public void setAccelerationPriority(float priority) {
if (priority < 0 || priority > 1) {
--- 311,321 ----
* @param priority a value between 0 and 1, inclusive, where higher
* values indicate more importance for acceleration. A value of 0
* means that this Image should never be accelerated. Other values
* are used simply to determine acceleration priority relative to other
* Images.
! * @throws IllegalArgumentException if {@code priority} is less
* than zero or greater than 1.
* @since 1.5
*/
public void setAccelerationPriority(float priority) {
if (priority < 0 || priority > 1) {
< prev index next >