2015-07-11 28 views
3

當我繪製一個圓角如何用Java中的圓角創建圖像?

數據的BufferedImage
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); 
Graphics2D graphics = image.createGraphics(); 
graphics.setColor(Color.WHITE); 
graphics.fill(new RoundRectangle2D.Float(0, 0, 60, 60, 20, 20)); 

輸出的圖像是:

enter image description here

我怎樣才能收到圖像無黑cornerns?

回答

4

變化BufferedImage.TYPE_INT_RGBBufferedImage.TYPE_INT_ARGB創建一個透明圖像

+0

感謝您快速正確的答案! – Dylan

+0

這使得一個很好的變化(是正確的);) – MadProgrammer