How to draw shapes with color gradients and different opacities?
I have used transparency to paint shapes using Graphics.drawXXX methods but they always were solid colors, and now I need something a开发者_C百科 bit different:
I need to draw a shape on my component with a color gradient that goes from an absolutely opaque black color to an absolutely transparent black color.
How can I do this? Thank you!
- Use the two
Colorobjects (constructed using the 4intform) for theGradientPaint. - Set that paint to the
Graphicsobtained from an image declared to support transparency (e.g.TYPE_INT_ARGB). - Paint (probably using one of the 'fill' methods).
加载中,请稍侯......
精彩评论