如何在图像上添加彩色滤镜效果?
我正在构建一个基于 eclipse 3.5 的 Eclipse RCP 应用程序。
我想在运行时修改图像。图像已加载并将用作图标,但根据情况,我想在图像上添加一个过滤器,根据某些用户配置的值为其提供红色或橙色。
我感兴趣的是图像转换。我已经知道如何获取图像并要求组件显示它。
有人这样做过吗?感谢您的帮助 :)
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 component to display it.
Has anybody done that? Thanks for your help :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能有很多选择可以做到这一点,您可以使用 ImageIO 将图像加载为 BufferedImage,然后获取 Graphics2D 并根据需要修改它。完成修改后,您可以将新创建的图像重新分配回保存原始图像的组件中,仅此而已。
您当然可以寻找一些库来让您更轻松地进行图像处理,也许是 jmagick 或类似的东西。
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.
您可以使用
DecoratingLabelProvider
带有合适的 <代码>ILabelDecorator。另请参阅常见问题解答什么是标签装饰器?You can use
DecoratingLabelProvider
with a suitableILabelDecorator
. See also FAQ What is a label decorator?