Package com.twelvemonkeys.imageio.util
Class IIOUtil
java.lang.Object
com.twelvemonkeys.imageio.util.IIOUtil
IIOUtil
- Version:
- $Id: IIOUtil.java,v 1.0 May 8, 2008 3:04:54 PM haraldk Exp$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
createStreamAdapter
(ImageInputStream pStream) Creates anInputStream
adapter that reads from an underlyingImageInputStream
.static InputStream
createStreamAdapter
(ImageInputStream pStream, long pLength) Creates anInputStream
adapter that reads from an underlyingImageInputStream
.static OutputStream
createStreamAdapter
(ImageOutputStream pStream) Creates anOutputStream
adapter that writes to an underlyingImageOutputStream
.static <T> void
deregisterProvider
(ServiceRegistry registry, IIOServiceProvider provider, Class<T> category) THIS METHOD WILL BE MOVED/RENAMED, DO NOT USE.static BufferedImage
fakeAOI
(BufferedImage pImage, Rectangle pSourceRegion) static Image
fakeSubsampling
(Image pImage, IIOParam pParam) static String[]
Returns a sorted array of format names, that can be read by ImageIO.static String[]
Returns a sorted array of format names, that can be written by ImageIO.static Rectangle
getSourceRegion
(IIOParam pParam, int pSrcWidth, int pSrcHeight) static <T> T
lookupProviderByName
(ServiceRegistry registry, String providerClassName, Class<T> category) THIS METHOD WILL BE MOVED/RENAMED, DO NOT USE.private static String[]
normalizeNames
(String[] names) static void
subsampleRow
(byte[] srcRow, int srcPos, int srcWidth, byte[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) static void
subsampleRow
(double[] srcRow, int srcPos, int srcWidth, double[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) static void
subsampleRow
(float[] srcRow, int srcPos, int srcWidth, float[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) static void
subsampleRow
(int[] srcRow, int srcPos, int srcWidth, int[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) static void
subsampleRow
(short[] srcRow, int srcPos, int srcWidth, short[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod)
-
Constructor Details
-
IIOUtil
private IIOUtil()
-
-
Method Details
-
createStreamAdapter
Creates anInputStream
adapter that reads from an underlyingImageInputStream
. The input stream will read until the end ofpStream
.- Parameters:
pStream
- the stream to read from.- Returns:
- an
InputStream
reading frompStream
.
-
createStreamAdapter
Creates anInputStream
adapter that reads from an underlyingImageInputStream
. The input stream will read until the end ofpStream
, or at mostpLength
bytes has been read.- Parameters:
pStream
- the stream to read from.pLength
- the maximum number of bytes that can be read frompStream
.- Returns:
- an
InputStream
reading frompStream
.
-
createStreamAdapter
Creates anOutputStream
adapter that writes to an underlyingImageOutputStream
.Note: The adapter is buffered, and MUST be properly flushed/closed after use, otherwise data may be lost.
- Parameters:
pStream
- the stream to write to.- Returns:
- an
OutputSteam
writing topStream
.
-
fakeSubsampling
-
getSourceRegion
-
fakeAOI
-
deregisterProvider
public static <T> void deregisterProvider(ServiceRegistry registry, IIOServiceProvider provider, Class<T> category) THIS METHOD WILL BE MOVED/RENAMED, DO NOT USE.- Parameters:
registry
- the registry to unregister from.provider
- the provider to unregister.category
- the category to unregister from.
-
lookupProviderByName
public static <T> T lookupProviderByName(ServiceRegistry registry, String providerClassName, Class<T> category) THIS METHOD WILL BE MOVED/RENAMED, DO NOT USE.- Parameters:
registry
- the registry to lookup from.providerClassName
- name of the provider class.category
- provider category- Returns:
- the provider instance, or
null
if not found
-
getNormalizedReaderFormatNames
Returns a sorted array of format names, that can be read by ImageIO. The names are all upper-case, and contains no duplicates.- Returns:
- a normalized array of
String
s. - See Also:
-
getNormalizedWriterFormatNames
Returns a sorted array of format names, that can be written by ImageIO. The names are all upper-case, and contains no duplicates.- Returns:
- a normalized array of
String
s. - See Also:
-
normalizeNames
-
subsampleRow
public static void subsampleRow(byte[] srcRow, int srcPos, int srcWidth, byte[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) -
subsampleRow
public static void subsampleRow(short[] srcRow, int srcPos, int srcWidth, short[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) -
subsampleRow
public static void subsampleRow(int[] srcRow, int srcPos, int srcWidth, int[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) -
subsampleRow
public static void subsampleRow(float[] srcRow, int srcPos, int srcWidth, float[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod) -
subsampleRow
public static void subsampleRow(double[] srcRow, int srcPos, int srcWidth, double[] destRow, int destPos, int samplesPerPixel, int bitsPerSample, int samplePeriod)
-