|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.libjpegturbo.turbojpeg.TJCompressor
public class TJCompressor
TurboJPEG compressor
| Constructor Summary | |
|---|---|
TJCompressor()
Create a TurboJPEG compressor instance. |
|
TJCompressor(byte[] buf,
int width,
int pitch,
int height,
int pixelFormat)
Create a TurboJPEG compressor instance and associate the uncompressed source image stored in buf with the newly-created instance. |
|
| Method Summary | |
|---|---|
void |
close()
Free the native structures associated with this compressor instance. |
void |
compress(java.awt.image.BufferedImage srcImage,
byte[] dstBuf,
int flags)
Compress the uncompressed source image stored in srcImage
and output a JPEG image to the given destination buffer. |
byte[] |
compress(java.awt.image.BufferedImage srcImage,
int flags)
Compress the uncompressed source image stored in srcImage
and return a buffer containing a JPEG image. |
void |
compress(byte[] dstBuf,
int flags)
Compress the uncompressed source image associated with this compressor instance and output a JPEG image to the given destination buffer. |
byte[] |
compress(int flags)
Compress the uncompressed source image associated with this compressor instance and return a buffer containing a JPEG image. |
void |
encodeYUV(java.awt.image.BufferedImage srcImage,
byte[] dstBuf,
int flags)
Encode the uncompressed source image stored in srcImage
and output a YUV planar image to the given destination buffer. |
byte[] |
encodeYUV(java.awt.image.BufferedImage srcImage,
int flags)
Encode the uncompressed source image stored in srcImage
and return a buffer containing a YUV planar image. |
void |
encodeYUV(byte[] dstBuf,
int flags)
Encode the uncompressed source image associated with this compressor instance and output a YUV planar image to the given destination buffer. |
byte[] |
encodeYUV(int flags)
Encode the uncompressed source image associated with this compressor instance and return a buffer containing a YUV planar image. |
protected void |
finalize()
|
int |
getCompressedSize()
Returns the size of the image (in bytes) generated by the most recent compress/encode operation. |
void |
setBitmapBuffer(byte[] buf,
int width,
int pitch,
int height,
int pixelFormat)
Associate an uncompressed source image with this compressor instance. |
void |
setJPEGQuality(int quality)
Set the JPEG image quality level for subsequent compress operations. |
void |
setSubsamp(int newSubsamp)
Set the level of chrominance subsampling for subsequent compress/encode operations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TJCompressor()
throws java.lang.Exception
java.lang.Exception
public TJCompressor(byte[] buf,
int width,
int pitch,
int height,
int pixelFormat)
throws java.lang.Exception
buf with the newly-created instance.
buf - see setBitmapBuffer(byte[], int, int, int, int) for descriptionwidth - see setBitmapBuffer(byte[], int, int, int, int) for descriptionpitch - see setBitmapBuffer(byte[], int, int, int, int) for descriptionheight - see setBitmapBuffer(byte[], int, int, int, int) for descriptionpixelFormat - see setBitmapBuffer(byte[], int, int, int, int) for description
java.lang.Exception| Method Detail |
|---|
public void setBitmapBuffer(byte[] buf,
int width,
int pitch,
int height,
int pixelFormat)
throws java.lang.Exception
buf - image buffer containing RGB or grayscale pixels to be
compressedwidth - width (in pixels) of the source imagepitch - bytes per line of the source image. Normally, this should be
width * TJ.pixelSize(pixelFormat) if the source image is
unpadded, but you can use this parameter to, for instance, specify that
the scanlines in the source image are padded to 4-byte boundaries, as is
the case for Windows bitmaps. You can also be clever and use this
parameter to skip lines, etc. Setting this parameter to 0 is the
equivalent of setting it to width *
TJ.pixelSize(pixelFormat).height - height (in pixels) of the source imagepixelFormat - pixel format of the source image (see
TJ)
java.lang.Exception
public void setSubsamp(int newSubsamp)
throws java.lang.Exception
newSubsamp - the new level of chrominance subsampling (see
TJ)
java.lang.Exception
public void setJPEGQuality(int quality)
throws java.lang.Exception
quality - the new JPEG image quality level (1 to 100, 1 = worst,
100 = best)
java.lang.Exception
public void compress(byte[] dstBuf,
int flags)
throws java.lang.Exception
dstBuf - buffer which will receive the JPEG image. Use
TJ.bufSize(int, int) to determine the maximum size for this buffer based on
the image width and height.flags - the bitwise OR of one or more of the flags described in
TJ
java.lang.Exception
public byte[] compress(int flags)
throws java.lang.Exception
flags - the bitwise OR of one or more of the flags described in
TJ
getCompressedSize() to obtain the size of the JPEG image.
java.lang.Exception
public void compress(java.awt.image.BufferedImage srcImage,
byte[] dstBuf,
int flags)
throws java.lang.Exception
srcImage
and output a JPEG image to the given destination buffer.
srcImage - a BufferedImage instance containing RGB or
grayscale pixels to be compresseddstBuf - buffer which will receive the JPEG image. Use
TJ.bufSize(int, int) to determine the maximum size for this buffer based on
the image width and height.flags - the bitwise OR of one or more of the flags described in
TJ
java.lang.Exception
public byte[] compress(java.awt.image.BufferedImage srcImage,
int flags)
throws java.lang.Exception
srcImage
and return a buffer containing a JPEG image.
srcImage - a BufferedImage instance containing RGB or
grayscale pixels to be compressedflags - the bitwise OR of one or more of the flags described in
TJ
getCompressedSize() to obtain the size of the JPEG image.
java.lang.Exception
public void encodeYUV(byte[] dstBuf,
int flags)
throws java.lang.Exception
TJ.SAMP_420, which produces an image compatible with the I420 (AKA
"YUV420P") format.
dstBuf - buffer which will receive the YUV planar image. Use
TJ.bufSizeYUV(int, int, int) to determine the appropriate size for this buffer
based on the image width, height, and level of chrominance subsampling.flags - the bitwise OR of one or more of the flags described in
TJ
java.lang.Exception
public byte[] encodeYUV(int flags)
throws java.lang.Exception
encodeYUV(byte[], int) for more detail.
flags - the bitwise OR of one or more of the flags described in
TJ
java.lang.Exception
public void encodeYUV(java.awt.image.BufferedImage srcImage,
byte[] dstBuf,
int flags)
throws java.lang.Exception
srcImage
and output a YUV planar image to the given destination buffer. See
encodeYUV(byte[], int) for more detail.
srcImage - a BufferedImage instance containing RGB or
grayscale pixels to be encodeddstBuf - buffer which will receive the YUV planar image. Use
TJ.bufSizeYUV(int, int, int) to determine the appropriate size for this buffer
based on the image width, height, and level of chrominance subsampling.flags - the bitwise OR of one or more of the flags described in
TJ
java.lang.Exception
public byte[] encodeYUV(java.awt.image.BufferedImage srcImage,
int flags)
throws java.lang.Exception
srcImage
and return a buffer containing a YUV planar image. See
encodeYUV(byte[], int) for more detail.
srcImage - a BufferedImage instance containing RGB or
grayscale pixels to be encodedflags - the bitwise OR of one or more of the flags described in
TJ
java.lang.Exceptionpublic int getCompressedSize()
public void close()
throws java.lang.Exception
java.lang.Exception
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||