Contructors of this class may only accept SampleModel
system instances, those created internally and returned using
accessor method calls such as, BufferedImage.getSampleModel().
Instances created directly through invocation of the SampleModel
constructor will result in an IllegalArgumentException.
- See Also:
SampleModel
Field Summary |
protected java.awt.image.ColorModel |
colorModel
The ColorModel to be used as a prototype. |
protected SampleModel |
sampleModel
A SampleModel to be used as a prototype. |
Method Summary |
static ImageTypeSpecifier |
createFromRenderedImage(RenderedImage image)
Returns an ImageTypeSpecifier that encodes the
layout of a RenderedImage (which may be a
BufferedImage ). |
boolean |
equals(java.lang.Object o)
Returns true if the given Object is
an ImageTypeSpecifier and has a
SampleModel and ColorModel that are
equal to those of this object. |
int |
getBufferedImageType()
Returns an int containing one of the enumerated constant values
describing image formats from BufferedImage . |
java.awt.image.ColorModel |
getColorModel()
Returns the ColorModel specified by this object. |
int |
getNumComponents()
Return the number of color components
specified by this object. |
SampleModel |
getSampleModel()
Returns a SampleModel based on the settings
encapsulated within this object. |
SampleModel |
getSampleModel(int width,
int height)
Returns a SampleModel based on the settings
encapsulated within this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
colorModel
protected java.awt.image.ColorModel colorModel
- The
ColorModel
to be used as a prototype.
sampleModel
protected SampleModel sampleModel
- A
SampleModel
to be used as a prototype.
ImageTypeSpecifier
public ImageTypeSpecifier(java.awt.image.ColorModel colorModel,
SampleModel sampleModel)
- Constructs an
ImageTypeSpecifier
directly
from a ColorModel
and a SampleModel
.
It is the caller's responsibility to supply compatible
parameters.
- Parameters:
colorModel
- a ColorModel
.sampleModel
- a SampleModel
.
- Throws:
java.lang.IllegalArgumentException
- if either parameter is
null
.
java.lang.IllegalArgumentException
- if sampleModel
is not compatible with colorModel
.
java.lang.IllegalArgumentException
- for
instances of SampleModel
created directly through
invocation of the SampleModel
constructor.
ImageTypeSpecifier
public ImageTypeSpecifier(RenderedImage image)
- Constructs an
ImageTypeSpecifier
from a
RenderedImage
. If a BufferedImage
is
being used, one of the factory methods
createFromRenderedImage
or
createFromBufferedImageType
should be used instead in
order to get a more accurate result.
- Parameters:
image
- a RenderedImage
.
- Throws:
java.lang.IllegalArgumentException
- if the argument is
null
or not a BufferedImage
.
See restriction on RenderedImage
.
java.lang.IllegalArgumentException
- for
instances of SampleModel
created directly through
invocation of the SampleModel
createFromRenderedImage
public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image)
- Returns an
ImageTypeSpecifier
that encodes the
layout of a RenderedImage
(which may be a
BufferedImage
).
- Parameters:
image
- a RenderedImage
.
- Returns:
- an
ImageTypeSpecifier
with the desired
characteristics.
- Throws:
java.lang.IllegalArgumentException
- if image
is
null
or not a BufferedImage
.
See restriction on RenderedImage
.
getBufferedImageType
public int getBufferedImageType()
- Returns an int containing one of the enumerated constant values
describing image formats from
BufferedImage
.
- Returns:
- an
int
representing a
BufferedImage
type. - See Also:
BufferedImage
,
BufferedImage.TYPE_CUSTOM
,
BufferedImage.TYPE_INT_RGB
,
BufferedImage.TYPE_INT_ARGB
,
BufferedImage.TYPE_INT_ARGB_PRE
,
BufferedImage.TYPE_INT_BGR
,
java.awt.image.BufferedImage#TYPE_3BYTE_BGR
,
java.awt.image.BufferedImage#TYPE_4BYTE_ABGR
,
java.awt.image.BufferedImage#TYPE_4BYTE_ABGR_PRE
,
BufferedImage.TYPE_USHORT_565_RGB
,
BufferedImage.TYPE_USHORT_555_RGB
,
java.awt.image.BufferedImage#TYPE_BYTE_GRAY
,
java.awt.image.BufferedImage#TYPE_USHORT_GRAY
,
BufferedImage.TYPE_BYTE_BINARY
,
BufferedImage.TYPE_BYTE_INDEXED
getNumComponents
public int getNumComponents()
- Return the number of color components
specified by this object. This is the same value as returned by
ColorModel.getNumComponents
- Returns:
- the number of components in the image.
getSampleModel
public SampleModel getSampleModel()
- Returns a
SampleModel
based on the settings
encapsulated within this object. The width and height of the
SampleModel
will be set to arbitrary values.
- Returns:
- a
SampleModel
with arbitrary dimensions.
getSampleModel
public SampleModel getSampleModel(int width,
int height)
- Returns a
SampleModel
based on the settings
encapsulated within this object. The width and height of the
SampleModel
will be set to the supplied values.
- Parameters:
width
- the desired width of the returned SampleModel
.height
- the desired height of the returned
SampleModel
.
- Returns:
- a
SampleModel
with the given dimensions.
- Throws:
java.lang.IllegalArgumentException
- if either width
or
height
are negative or zero.
java.lang.IllegalArgumentException
- if the product of
width
and height
is greater than
Integer.MAX_VALUE
getColorModel
public java.awt.image.ColorModel getColorModel()
- Returns the
ColorModel
specified by this object.
- Returns:
- a
ColorModel
.
equals
public boolean equals(java.lang.Object o)
- Returns
true
if the given Object
is
an ImageTypeSpecifier
and has a
SampleModel
and ColorModel
that are
equal to those of this object.
- Parameters:
o
- the Object
to be compared for equality.
- Returns:
true
if the given object is an equivalent
ImageTypeSpecifier
.
Java and Java 2D are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Copyright 1993 - 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All Rights Reserved.
Use of this specification is subject to this license.