开发者

Java2d: Set gradient for a lines

开发者 https://www.devze.com 2022-12-30 04:50 出处:网络
I am having multiple points in a plane and some hundreds of lines pass through those points. Some points can have more lines passing through them than other points. I want to show some kind of more gr

I am having multiple points in a plane and some hundreds of lines pass through those points. Some points can have more lines passing through them than other points. I want to show some kind of more gradient or brightness associated with lines crowded together. Is this possible to do in java2d.

Please refer to this : http://ft.ornl.gov/do开发者_如何学Cku/_media/ft/projects/paraxis.jpg

Thank you.


That picture looks like just a bunch of lines drawn with a low alpha value - in other words, using a nearly transparent color. When you have a lot of lines close together, they'll overlap and the color will get brighter. So, assuming the picture shows the kind of effect you're looking for, just use one of the Color constructors with four arguments and specify a low alpha value for the last one (maybe 0.1 as a float, or 20-30 as an int), then go crazy drawing your lines ;-)

If that doesn't do what you want, maybe I misunderstood your question...

0

精彩评论

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