-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made Pixa iterable over contained Pix. Cleaned up Leptonica Java form…
…atting.
- Loading branch information
Showing
14 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/AdaptiveMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Binarize.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Box.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Convert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Enhance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/JpegIO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2010 Google Inc. | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
|
@@ -21,7 +21,7 @@ | |
/** | ||
* Java representation of a native Leptonica PIX object. | ||
* | ||
* @author [email protected] (Your Name Here) | ||
* @author [email protected] (Alan Viverette) | ||
*/ | ||
public class Pix { | ||
static { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
/* | ||
* Copyright (C) 2010 Google Inc. | ||
* | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
|
@@ -20,14 +20,15 @@ | |
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
|
||
/** | ||
* Java representation of a native PIXA object. This object contains multiple | ||
* PIX objects and their associated bounding BOX objects. | ||
* | ||
* @author [email protected] (Your Name Here) | ||
* @author [email protected] (Alan Viverette) | ||
*/ | ||
public class Pixa { | ||
public class Pixa implements Iterable<Pix> { | ||
static { | ||
System.loadLibrary("lept"); | ||
} | ||
|
@@ -393,6 +394,35 @@ public boolean writeToFileRandomCmap(File file) { | |
return nativeWriteToFileRandomCmap(mNativePixa, file.getAbsolutePath(), mWidth, mHeight); | ||
} | ||
|
||
@Override | ||
public Iterator<Pix> iterator() { | ||
return new PixIterator(); | ||
} | ||
|
||
private class PixIterator implements Iterator<Pix> { | ||
private int mIndex; | ||
|
||
private PixIterator() { | ||
mIndex = 0; | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
final int size = size(); | ||
return (size > 0 && mIndex < size); | ||
} | ||
|
||
@Override | ||
public Pix next() { | ||
return getPix(mIndex++); | ||
} | ||
|
||
@Override | ||
public void remove() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} | ||
|
||
// *************** | ||
// * NATIVE CODE * | ||
// *************** | ||
|
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/ReadFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 16 additions & 2 deletions
18
tesseract-android-tools/src/com/googlecode/leptonica/android/Rotate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
// Copyright 2010 Google Inc. All Rights Reserved. | ||
/* | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.googlecode.leptonica.android; | ||
|
||
/** | ||
* @author [email protected] (Your Name Here) | ||
* @author [email protected] (Alan Viverette) | ||
*/ | ||
public class Rotate { | ||
static { | ||
|
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Scale.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/Skew.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tesseract-android-tools/src/com/googlecode/leptonica/android/WriteFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters