home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / image / RenderedImage.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  5.8 KB  |  180 lines

  1. /*
  2.  * @(#)RenderedImage.java    1.11 98/03/18
  3.  *
  4.  * Copyright 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /* ****************************************************************
  16.  ******************************************************************
  17.  ******************************************************************
  18.  *** COPYRIGHT (c) Eastman Kodak Company, 1997
  19.  *** As  an unpublished  work pursuant to Title 17 of the United
  20.  *** States Code.  All rights reserved.
  21.  ******************************************************************
  22.  ******************************************************************
  23.  ******************************************************************/
  24.  
  25. package java.awt.image;
  26. import java.awt.Rectangle;
  27. import java.util.Dictionary;
  28. import java.util.Vector;
  29.  
  30. /** 
  31.  * A RenderedImage is a common interface for objects which contain
  32.  * or can produce image data in the form of Rasters.  
  33.  */
  34.  
  35. public interface RenderedImage {
  36.  
  37.     /** 
  38.      * Return a vector of RenderedImages that are the sources of 
  39.      * image data for this RenderedImage.  This method may return null.
  40.      */
  41.     Vector getSources();
  42.  
  43.     /** 
  44.      * Get a property from the property set of this image.  The set of
  45.      * properties is determined at construction time and is immutable.
  46.      */
  47.     Object getProperty(String name);
  48.  
  49.     /** 
  50.      * Return a list of names recognized by getProperty(String). 
  51.      */
  52.     String[] getPropertyNames();
  53.  
  54.     /**
  55.      * Return the ColorModel associated with this image.  All Rasters returned
  56.      * from this image will have this as their ColorModel.
  57.      */
  58.     ColorModel getColorModel();
  59.  
  60.     /**
  61.      * Return the SampleModel associated with this image.  All Rasters returned
  62.      * from this image will have this as their SampleModel.
  63.      */
  64.     SampleModel getSampleModel();
  65.  
  66.     /**
  67.      * Return the width of the RenderedImage.  Equivalent to
  68.      * getMaxXCoord() - getMinXCoord() + 1.
  69.      */
  70.     int getWidth();
  71.  
  72.     /**
  73.      * Return the height of the RenderedImage.  Equivalent to
  74.      * getMaxYCoord() - getMinYCoord() + 1.
  75.      */
  76.     int getHeight();
  77.  
  78.     /** 
  79.      * Return the minimum X coordinate (inclusive) of the rendered image.
  80.      * For an image with infinite extent, it could be Integer.MIN_VALUE.
  81.      */
  82.     int getMinXCoord();
  83.  
  84.     /** 
  85.      * Return the maximum X coordinate (inclusive) of the rendered image.
  86.      * For an image with infinite extent, it could be Integer.MAX_VALUE.
  87.      */
  88.     int getMaxXCoord();
  89.  
  90.     /** 
  91.      * Return the minimum Y coordinate (inclusive) of the rendered image.
  92.      * For an image with infinite extent, it could be Integer.MIN_VALUE.
  93.      */
  94.     int getMinYCoord();
  95.  
  96.     /** 
  97.      * Return the minimum Y coordinate (inclusive) of the rendered image.
  98.      * For an image with infinite extent, it could be Integer.MAX_VALUE.
  99.      */
  100.     int getMaxYCoord();
  101.  
  102.     /**
  103.      * Return the number of tiles across the image.  Equivalent to
  104.      * getMaxTileX() - getMinTileX() + 1.
  105.      */
  106.     int tilesAcross();
  107.  
  108.     /**
  109.      * Return the number of tiles down the image.  Equivalent to
  110.      * getMaxTileY() - getMinTileY() + 1.
  111.      */
  112.     int tilesDown();
  113.  
  114.     /** Return the index of the minimum tile in the X direction. */
  115.     int getMinTileX();
  116.  
  117.     /** Return the index of the maximum tile in the X direction. */
  118.     int getMaxTileX();
  119.  
  120.     /** Return the index of the minimum tile in the Y direction. */
  121.     int getMinTileY();
  122.  
  123.     /** Return the index of the maximum tile in the Y direction. */
  124.     int getMaxTileY();
  125.  
  126.     /** Return the tile width in pixels.  All tiles must have the same width. */
  127.     int getTileWidth();
  128.  
  129.     /** Return the tile height in pixels.  All tiles must have the same height. */
  130.     int getTileHeight();
  131.  
  132.     /**
  133.      * Return the X offset of the tile grid relative to the origin,
  134.      * i.e., the X coordinate of the upper-left pixel of tile (0, 0).
  135.      */
  136.     int getTileGridXOffset();
  137.     
  138.     /**
  139.      * Return the Y offset of the tile grid relative to the origin,
  140.      * i.e., the Y coordinate of the upper-left pixel of tile (0, 0).
  141.      */
  142.     int getTileGridYOffset();
  143.     
  144.     /** 
  145.      * Return tile (X, Y).  Note that X and Y are indices into the
  146.      * tile array, not pixel locations.  The Raster that is returned
  147.      * is live and will be updated if the image is changed.
  148.      * @param x the X index of the requested tile in the tile array.
  149.      * @param y the Y index of the requested tile in the tile array.
  150.      */
  151.     Raster getTile(int x, int y);
  152.  
  153.     /** 
  154.      * Return the image as one large tile (for tile based 
  155.      * images this will require fetching the whole image 
  156.      * and copying the image data over).  The Raster returned is 
  157.      * semantically a copy.
  158.      */
  159.     Raster getData();
  160.     
  161.     /** 
  162.      * Compute and return an arbitrary region of the RenderedImage. 
  163.      * Note that in general this may involve copying image data.
  164.      * The Raster returned is semantically a copy.
  165.      * @param rect the region of the RenderedImage to be returned.
  166.      */
  167.     Raster getRect(Rectangle rect);
  168.  
  169.     /** 
  170.      * Compute an arbitrary rectangular region of the RenderedImage
  171.      * and copy it into a caller-supplied WritableRaster.  The region
  172.      * to be computed is determined from the bounds of the supplied
  173.      * WritableRaster.  The supplied WritableRaster must have a ColorModel
  174.      * and SampleModel that are compatible with those of this image.
  175.      * @param raster a WritableRaster to hold the returned portion of the image.
  176.      * @return a reference to the supplied WritableRaster.
  177.      */
  178.     WritableRaster getRect(WritableRaster raster);
  179. }
  180.