public class ImageTools extends Object
Modifier and Type | Field and Description |
---|---|
static int |
PROGRESS_INTERVAL
The percentage increment between progress report updates.
|
Constructor and Description |
---|
ImageTools() |
Modifier and Type | Method and Description |
---|---|
static int[] |
computeDimensions(int sourceWidth,
int sourceHeight,
int maxWidth,
int maxHeight,
boolean preserveAspectRatio) |
static int[] |
computeUpdatedPixels(Rectangle sourceRegion,
Point2D destinationOffset,
int dstMinX,
int dstMinY,
int dstMaxX,
int dstMaxY,
int sourceXSubsampling,
int sourceYSubsampling,
int passXStart,
int passYStart,
int passWidth,
int passHeight,
int passPeriodX,
int passPeriodY)
A utility method that computes the exact set of destination
pixels that will be written during a particular decoding pass.
|
static byte[] |
convert(int width,
int height,
ImageStorage.ImageType inputType,
byte[] input,
int inputOffset,
int inRowStride,
byte[] output,
int outputOffset,
int outRowStride,
byte[][] palette,
int transparentIndex,
boolean skipTransparent) |
static ImageFrame |
convertImageFrame(ImageFrame frame) |
static byte[] |
createImageArray(ImageStorage.ImageType type,
int width,
int height) |
static InputStream |
createInputStream(String input) |
static ImageStorage.ImageType |
getConvertedType(ImageStorage.ImageType type) |
static String |
getScaledImageName(String path) |
static int |
readFully(InputStream stream,
byte[] b)
See the general contract of the
readFully
method of DataInput . |
static int |
readFully(InputStream stream,
byte[] b,
int off,
int len)
See the general contract of the
readFully
method of DataInput . |
static ByteBuffer |
scaleImage(ByteBuffer src,
int sourceWidth,
int sourceHeight,
int numBands,
int destWidth,
int destHeight,
boolean isSmooth) |
static ImageFrame |
scaleImageFrame(ImageFrame src,
int destWidth,
int destHeight,
boolean isSmooth) |
static void |
skipFully(InputStream stream,
long n)
Skips over
n bytes of data from the input stream. |
public static final int PROGRESS_INTERVAL
public static int readFully(InputStream stream, byte[] b, int off, int len) throws IOException
readFully
method of DataInput
.
Bytes for this operation are read from the specified input stream.
stream
- the stream from which to read the data.b
- the buffer into which the data is read.off
- the start offset of the data.len
- the number of bytes to read.EOFException
- if this input stream reaches the end before
reading all the bytes.IOException
- if another I/O error occurs.public static int readFully(InputStream stream, byte[] b) throws IOException
readFully
method of DataInput
.
Bytes for this operation are read from the contained input stream.
stream
- the stream from which to read the data.b
- the buffer into which the data is read.EOFException
- if this input stream reaches the end before
reading all the bytes.IOException
- if another I/O error occurs.public static void skipFully(InputStream stream, long n) throws IOException
n
bytes of data from the input stream.stream
- the stream to skip.n
- the number of bytes to be skipped.EOFException
- if this input stream reaches the end before
skipping all the bytes.IOException
- if another I/O error occurs.public static ImageStorage.ImageType getConvertedType(ImageStorage.ImageType type)
public static byte[] createImageArray(ImageStorage.ImageType type, int width, int height)
public static ImageFrame convertImageFrame(ImageFrame frame)
public static byte[] convert(int width, int height, ImageStorage.ImageType inputType, byte[] input, int inputOffset, int inRowStride, byte[] output, int outputOffset, int outRowStride, byte[][] palette, int transparentIndex, boolean skipTransparent)
public static InputStream createInputStream(String input) throws IOException
IOException
public static int[] computeUpdatedPixels(Rectangle sourceRegion, Point2D destinationOffset, int dstMinX, int dstMinY, int dstMaxX, int dstMaxY, int sourceXSubsampling, int sourceYSubsampling, int passXStart, int passYStart, int passWidth, int passHeight, int passPeriodX, int passPeriodY)
ImageReadParam
with
the offsets and periods of a progressive or interlaced decoding
pass.sourceRegion
- a Rectangle
containing the
source region being read, offset by the source subsampling
offsets, and clipped against the source bounds, as returned by
the getSourceRegion
method.destinationOffset
- a Point
containing the
coordinates of the upper-left pixel to be written in the
destination.dstMinX
- the smallest X coordinate (inclusive) of the
destination Raster
.dstMinY
- the smallest Y coordinate (inclusive) of the
destination Raster
.dstMaxX
- the largest X coordinate (inclusive) of the destination
Raster
.dstMaxY
- the largest Y coordinate (inclusive) of the destination
Raster
.sourceXSubsampling
- the X subsampling factor.sourceYSubsampling
- the Y subsampling factor.passXStart
- the smallest source X coordinate (inclusive)
of the current progressive pass.passYStart
- the smallest source Y coordinate (inclusive)
of the current progressive pass.passWidth
- the width in pixels of the current progressive
pass.passHeight
- the height in pixels of the current progressive
pass.passPeriodX
- the X period (horizontal spacing between
pixels) of the current progressive pass.passPeriodY
- the Y period (vertical spacing between
pixels) of the current progressive pass.int
s containing the
destination min X, min Y, width, height, X period and Y period
of the region that will be updated.public static int[] computeDimensions(int sourceWidth, int sourceHeight, int maxWidth, int maxHeight, boolean preserveAspectRatio)
public static ImageFrame scaleImageFrame(ImageFrame src, int destWidth, int destHeight, boolean isSmooth)
public static ByteBuffer scaleImage(ByteBuffer src, int sourceWidth, int sourceHeight, int numBands, int destWidth, int destHeight, boolean isSmooth)
Copyright © 2020. All rights reserved.