import javax.imageio.*;
import groovy.swing.j2d.*
img = ImageIO.read(new File("sf.jpg"))
w = img.getWidth()
h = img.getHeight()
gr = new GraphicsRenderer()
gr.renderToFile("sample1008a.png", w, h){
antialias 'on'
rect( x: 0, y: 0, width: w, height: h,
borderColor: no){
texturePaint(x: 0, y: 0, image: img )
filters {
lights {
pointLight(azimuth: 90/180f*Math.PI,
elevation: 0.4,
intensity: 0.7,
color: 'yellow',
centreX:0.8, centreY:0.1)
}
}
}
}
出力画像(sample1008a.png)
動作環境
Groovy1.6.0, JDK1.6 Update12
No comments:
Post a Comment