< prev index next >
src/java.desktop/share/classes/java/awt/image/CropImageFilter.java
Print this page
*** 63,72 ****
--- 63,83 ----
cropY = y;
cropW = w;
cropH = h;
}
+ @Override
+ public ImageFilter getScaledFilterInstance(double scaleX, double scaleY) {
+ Object instance = super.getScaledFilterInstance(scaleX, scaleY);
+ CropImageFilter filter = (CropImageFilter) instance;
+ filter.cropX = (int) Math.ceil(cropX * scaleX);
+ filter.cropY = (int) Math.ceil(cropY * scaleY);
+ filter.cropW = (int) Math.floor(cropW * scaleX);
+ filter.cropH = (int) Math.floor(cropH * scaleY);
+ return filter;
+ }
+
/**
* Passes along the properties from the source object after adding a
* property indicating the cropped region.
* This method invokes {@code super.setProperties},
* which might result in additional properties being added.
< prev index next >