@Grab(group='com.jhlabs', module='filters', version='2.0.235') import java.awt.* import java.awt.image.* import java.io.* import javax.imageio.* import com.jhlabs.composite.* import com.jhlabs.image.* // ざらざらとしたグラデーション画像を生成する def img = new BufferedImage( 200, 200, BufferedImage.TYPE_INT_ARGB ) def grf = new GradientFilter( new Point(0, 0), new Point(0, img.getHeight()), (int)0xff000000, (int)0xffffffff, false, GradientFilter.LINEAR, GradientFilter.INT_SMOOTH) img = grf.filter(img, null) def nf = new NoiseFilter() nf.setMonochrome(true) img = nf.filter(img, null) def lc = new LinearColormap((int)0xFFFFFF10, (int)0xFF3070A0) LookupFilter lf = new LookupFilter(lc) img = lf.filter(img, null) def bf = new BumpFilter() img = bf.filter(img, null) ImageIO.write(img, "png", new File("noisegradient.png"))出力画像
動作環境
groovy 1.8.6, JDK7 update4
No comments:
Post a Comment