1 /*
2 * Copyright (c) 1999, 2003, 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
277 * @see #getDestinationBands
278 * @see #getSourceBands
279 * @see ImageReader#checkReadParamBandSettings
280 */
281 public void setDestinationBands(int[] destinationBands) {
282 if (destinationBands == null) {
283 this.destinationBands = null;
284 } else {
285 int numBands = destinationBands.length;
286 for (int i = 0; i < numBands; i++) {
287 int band = destinationBands[i];
288 if (band < 0) {
289 throw new IllegalArgumentException("Band value < 0!");
290 }
291 for (int j = i + 1; j < numBands; j++) {
292 if (band == destinationBands[j]) {
293 throw new IllegalArgumentException("Duplicate band value!");
294 }
295 }
296 }
297 this.destinationBands = (int[])destinationBands.clone();
298 }
299 }
300
301 /**
302 * Returns the set of band indices where data will be placed.
303 * If no value has been set, <code>null</code> is returned to
304 * indicate that all destination bands will be used.
305 *
306 * @return the indices of the destination bands to be used,
307 * or <code>null</code>.
308 *
309 * @see #setDestinationBands
310 */
311 public int[] getDestinationBands() {
312 if (destinationBands == null) {
313 return null;
314 } else {
315 return (int[])(destinationBands.clone());
316 }
317 }
318
319 /**
320 * Returns <code>true</code> if this reader allows the source
321 * image to be rendered at an arbitrary size as part of the
322 * decoding process, by means of the
323 * <code>setSourceRenderSize</code> method. If this method
324 * returns <code>false</code>, calls to
325 * <code>setSourceRenderSize</code> will throw an
326 * <code>UnsupportedOperationException</code>.
327 *
328 * @return <code>true</code> if setting source rendering size is
329 * supported.
330 *
331 * @see #setSourceRenderSize
332 */
333 public boolean canSetSourceRenderSize() {
334 return canSetSourceRenderSize;
335 }
|
1 /*
2 * Copyright (c) 1999, 2014, 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
277 * @see #getDestinationBands
278 * @see #getSourceBands
279 * @see ImageReader#checkReadParamBandSettings
280 */
281 public void setDestinationBands(int[] destinationBands) {
282 if (destinationBands == null) {
283 this.destinationBands = null;
284 } else {
285 int numBands = destinationBands.length;
286 for (int i = 0; i < numBands; i++) {
287 int band = destinationBands[i];
288 if (band < 0) {
289 throw new IllegalArgumentException("Band value < 0!");
290 }
291 for (int j = i + 1; j < numBands; j++) {
292 if (band == destinationBands[j]) {
293 throw new IllegalArgumentException("Duplicate band value!");
294 }
295 }
296 }
297 this.destinationBands = destinationBands.clone();
298 }
299 }
300
301 /**
302 * Returns the set of band indices where data will be placed.
303 * If no value has been set, <code>null</code> is returned to
304 * indicate that all destination bands will be used.
305 *
306 * @return the indices of the destination bands to be used,
307 * or <code>null</code>.
308 *
309 * @see #setDestinationBands
310 */
311 public int[] getDestinationBands() {
312 if (destinationBands == null) {
313 return null;
314 } else {
315 return destinationBands.clone();
316 }
317 }
318
319 /**
320 * Returns <code>true</code> if this reader allows the source
321 * image to be rendered at an arbitrary size as part of the
322 * decoding process, by means of the
323 * <code>setSourceRenderSize</code> method. If this method
324 * returns <code>false</code>, calls to
325 * <code>setSourceRenderSize</code> will throw an
326 * <code>UnsupportedOperationException</code>.
327 *
328 * @return <code>true</code> if setting source rendering size is
329 * supported.
330 *
331 * @see #setSourceRenderSize
332 */
333 public boolean canSetSourceRenderSize() {
334 return canSetSourceRenderSize;
335 }
|