whoops
authorzapata <zapata>
Sat, 12 Apr 2003 23:18:39 +0000 (23:18 +0000)
committerzapata <zapata>
Sat, 12 Apr 2003 23:18:39 +0000 (23:18 +0000)
source/mircoders/media/ImageProcessor.java

index 2e1352d..e069d05 100755 (executable)
@@ -90,14 +90,34 @@ public class ImageProcessor {
   }
 
   public void descaleImage(int aMaxSize, float aMinDescale) throws java.io.IOException {
-    descaleImage(aMaxSize, aMaxSize, aMinDescale);
+    descaleImage(aMaxSize, aMaxSize, aMinDescale, 0);
   }
 
-  public void descaleImage(int aMaxWidth, int aMaxHeight, float aMinDescale) throws java.io.IOException {
+  public void descaleImage(int aMaxSize, int aMinResize) throws java.io.IOException {
+    descaleImage(aMaxSize, aMaxSize, 0, aMinResize);
+  }
+
+  public void descaleImage(int aMaxSize, float aMinDescale, int aMinResize) throws java.io.IOException {
+    descaleImage(aMaxSize, aMaxSize, aMinDescale, aMinResize);
+  }
+
+  /**
+   *
+   * Resizes an image to fit inside <code>aMaxWidth</code> and <code>aMaxHeight</code>, provided
+   *    this requires at least <code>aMinResize</code> pixels will be removed from either the width or
+   *    the height
+   *
+   * @param aMaxWidth
+   * @param aMaxHeight
+   * @param aMinDescale
+   * @param aMinResize
+   * @throws java.io.IOException
+   */
+  public void descaleImage(int aMaxWidth, int aMaxHeight, float aMinDescale, int aMinResize) throws java.io.IOException {
     float scale;
     scaledImage = image;
 
-    if ((aMaxWidth>0 && image.getWidth()>aMaxWidth) || (aMaxHeight>0 && image.getHeight()>aMaxHeight))
+    if ((aMaxWidth>0 && image.getWidth()>aMaxWidth+aMinResize-1) || (aMaxHeight>0 && image.getHeight()>aMaxHeight+aMinResize-1))
     {
       logger.info("Scaling image");