With Java's graphics shape drawing operations, is there an easy way to give the shapes transparency gradients and blurry edges?

StackOverflow https://stackoverflow.com/questions/19497526

What I would like is to give circles a fill color with a gradient that starts from the middle and then as it moves out to the edges becomes progressively more transparent, giving a blur effect. What is the simplest way of doing this?

有帮助吗?

解决方案

Try setting an appropiately defined java.awt.RadialGradientPaint (using Colors with alpha), then render your circles using that. You may need to translate the graphics coordinate system to get the gradient centered in the circle. (http://docs.oracle.com/javase/7/docs/api/java/awt/RadialGradientPaint.html)

Or just make an image in a graphics program and simply draw the image.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top