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