1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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, 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, 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}, {@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 }
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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, 0). This is always zero.
1367 * @return the x offset of the tile grid.
1368 */
1369 public int getTileGridXOffset() {
1370 return raster.getMinX();
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, 0). This is always zero.
1377 * @return the y offset of the tile grid.
1378 */
1379 public int getTileGridYOffset() {
1380 return raster.getMinY();
1381 }
1382
1383 /**
1384 * Returns tile ({@code tileX}, {@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 }
|