@Grab(group='com.jhlabs', module='filters', version='2.0.235') import java.awt.* import java.awt.geom.* import java.awt.image.* import java.io.* import javax.imageio.* import org.codehaus.griffon.jsilhouette.geom.* // ルーローの三角形を描画する def img = new BufferedImage( 200, 200, BufferedImage.TYPE_INT_ARGB ) def gr = img.createGraphics() gr.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ) gr.setColor(new Color((int)0xFF92ADC2)) def minlen = img.getWidth()>img.getHeight()?img.getHeight():img.getWidth() def reuleaux = new ReuleauxTriangle(0, (int)minlen/2*Math.sqrt(3), minlen, 0, true) gr.fill(reuleaux) gr.dispose() ImageIO.write(img, "png", new File("drawreuleaux.png"))
出力画像
動作環境
groovy 1.8.6, JDK7 update4
No comments:
Post a Comment