KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > image > RenderedImage


1 /*
2  * @(#)RenderedImage.java 1.22 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 /* ****************************************************************
9  ******************************************************************
10  ******************************************************************
11  *** COPYRIGHT (c) Eastman Kodak Company, 1997
12  *** As an unpublished work pursuant to Title 17 of the United
13  *** States Code. All rights reserved.
14  ******************************************************************
15  ******************************************************************
16  ******************************************************************/

17
18 package java.awt.image;
19 import java.awt.Rectangle JavaDoc;
20 import java.util.Dictionary JavaDoc;
21 import java.util.Vector JavaDoc;
22
23 /**
24  * RenderedImage is a common interface for objects which contain
25  * or can produce image data in the form of Rasters. The image
26  * data may be stored/produced as a single tile or a regular array
27  * of tiles.
28  */

29
30 public interface RenderedImage {
31
32     /**
33      * Returns a vector of RenderedImages that are the immediate sources of
34      * image data for this RenderedImage. This method returns null if
35      * the RenderedImage object has no information about its immediate
36      * sources. It returns an empty Vector if the RenderedImage object has
37      * no immediate sources.
38      * @return a Vector of <code>RenderedImage</code> objects.
39      */

40     Vector JavaDoc<RenderedImage JavaDoc> getSources();
41
42     /**
43      * Gets a property from the property set of this image. The set of
44      * properties and whether it is immutable is determined by the
45      * implementing class. This method returns
46      * java.awt.Image.UndefinedProperty if the specified property is
47      * not defined for this RenderedImage.
48      * @param name the name of the property
49      * @return the property indicated by the specified name.
50      * @see java.awt.Image#UndefinedProperty
51      */

52     Object JavaDoc getProperty(String JavaDoc name);
53
54     /**
55       * Returns an array of names recognized by
56       * {@link #getProperty(String) getProperty(String)}
57       * or <code>null</code>, if no property names are recognized.
58       * @return a <code>String</code> array containing all of the
59       * property names that <code>getProperty(String)</code> recognizes;
60       * or <code>null</code> if no property names are recognized.
61       */

62     String JavaDoc[] getPropertyNames();
63
64     /**
65      * Returns the ColorModel associated with this image. All Rasters
66      * returned from this image will have this as their ColorModel. This
67      * can return null.
68      * @return the <code>ColorModel</code> of this image.
69      */

70     ColorModel JavaDoc getColorModel();
71
72     /**
73      * Returns the SampleModel associated with this image. All Rasters
74      * returned from this image will have this as their SampleModel.
75      * @return the <code>SampleModel</code> of this image.
76      */

77     SampleModel JavaDoc getSampleModel();
78
79     /**
80      * Returns the width of the RenderedImage.
81      * @return the width of this <code>RenderedImage</code>.
82      */

83     int getWidth();
84
85     /**
86      * Returns the height of the RenderedImage.
87      * @return the height of this <code>RenderedImage</code>.
88      */

89     int getHeight();
90
91     /**
92      * Returns the minimum X coordinate (inclusive) of the RenderedImage.
93      * @return the X coordinate of this <code>RenderedImage</code>.
94      */

95     int getMinX();
96
97     /**
98      * Returns the minimum Y coordinate (inclusive) of the RenderedImage.
99      * @return the Y coordinate of this <code>RenderedImage</code>.
100      */

101     int getMinY();
102
103     /**
104      * Returns the number of tiles in the X direction.
105      * @return the number of tiles in the X direction.
106      */

107     int getNumXTiles();
108
109     /**
110      * Returns the number of tiles in the Y direction.
111      * @return the number of tiles in the Y direction.
112      */

113     int getNumYTiles();
114
115     /**
116      * Returns the minimum tile index in the X direction.
117      * @return the minimum tile index in the X direction.
118      */

119     int getMinTileX();
120
121     /**
122      * Returns the minimum tile index in the Y direction.
123      * @return the minimum tile index in the X direction.
124      */

125     int getMinTileY();
126
127     /**
128      * Returns the tile width in pixels. All tiles must have the same
129      * width.
130      * @return the tile width in pixels.
131      */

132     int getTileWidth();
133
134     /**
135      * Returns the tile height in pixels. All tiles must have the same
136      * height.
137      * @return the tile height in pixels.
138      */

139     int getTileHeight();
140
141     /**
142      * Returns the X offset of the tile grid relative to the origin,
143      * i.e., the X coordinate of the upper-left pixel of tile (0, 0).
144      * (Note that tile (0, 0) may not actually exist.)
145      * @return the X offset of the tile grid relative to the origin.
146      */

147     int getTileGridXOffset();
148
149     /**
150      * Returns the Y offset of the tile grid relative to the origin,
151      * i.e., the Y coordinate of the upper-left pixel of tile (0, 0).
152      * (Note that tile (0, 0) may not actually exist.)
153      * @return the Y offset of the tile grid relative to the origin.
154      */

155     int getTileGridYOffset();
156     
157     /**
158      * Returns tile (tileX, tileY). Note that tileX and tileY are indices
159      * into the tile array, not pixel locations. The Raster that is returned
160      * is live and will be updated if the image is changed.
161      * @param tileX the X index of the requested tile in the tile array
162      * @param tileY the Y index of the requested tile in the tile array
163      * @return the tile given the specified indices.
164      */

165    Raster JavaDoc getTile(int tileX, int tileY);
166
167     /**
168      * Returns the image as one large tile (for tile based
169      * images this will require fetching the whole image
170      * and copying the image data over). The Raster returned is
171      * a copy of the image data and will not be updated if the image
172      * is changed.
173      * @return the image as one large tile.
174      */

175     Raster JavaDoc getData();
176     
177     /**
178      * Computes and returns an arbitrary region of the RenderedImage.
179      * The Raster returned is a copy of the image data and will not
180      * be updated if the image is changed.
181      * @param rect the region of the RenderedImage to be returned.
182      * @return the region of the <code>RenderedImage</code>
183      * indicated by the specified <code>Rectangle</code>.
184      */

185     Raster JavaDoc getData(Rectangle JavaDoc rect);
186
187     /**
188      * Computes an arbitrary rectangular region of the RenderedImage
189      * and copies it into a caller-supplied WritableRaster. The region
190      * to be computed is determined from the bounds of the supplied
191      * WritableRaster. The supplied WritableRaster must have a
192      * SampleModel that is compatible with this image. If raster is null,
193      * an appropriate WritableRaster is created.
194      * @param raster a WritableRaster to hold the returned portion of the
195      * image, or null.
196      * @return a reference to the supplied or created WritableRaster.
197      */

198     WritableRaster JavaDoc copyData(WritableRaster JavaDoc raster);
199 }
200
Popular Tags