diff --git a/tess-two/jni/com_googlecode_leptonica_android/readfile.cpp b/tess-two/jni/com_googlecode_leptonica_android/readfile.cpp index f89202ea4..8fc0ab77d 100644 --- a/tess-two/jni/com_googlecode_leptonica_android/readfile.cpp +++ b/tess-two/jni/com_googlecode_leptonica_android/readfile.cpp @@ -93,30 +93,6 @@ jboolean Java_com_googlecode_leptonica_android_ReadFile_nativeReplaceBytes8(JNIE return JNI_TRUE; } -jlong Java_com_googlecode_leptonica_android_ReadFile_nativeReadFiles(JNIEnv *env, jclass clazz, - jstring dirName, jstring prefix) { - PIXA *pixad = NULL; - - const char *c_dirName = env->GetStringUTFChars(dirName, NULL); - if (c_dirName == NULL) { - LOGE("could not extract dirName string!"); - return (jlong) NULL; - } - - const char *c_prefix = env->GetStringUTFChars(prefix, NULL); - if (c_prefix == NULL) { - LOGE("could not extract prefix string!"); - return (jlong) NULL; - } - - pixad = pixaReadFiles(c_dirName, c_prefix); - - env->ReleaseStringUTFChars(dirName, c_dirName); - env->ReleaseStringUTFChars(prefix, c_prefix); - - return (jlong) pixad; -} - jlong Java_com_googlecode_leptonica_android_ReadFile_nativeReadFile(JNIEnv *env, jclass clazz, jstring fileName) { PIX *pixd = NULL; diff --git a/tess-two/jni/com_googlecode_leptonica_android/writefile.cpp b/tess-two/jni/com_googlecode_leptonica_android/writefile.cpp index 0e7318735..28464bf70 100644 --- a/tess-two/jni/com_googlecode_leptonica_android/writefile.cpp +++ b/tess-two/jni/com_googlecode_leptonica_android/writefile.cpp @@ -48,54 +48,6 @@ jint Java_com_googlecode_leptonica_android_WriteFile_nativeWriteBytes8(JNIEnv *e return (jint)(w * h); } -jboolean Java_com_googlecode_leptonica_android_WriteFile_nativeWriteFiles(JNIEnv *env, - jclass clazz, - jlong nativePixa, - jstring rootName, - jint format) { - PIXA *pixas = (PIXA *) nativePixa; - - const char *c_rootName = env->GetStringUTFChars(rootName, NULL); - if (c_rootName == NULL) { - LOGE("could not extract rootName string!"); - return JNI_FALSE; - } - - jboolean result = JNI_TRUE; - - if (pixaWriteFiles(c_rootName, pixas, (l_uint32) format)) { - LOGE("could not write pixa data to %s", c_rootName); - result = JNI_FALSE; - } - - env->ReleaseStringUTFChars(rootName, c_rootName); - - return result; -} - -jbyteArray Java_com_googlecode_leptonica_android_WriteFile_nativeWriteMem(JNIEnv *env, - jclass clazz, - jlong nativePix, - jint format) { - PIX *pixs = (PIX *) nativePix; - - l_uint8 *data; - size_t size; - - if (pixWriteMem(&data, &size, pixs, (l_uint32) format)) { - LOGE("Failed to write pix data"); - return NULL; - } - - // TODO Can we just use the byte array directly? - jbyteArray array = env->NewByteArray(size); - env->SetByteArrayRegion(array, 0, size, (jbyte *) data); - - free(data); - - return array; -} - jboolean Java_com_googlecode_leptonica_android_WriteFile_nativeWriteImpliedFormat(JNIEnv *env, jclass clazz, jlong nativePix, diff --git a/tess-two/src/com/googlecode/leptonica/android/ReadFile.java b/tess-two/src/com/googlecode/leptonica/android/ReadFile.java index 01d13dc9f..9d6a5e5da 100644 --- a/tess-two/src/com/googlecode/leptonica/android/ReadFile.java +++ b/tess-two/src/com/googlecode/leptonica/android/ReadFile.java @@ -114,26 +114,6 @@ public static boolean replaceBytes8(Pix pixs, byte[] pixelData, int width, int h return nativeReplaceBytes8(pixs.mNativePix, pixelData, width, height); } - /** - * Creates a Pixa object from encoded files in a directory. Supported - * formats are BMP and JPEG. - * - * @param dir The directory containing the files. - * @param prefix The prefix of the files to load into a Pixa. - * @return a Pixa object containing one Pix for each file - */ - public static Pixa readFiles(File dir, String prefix) { - if (dir == null) - throw new IllegalArgumentException("Directory must be non-null"); - if (!dir.exists()) - throw new IllegalArgumentException("Directory does not exist"); - if (!dir.canRead()) - throw new IllegalArgumentException("Cannot read directory"); - - // TODO: Remove or fix this. - throw new RuntimeException("readFiles() is not current supported"); - } - /** * Creates a Pix object from encoded file data. Supported formats are BMP * and JPEG. @@ -207,8 +187,6 @@ public static Pix readBitmap(Bitmap bmp) { private static native boolean nativeReplaceBytes8(long nativePix, byte[] data, int w, int h); - private static native long nativeReadFiles(String dirname, String prefix); - private static native long nativeReadFile(String filename); private static native long nativeReadBitmap(Bitmap bitmap); diff --git a/tess-two/src/com/googlecode/leptonica/android/WriteFile.java b/tess-two/src/com/googlecode/leptonica/android/WriteFile.java index 85396900a..ef1a6555c 100644 --- a/tess-two/src/com/googlecode/leptonica/android/WriteFile.java +++ b/tess-two/src/com/googlecode/leptonica/android/WriteFile.java @@ -80,47 +80,6 @@ public static int writeBytes8(Pix pixs, byte[] data) { return bytesWritten; } - /** - * Writes all the images in a Pixa array to individual files using the - * specified format. The output file extension will be determined by the - * format. - *
- * Output file names will take the format true
on success
- */
- public static boolean writeFiles(Pixa pixas, File path, String prefix, int format) {
- if (pixas == null)
- throw new IllegalArgumentException("Source pixa must be non-null");
- if (path == null)
- throw new IllegalArgumentException("Destination path non-null");
- if (prefix == null)
- throw new IllegalArgumentException("Filename prefix must be non-null");
-
- //String rootname = new File(path, prefix).getAbsolutePath();
-
- throw new RuntimeException("writeFiles() is not currently supported");
- }
-
- /**
- * Write a Pix to a byte array using the specified encoding from
- * Constants.IFF_*.
- *
- * @param pixs The source image.
- * @param format A format from Constants.IFF_*.
- * @return a byte array containing encoded bytes
- */
- public static byte[] writeMem(Pix pixs, int format) {
- if (pixs == null)
- throw new IllegalArgumentException("Source pix must be non-null");
-
- throw new RuntimeException("writeMem() is not currently supported");
- }
-
/**
* Writes a Pix to file using the file extension as the output format;
* supported formats are .jpg or .jpeg for JPEG and .bmp for bitmap.
@@ -199,10 +158,6 @@ public static Bitmap writeBitmap(Pix pixs) {
private static native int nativeWriteBytes8(long nativePix, byte[] data);
- private static native boolean nativeWriteFiles(long nativePix, String rootname, int format);
-
- private static native byte[] nativeWriteMem(long nativePix, int format);
-
private static native boolean nativeWriteImpliedFormat(
long nativePix, String fileName, int quality, boolean progressive);