Implement lossless cropping interface in Java

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@501 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-03-04 10:13:59 +00:00
parent 46531c3265
commit e85730157e
6 changed files with 337 additions and 10 deletions

View File

@@ -37,15 +37,16 @@ public class TJDecompressor {
}
public TJDecompressor(byte[] buf) throws Exception {
init();
setJPEGBuffer(buf, buf.length);
}
public TJDecompressor(byte[] buf, int bufSize) throws Exception {
init();
setJPEGBuffer(buf, bufSize);
}
public void setJPEGBuffer(byte[] buf, int bufSize) throws Exception {
if(handle == 0) init();
if(buf == null || bufSize < 1)
throw new Exception("Invalid argument in setJPEGBuffer()");
jpegBuf = buf;
@@ -250,10 +251,10 @@ public class TJDecompressor {
System.loadLibrary("turbojpeg");
}
private long handle = 0;
private byte[] jpegBuf = null;
private int jpegBufSize = 0;
private int jpegWidth = 0;
private int jpegHeight = 0;
private int jpegSubsamp = -1;
protected long handle = 0;
protected byte[] jpegBuf = null;
protected int jpegBufSize = 0;
protected int jpegWidth = 0;
protected int jpegHeight = 0;
protected int jpegSubsamp = -1;
};