}
public MonochromeBitmapSource rotateCounterClockwise() {
+ if (!isRotateSupported()) {
+ throw new IllegalStateException("Rotate not supported");
+ }
// 90 degrees counterclockwise:
AffineTransform transform = new AffineTransform(0.0, -1.0, 1.0, 0.0, 0.0, image.getHeight());
BufferedImageOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
}
public boolean isRotateSupported() {
+ // Can't run AffineTransforms on images of unknown format
return image.getType() != BufferedImage.TYPE_CUSTOM;
- // Not sure what to make of the situation where a BufferedImage is parsed, but its format is not known
- // In any event an AffineTransformOp on it will fail, so say it's not supported
}
/**