import groovy.swing.j2d.*
def gr = new GraphicsRenderer()
gr.renderToFile("sample815a.png", 200, 200){
 antialias("on")
 butterflyShape( x: 0, y: 0, width: 200, height: 200,
   borderColor: color("#103080"),
   borderWidth: 2
 ){
   linearGradient( x1: 0, y1: 0, x2: 0, y2: 200){
     stop(offset: 0, color: "blue")
     stop(offset: 0.25, color: "green")
     stop(offset: 0.5, color: "yellow")
     stop(offset: 0.75, color: "orange")
     stop(offset: 1, color: "red")
   }
 }
}
出力画像(sample815a.png)

動作環境
Groovy1.6.0 Beta2, JDK1.6 Update11
関連項目
groovyでストロークにグラデーションをかける
groovyで図形をグラデーションで塗りつぶす
 
No comments:
Post a Comment