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

Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top