Home | History | Annotate | Download | only in image
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 /**
     18  * @author Igor V. Stolyarov
     19  * @version $Revision$
     20  */
     21 
     22 package java.awt.image;
     23 
     24 import java.awt.Rectangle;
     25 import java.util.Vector;
     26 
     27 /**
     28  * The RenderedImage interface should be implemented by all objects which
     29  * contains image data. The image data is represented as a single tile or an
     30  * array of tiles.
     31  *
     32  * @since Android 1.0
     33  */
     34 public interface RenderedImage {
     35 
     36     /**
     37      * Gets the property with the specified name from the property set of this
     38      * RenderedImage.
     39      *
     40      * @param name
     41      *            the property's name.
     42      * @return the property value corresponded to this property's name.
     43      */
     44     public Object getProperty(String name);
     45 
     46     /**
     47      * Copies the region of this RenderedImage to the specified WritableRaster.
     48      * The bounds of the region are the bounds of the WritableRaster.
     49      *
     50      * @param raster
     51      *            the WritableRaster.
     52      * @return the created WritableRaster.
     53      */
     54     public WritableRaster copyData(WritableRaster raster);
     55 
     56     /**
     57      * Gets the image data of the image's region as one tile.
     58      *
     59      * @param rect
     60      *            the rectangular region of RenderedImage.
     61      * @return the image data of the image's region as one tile.
     62      */
     63     public Raster getData(Rectangle rect);
     64 
     65     /**
     66      * Gets all RenderedImage objects which are the source of this RenderedImage
     67      * object.
     68      *
     69      * @return a Vector of RenderedImage objects which are the source of this
     70      *         RenderedImage object or null, if there is no information about
     71      *         them.
     72      */
     73     public Vector<RenderedImage> getSources();
     74 
     75     /**
     76      * Gets the set of all property names for this RenderedImage.
     77      *
     78      * @return the array of all property names for this RenderedImage.
     79      */
     80     public String[] getPropertyNames();
     81 
     82     /**
     83      * Gets the SampleModel of this RenderedImage.
     84      *
     85      * @return the SampleModel of this RenderedImage.
     86      */
     87     public SampleModel getSampleModel();
     88 
     89     /**
     90      * Gets the tile corresponded to the specified indices in the tile array.
     91      *
     92      * @param tileX
     93      *            the X index of the tile.
     94      * @param tileY
     95      *            the Y index of the tile.
     96      * @return the tile corresponded to the specified indices in the tile array.
     97      */
     98     public Raster getTile(int tileX, int tileY);
     99 
    100     /**
    101      * Gets the image data of this image as one tile.
    102      *
    103      * @return the image data of this image as one tile.
    104      */
    105     public Raster getData();
    106 
    107     /**
    108      * Gets the ColorModel of this RenderedImage.
    109      *
    110      * @return the ColorModel of this RenderedImage.
    111      */
    112     public ColorModel getColorModel();
    113 
    114     /**
    115      * Gets the width of the RenderedImage.
    116      *
    117      * @return the width of the RenderedImage.
    118      */
    119     public int getWidth();
    120 
    121     /**
    122      * Gets the tile width.
    123      *
    124      * @return the tile width in pixels.
    125      */
    126     public int getTileWidth();
    127 
    128     /**
    129      * Gets the tile height.
    130      *
    131      * @return the tile height in pixels.
    132      */
    133     public int getTileHeight();
    134 
    135     /**
    136      * Gets the Y offset of the tile grid.
    137      *
    138      * @return the Y offset of the tile grid.
    139      */
    140     public int getTileGridYOffset();
    141 
    142     /**
    143      * Gets the X offset of the tile grid.
    144      *
    145      * @return the X offset of the tile grid.
    146      */
    147     public int getTileGridXOffset();
    148 
    149     /**
    150      * Gets the number of tiles along Y direction.
    151      *
    152      * @return the number of tiles along Y direction.
    153      */
    154     public int getNumYTiles();
    155 
    156     /**
    157      * Gets the number of tiles along X direction.
    158      *
    159      * @return the number of tiles along X direction.
    160      */
    161     public int getNumXTiles();
    162 
    163     /**
    164      * Gets the minimum Y coordinate of this RenderedImage.
    165      *
    166      * @return the minimum Y coordinate of this RenderedImage.
    167      */
    168     public int getMinY();
    169 
    170     /**
    171      * Gets the minimum X coordinate of this RenderedImage.
    172      *
    173      * @return the minimum X coordinate of this RenderedImage.
    174      */
    175     public int getMinX();
    176 
    177     /**
    178      * Gets the minimum tile's index along the Y direction.
    179      *
    180      * @return the minimum tile's index along the Y direction.
    181      */
    182     public int getMinTileY();
    183 
    184     /**
    185      * Gets the minimum tile's index along the X direction.
    186      *
    187      * @return the minimum tile's index along the X direction.
    188      */
    189     public int getMinTileX();
    190 
    191     /**
    192      * Gets the height of the RenderedImage.
    193      *
    194      * @return the height of the RenderedImage.
    195      */
    196     public int getHeight();
    197 
    198 }
    199