开发者

Java equivalent to .NET's ColorBlend

开发者 https://www.devze.com 2023-03-18 22:04 出处:网络
开发者_运维问答What is the closest equivalent of .NET\'s ColorBlend /InterpolationColorsin Java?
开发者_运维问答

What is the closest equivalent of .NET's ColorBlend /InterpolationColors in Java?

Update: See my own solution below. Also, I needed this for my Android App.


Nearest seems to be java.awt.GradientPaint


I think I got the answer. I was actually looking this for Android for drawing a linear gradient line with multiple colors at various stops. Turns out Android's LinearGradient's constructor takes parameters for both colors and positions. To imitate .net's ColorBlend I'll just create a ColorBlend class with setter/getters for positions and colors.


For Java SE:

http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/ext/awt/LinearGradientPaint.html

(Sun has sponsored this Apache project. It is also part of their JavaFX product line.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号