📄 replicatescalefilter.java
字号:
package java.awt.image;import java.util.Hashtable;public class ReplicateScaleFilter extends ImageFilter{ protected int srcWidth; protected int srcHeight; protected int destWidth; protected int destHeight; protected int[] srcrows; protected int[] srccols; protected Object outpixbuf;public ReplicateScaleFilter ( int width, int height) { destWidth = width; destHeight = height;}public void setDimensions ( int width, int height) { double scaleX = (double)srcWidth / width; double scaleY = (double)srcHeight / height; srcWidth = width; srcHeight = height; if ( scaleX > 0) { destWidth = (int)(scaleX * destWidth); } else { destWidth = srcWidth; } if ( scaleY > 0) { destHeight = (int)(scaleY * destHeight); } else { destHeight = srcHeight; } consumer.setDimensions( destWidth, destHeight);}public void setPixels ( int x, int y, int w, int h, ColorModel cm, byte[] pels, int off, int scan) {}public void setPixels ( int x, int y, int w, int h, ColorModel cm, int[] pels, int off, int scan) {}public void setProperties ( Hashtable props) { //add applied scale later super.setProperties( props);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -