1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43:
44:
49: public class ImageReadParam extends IIOParam
50: {
51: protected boolean canSetSourceRenderSize;
52: protected BufferedImage destination;
53: protected int[] destinationBands;
54: protected int minProgressivePass;
55: protected int numProgressivePasses = Integer.MAX_VALUE;
56: protected Dimension sourceRenderSize;
57:
58: public ImageReadParam()
59: {
60: }
61:
62: public boolean canSetSourceRenderSize()
63: {
64: return canSetSourceRenderSize;
65: }
66:
67: public BufferedImage getDestination()
68: {
69: return destination;
70: }
71:
72: public int[] getDestinationBands()
73: {
74: return destinationBands;
75: }
76:
77: public int getSourceMaxProgressivePass()
78: {
79: if (getSourceNumProgressivePasses() == Integer.MAX_VALUE)
80: return Integer.MAX_VALUE;
81:
82: return getSourceMinProgressivePass() + getSourceNumProgressivePasses() - 1;
83: }
84:
85: public int getSourceMinProgressivePass()
86: {
87: return minProgressivePass;
88: }
89:
90: public int getSourceNumProgressivePasses()
91: {
92: return numProgressivePasses;
93: }
94:
95: public Dimension getSourceRenderSize()
96: {
97: return sourceRenderSize;
98: }
99:
100: public void setDestination(BufferedImage destination)
101: {
102: this.destination = destination;
103: }
104:
105: public void setDestinationBands(int[] destinationBands)
106: {
107: this.destinationBands = destinationBands;
108: }
109:
110: public void setSourceProgressivePasses(int minPass, int numPasses)
111: {
112: this.minProgressivePass = minPass;
113: this.numProgressivePasses = numPasses;
114: }
115:
116: public void setSourceRenderSize(Dimension size)
117: throws UnsupportedOperationException
118: {
119: if (! canSetSourceRenderSize())
120: throw new UnsupportedOperationException
121: ("setting source render size not supported");
122:
123: if (size.width <= 0 || size.height <= 0)
124: throw new IllegalArgumentException("negative dimension not allowed");
125:
126: sourceRenderSize = size;
127: }
128: }