开发者

How to add a colored filter effect on an image?

I am building an Eclipse RCP application, based on eclipse 3.5.

I'd like to modify an image at runtime. The image is loaded and will be used as an icon, but depending on the situation, I'd like to add a filter on the image to give it a red or orange color, depending on some user-configured value.

It's the image transformation that I'm interested in. I already know how to get the image and ask a co开发者_StackOverflowmponent to display it.

Has anybody done that? Thanks for your help :)


There are possibly many choices for doing just that, you can use ImageIO to load an image as BufferedImage and then get the Graphics2D and modify it as you wish. When you are finished modifying you can reaasign the newly created image back into your component which holds the original image and thats it. You can of course look for some libraries to allow you easier image manipulation, maybe jmagick or something similar.


You can use DecoratingLabelProvider with a suitable ILabelDecorator. See also FAQ What is a label decorator?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜