38 |
|
|
39 |
package javax.imageio; |
package javax.imageio; |
40 |
|
|
41 |
|
import java.awt.image.ColorModel; |
42 |
|
import java.awt.image.RenderedImage; |
43 |
|
import java.awt.image.SampleModel; |
44 |
|
|
45 |
public class ImageTypeSpecifier |
public class ImageTypeSpecifier |
46 |
{ |
{ |
47 |
// FIXME: Incomplete. This class is merely present in order to allow |
protected ColorModel colorModel; |
48 |
// compilation of the javax.imageio package. |
protected SampleModel sampleModel; |
49 |
|
|
50 |
|
public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel) |
51 |
|
{ |
52 |
|
if (colorModel == null) |
53 |
|
throw new IllegalArgumentException("colorModel may not be null"); |
54 |
|
|
55 |
|
if (sampleModel == null) |
56 |
|
throw new IllegalArgumentException("sampleModel may not be null"); |
57 |
|
|
58 |
|
if (!colorModel.isCompatibleSampleModel(sampleModel)) |
59 |
|
throw new IllegalArgumentException |
60 |
|
("sample Model not compatible with colorModel"); |
61 |
|
|
62 |
|
this.colorModel = colorModel; |
63 |
|
this.sampleModel = sampleModel; |
64 |
|
} |
65 |
|
|
66 |
|
public ImageTypeSpecifier(RenderedImage image) |
67 |
|
{ |
68 |
|
if (image == null) |
69 |
|
throw new IllegalArgumentException("image may not be null"); |
70 |
|
|
71 |
|
this.colorModel = image.getColorModel(); |
72 |
|
this.sampleModel = image.getSampleModel(); |
73 |
|
} |
74 |
|
|
75 |
|
public ColorModel getColorModel() |
76 |
|
{ |
77 |
|
return colorModel; |
78 |
|
} |
79 |
|
|
80 |
|
public int getNumBands() |
81 |
|
{ |
82 |
|
return sampleModel.getNumBands(); |
83 |
|
} |
84 |
|
|
85 |
|
public int getNumComponents() |
86 |
|
{ |
87 |
|
return colorModel.getNumComponents(); |
88 |
|
} |
89 |
|
|
90 |
|
public SampleModel getSampleModel() |
91 |
|
{ |
92 |
|
return sampleModel; |
93 |
|
} |
94 |
} |
} |