我想补充的彩色滤光片的ImageView的 [英] i want to add a color filter to the imageview

查看:134
本文介绍了我想补充的彩色滤光片的ImageView的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个 Col​​orFilter 的ImageView

目前我使用的:

ImageView iv = (ImageView)findViewById(resIdOfImageToFilter);
iv.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP);

我在 PotterDuff 检查多种模式,如 SRC_IN SRC 等等,但我没有得到任何的模式有什么区别......所有模式将整个的ImageView 完美的红色。

I've checked Multiple Modes in PotterDuff such as SRC_IN, SRC etc., but I'm not getting any difference in any of the modes... All mode turns the whole ImageView in perfect Red color.

我需要融入红色,在现有的图像,使图像看起来有发红......

I need to blend RED color in the existing image so that image will look with a REDDISH tinge....

推荐答案

正确的方法是用做 PorterDuff.Mode.LIGHTEN

所以更新code将是这样的:

So the updated code will be like:

ImageView iv = (ImageView)findViewById(resIdOfImageToFilter);
iv.setColorFilter(Color.RED, PorterDuff.Mode.LIGHTEN);

这篇关于我想补充的彩色滤光片的ImageView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆