| 1 | |
package org.webslinger.ext.image; |
| 2 | |
|
| 3 | |
import java.awt.Rectangle; |
| 4 | |
import java.io.File; |
| 5 | |
import java.io.IOException; |
| 6 | |
|
| 7 | |
public class ConstrainingTransformerFactory extends AbstractConstantSizingTransformerFactory { |
| 8 | |
public ConstrainingTransformerFactory(Rectangle size) { |
| 9 | 0 | super(size); |
| 10 | 0 | } |
| 11 | |
|
| 12 | |
public ConstrainingTransformerFactory(int width, int height) { |
| 13 | 0 | this(new Rectangle(0, 0, width, height)); |
| 14 | 0 | } |
| 15 | |
|
| 16 | |
protected Rectangle transform(ImageDescriptor image, File file, int width, int height) throws InterruptedException, IOException { |
| 17 | 0 | return ImageUtils.constrainImage(file, width, height); |
| 18 | |
} |
| 19 | |
} |