- Package java.awt.image
- Class Image
- Field Summary
- Constructor Summary
- Method Summary
- Methods declared in class java.lang.Object
- Field Details
- accelerationPriority
- UndefinedProperty
- SCALE_DEFAULT
- SCALE_FAST
- SCALE_SMOOTH
- SCALE_REPLICATE
- SCALE_AREA_AVERAGING
- Constructor Details
- Image
- Method Details
- getWidth
- getHeight
- getSource
- getGraphics
- getProperty
- getScaledInstance
- flush
- getCapabilities
- setAccelerationPriority
- getAccelerationPriority
Package java.awt.image
Provides classes for creating and modifying images. Images are processed using a streaming framework that involves an image producer, optional image filters, and an image consumer. This framework makes it possible to progressively render an image while it is being fetched and generated. Moreover, the framework allows an application to discard the storage used by an image and to regenerate it at any time. This package provides a number of image producers, consumers, and filters that you can configure for your image processing needs.
This class provides default implementations of several Image methods for classes that want to implement the MultiResolutionImage interface.
This class uses an affine transform to perform a linear mapping from 2D coordinates in the source image or Raster to 2D coordinates in the destination image or Raster .
An ImageFilter class for scaling images using a simple area averaging algorithm that produces smoother results than the nearest neighbor algorithm.
This class performs an arbitrary linear combination of the bands in a Raster , using a specified matrix.
This class represents image data which is stored in a band interleaved fashion and for which each sample of a pixel occupies one data element of the DataBuffer.
The BufferedImageFilter class subclasses an ImageFilter to provide a simple means of using a single-source/single-destination image operator ( BufferedImageOp ) to filter a BufferedImage in the Image Producer/Consumer/Observer paradigm.
The BufferStrategy class represents the mechanism with which to organize complex memory on a particular Canvas or Window .
The ColorModel abstract class encapsulates the methods for translating a pixel value to color components (for example, red, green, and blue) and an alpha component.
A ColorModel class that works with pixel values that represent color and alpha information as separate samples and that store each sample in a separate data element.
This class represents image data which is stored such that each sample of a pixel occupies one data element of the DataBuffer.
The DirectColorModel class is a ColorModel class that works with pixel values that represent RGB color and alpha information as separate samples and that pack all samples for a single pixel into a single int, short, or byte quantity.
This class is an implementation of the ImageProducer interface which takes an existing image and a filter object and uses them to produce image data for a new filtered version of the original image.
This class implements a filter for the set of interface methods that are used to deliver data from an ImageProducer to an ImageConsumer.
An asynchronous update interface for receiving notifications about Image information as the Image is constructed.
The ImagingOpException is thrown if one of the BufferedImageOp or RasterOp filter methods cannot process the image.
The IndexColorModel class is a ColorModel class that works with pixel values consisting of a single sample that is an index into a fixed colormap in the default sRGB color space.
The Kernel class defines a matrix that describes how a specified pixel and its surrounding pixels affect the value computed for the pixel’s position in the output image of a filtering operation.
This class is an implementation of the ImageProducer interface which uses an array to produce pixel values for an Image.
The MultiPixelPackedSampleModel class represents one-banded images and can pack multiple one-sample pixels into one data element.
This interface is designed to be an optional additional API supported by some implementations of Image to allow them to provide alternate images for various rendering resolutions.
The PackedColorModel class is an abstract ColorModel class that works with pixel values which represent color and alpha information as separate samples and which pack all samples for a single pixel into a single int, short, or byte quantity.
The PixelGrabber class implements an ImageConsumer which can be attached to an Image or ImageProducer object to retrieve a subset of the pixels in that image.
This class represents image data which is stored in a pixel interleaved fashion and for which each sample of a pixel occupies one data element of the DataBuffer.
RenderedImage is a common interface for objects which contain or can produce image data in the form of Rasters.
This class performs a pixel-by-pixel rescaling of the data in the source image by multiplying the sample values for each pixel by a scale factor and then adding an offset.
This class provides an easy way to create an ImageFilter which modifies the pixels of an image in the default RGB ColorModel.
This class represents pixel data packed such that the N samples which make up a single pixel are stored in a single data array element, and each data data array element holds samples for only one pixel.
An interface for objects that wish to be informed when tiles of a WritableRenderedImage become modifiable by some writer via a call to getWritableTile, and when they become unmodifiable via the last call to releaseWritableTile.
VolatileImage is an image which can lose its contents at any time due to circumstances beyond the control of the application (e.g., situations caused by the operating system or by other applications).
WritableRenderedImage is a common interface for objects which contain or can produce image data in the form of Rasters and which can be modified and/or written over.
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
Class Image
The abstract class Image is the superclass of all classes that represent graphical images. The image must be obtained in a platform-specific manner.
Field Summary
Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.
The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.
Constructor Summary
Method Summary
Returns an ImageCapabilities object which can be inquired as to the capabilities of this Image on the specified GraphicsConfiguration.
Methods declared in class java.lang.Object
Field Details
accelerationPriority
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 setAccelerationPriority(float) method.
UndefinedProperty
The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.
SCALE_DEFAULT
SCALE_FAST
Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.
SCALE_SMOOTH
SCALE_REPLICATE
Use the image scaling algorithm embodied in the ReplicateScaleFilter class. The 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.
SCALE_AREA_AVERAGING
Use the Area Averaging image scaling algorithm. The image object is free to substitute a different filter that performs the same algorithm yet integrates more efficiently into the image infrastructure supplied by the toolkit.
Constructor Details
Image
Method Details
getWidth
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.
getHeight
Determines the height of the image. If the height is not yet known, this method returns -1 and the specified ImageObserver object is notified later.
getSource
Gets the object that produces the pixels for the image. This method is called by the image filtering classes and by methods that perform image conversion and scaling.
getGraphics
Creates a graphics context for drawing to an off-screen image. This method can only be called for off-screen images.
getProperty
Gets a property of this image by name. Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object. If the properties for this image are not yet known, this method returns null , and the ImageObserver object is notified later. The property name «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.
getScaledInstance
Creates a scaled version of this image. A new Image object is returned which will render the image at the specified width and height by default. The new Image object may be loaded asynchronously even if the original source image has already been loaded completely. If either width or height is a negative number then a value is substituted to maintain the aspect ratio of the original image dimensions. If both width and height are negative, then the original image dimensions are used.
flush
- BufferedImage objects leave the primary Raster which stores their pixels untouched, but flush any information cached about those pixels such as copies uploaded to the display hardware for accelerated blits.
- Image objects created by the Component methods which take a width and height leave their primary buffer of pixels untouched, but have all cached information released much like is done for BufferedImage objects.
- VolatileImage objects release all of their pixel resources including their primary copy which is typically stored on the display hardware where resources are scarce. These objects can later be restored using their validate method.
- Image objects created by the Toolkit and Component classes which are loaded from files, URLs or produced by an ImageProducer are unloaded and all local resources are released. These objects can later be reloaded from their original source as needed when they are rendered, just as when they were first created.
getCapabilities
Returns an ImageCapabilities object which can be inquired as to the capabilities of this Image on the specified GraphicsConfiguration. This allows programmers to find out more runtime information on the specific Image object that they have created. For example, the user 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.
setAccelerationPriority
Sets a hint for this image about how important acceleration is. This priority hint is used to compare to the priorities of other Image objects when determining how to use scarce acceleration resources such as video memory. When and if it is possible to accelerate this Image, if there are not enough resources available to provide that acceleration but enough can be freed up by de-accelerating some other image of lower priority, then that other Image may be de-accelerated in deference to this one. Images that have the same priority take up resources on a first-come, first-served basis.
getAccelerationPriority
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.