import javax.imageio.*;
import groovy.swing.j2d.*
// 角のサイズ
dx = 20
dy = 20
img = ImageIO.read(new File("sf.jpg"))
def gr = new GraphicsRenderer()
gr.renderToFile("sample1143a.png",
img.width, img.height){
antialias("on")
polygon(
points: [dx,0, img.width-dx-1,0,
img.width-1,dy,
img.width-1,img.height-dy-1,
img.width-dx-1, img.height-1,
dx, img.height-1,
0, img.height-dy-1,
0, dy],
borderColor: no
){
texturePaint(x: 0, y: 0, image: img )
}
}
元画像(sf.jpg)
出力画像(sample1143a.png)
No comments:
Post a Comment