< prev index next >

src/java.desktop/share/classes/java/awt/image/BufferedImage.java

Print this page




1350      */
1351     public int getTileWidth() {
1352        return raster.getWidth();
1353     }
1354 
1355     /**
1356      * Returns the tile height in pixels.
1357      * @return the tile height in pixels.
1358      */
1359     public int getTileHeight() {
1360        return raster.getHeight();
1361     }
1362 
1363     /**
1364      * Returns the x offset of the tile grid relative to the origin,
1365      * For example, the x coordinate of the location of tile
1366      * (0,&nbsp;0).  This is always zero.
1367      * @return the x offset of the tile grid.
1368      */
1369     public int getTileGridXOffset() {
1370         return raster.getSampleModelTranslateX();





















1371     }
1372 
1373     /**
1374      * Returns the y offset of the tile grid relative to the origin,
1375      * For example, the y coordinate of the location of tile
1376      * (0,&nbsp;0).  This is always zero.
1377      * @return the y offset of the tile grid.
1378      */
1379     public int getTileGridYOffset() {
1380         return raster.getSampleModelTranslateY();
1381     }
1382 
1383     /**
1384      * Returns tile ({@code tileX},&nbsp;{@code tileY}).  Note
1385      * that {@code tileX} and {@code tileY} are indices
1386      * into the tile array, not pixel locations.  The {@code Raster}
1387      * that is returned is live, which means that it is updated if the
1388      * image is changed.
1389      * @param tileX the x index of the requested tile in the tile array
1390      * @param tileY the y index of the requested tile in the tile array
1391      * @return a {@code Raster} that is the tile defined by the
1392      *          arguments {@code tileX} and {@code tileY}.
1393      * @exception ArrayIndexOutOfBoundsException if both
1394      *          {@code tileX} and {@code tileY} are not
1395      *          equal to 0
1396      */
1397     public Raster getTile(int tileX, int tileY) {
1398         if (tileX == 0 && tileY == 0) {
1399             return raster;
1400         }




1350      */
1351     public int getTileWidth() {
1352        return raster.getWidth();
1353     }
1354 
1355     /**
1356      * Returns the tile height in pixels.
1357      * @return the tile height in pixels.
1358      */
1359     public int getTileHeight() {
1360        return raster.getHeight();
1361     }
1362 
1363     /**
1364      * Returns the x offset of the tile grid relative to the origin,
1365      * For example, the x coordinate of the location of tile
1366      * (0,&nbsp;0).  This is always zero.
1367      * @return the x offset of the tile grid.
1368      */
1369     public int getTileGridXOffset() {
1370         /*
1371          * Given (source: javax.media.jai.PlanarImage.tileXToX(int)):
1372          *
1373          *     x = (tileX * tileWidth) + tileGridXOffset
1374          *
1375          * We get:
1376          *
1377          *     tileGridXOffset = x - (tileX * tileWidth)
1378          *
1379          * Substituting  x = minX  and  tileX = minTileX:
1380          *
1381          *     tileGridXOffset = minX - (minTileX * tileWidth)
1382          *
1383          * Substituting default BufferedImage method implementations:
1384          *
1385          *     tileGridXOffset = raster.getMinX() - (0 * raster.getWidth())
1386          *
1387          * Result should always be zero, but we nevertheless delegate to
1388          * raster.getMinX() for consistency with default implementation
1389          * of related methods in BufferedImage.
1390          */
1391         return raster.getMinX();
1392     }
1393 
1394     /**
1395      * Returns the y offset of the tile grid relative to the origin,
1396      * For example, the y coordinate of the location of tile
1397      * (0,&nbsp;0).  This is always zero.
1398      * @return the y offset of the tile grid.
1399      */
1400     public int getTileGridYOffset() {
1401         return raster.getMinY();
1402     }
1403 
1404     /**
1405      * Returns tile ({@code tileX},&nbsp;{@code tileY}).  Note
1406      * that {@code tileX} and {@code tileY} are indices
1407      * into the tile array, not pixel locations.  The {@code Raster}
1408      * that is returned is live, which means that it is updated if the
1409      * image is changed.
1410      * @param tileX the x index of the requested tile in the tile array
1411      * @param tileY the y index of the requested tile in the tile array
1412      * @return a {@code Raster} that is the tile defined by the
1413      *          arguments {@code tileX} and {@code tileY}.
1414      * @exception ArrayIndexOutOfBoundsException if both
1415      *          {@code tileX} and {@code tileY} are not
1416      *          equal to 0
1417      */
1418     public Raster getTile(int tileX, int tileY) {
1419         if (tileX == 0 && tileY == 0) {
1420             return raster;
1421         }


< prev index next >