Problem case showing how we miss the translation/rotation for many of the less usual picture orientations.

This commit is contained in:
Knut Forkalsrud 2009-11-08 11:24:13 -08:00
parent c826a87af2
commit f6bea49c02
3 changed files with 10 additions and 7 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
target target
cache.properties
build

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

View file

@ -92,7 +92,7 @@ public class PictureScaler {
this.future = future; this.future = future;
} }
public CachedImage waitForIt(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { public CachedImage waitForIt(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException {
return future.get(/*timeout, unit*/); return future.get(/*timeout, unit*/);
} }
@ -113,15 +113,15 @@ public class PictureScaler {
} }
public CachedImage scalePicture(File file, Thumbnail thumbnail, String size) throws TimeoutException { public CachedImage scalePicture(File file, Thumbnail thumbnail, String size) {
PictureRequest req = getPictureRequest(file, thumbnail, size); PictureRequest req = getPictureRequest(file, thumbnail, size);
try { try {
return req.waitForIt(30, TimeUnit.SECONDS); return req.waitForIt(30, TimeUnit.SECONDS);
} catch (TimeoutException toe) { // } catch (TimeoutException toe) {
req.cancel(); // req.cancel();
toe.printStackTrace(); // toe.printStackTrace();
throw new TimeoutException("timed out"); // throw new TimeoutException("timed out");
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
@ -186,6 +186,8 @@ public class PictureScaler {
// //
// The first four are obtained with only flipping X and/or Y // The first four are obtained with only flipping X and/or Y
// The last four are obtained by rotating 90 degrees and then flipping X and/or Y. // The last four are obtained by rotating 90 degrees and then flipping X and/or Y.
//
// TODO: Flipping here completely forgets to translate accordingly, so for example rotation id 3 becomes completely messed up.
double[] flipX = new double[] { +1, -1, -1, +1, -1, +1, +1, -1 }; double[] flipX = new double[] { +1, -1, -1, +1, -1, +1, +1, -1 };
double[] flipY = new double[] { +1, +1, -1, -1, +1, +1, -1, -1 }; double[] flipY = new double[] { +1, +1, -1, -1, +1, +1, -1, -1 };