01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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 Sergey I. Salishev
19: * @version $Revision: 1.2 $
20: */package javax.imageio;
21:
22: import java.awt.Dimension;
23: import java.awt.image.BufferedImage;
24:
25: /**
26: * @author Sergey I. Salishev
27: * @version $Revision: 1.2 $
28: */
29: public class ImageReadParam extends IIOParam {
30:
31: protected boolean canSetSourceRenderSize;
32: protected BufferedImage destination;
33: protected int[] destinationBands;
34: protected int minProgressivePass;
35: protected int numProgressivePasses;
36: protected Dimension sourceRenderSize;
37:
38: public boolean canSetSourceRenderSize() {
39: return canSetSourceRenderSize;
40: }
41:
42: public BufferedImage getDestination() {
43: return destination;
44: }
45:
46: public int[] getDestinationBands() {
47: return destinationBands;
48: }
49:
50: public int getSourceMaxProgressivePass() {
51: if (getSourceNumProgressivePasses() == Integer.MAX_VALUE) {
52: return Integer.MAX_VALUE;
53: }
54: return getSourceMinProgressivePass()
55: + getSourceNumProgressivePasses() - 1;
56: }
57:
58: public int getSourceMinProgressivePass() {
59: return minProgressivePass;
60: }
61:
62: public int getSourceNumProgressivePasses() {
63: return numProgressivePasses;
64: }
65:
66: public Dimension getSourceRenderSize() {
67: return sourceRenderSize;
68: }
69:
70: public void setDestination(BufferedImage destination) {
71: this .destination = destination;
72: }
73:
74: public void setDestinationBands(int[] destinationBands) {
75: this .destinationBands = destinationBands;
76: }
77:
78: @Override
79: public void setDestinationType(ImageTypeSpecifier destinationType) {
80: this .destinationType = destinationType;
81: }
82:
83: public void setSourceProgressivePasses(int minPass, int numPasses) {
84: minProgressivePass = minPass;
85: numProgressivePasses = numPasses;
86: }
87:
88: public void setSourceRenderSize(Dimension size)
89: throws UnsupportedOperationException {
90: if (!canSetSourceRenderSize) {
91: throw new UnsupportedOperationException(
92: "can't set source renderer size");
93: }
94: sourceRenderSize = size;
95: }
96: }
|