UIImage 混合给定的颜色
来源:互联网 发布:js appendchild html 编辑:程序博客网 时间:2024/06/05 05:30
- (UIImage *)imageTintedWithColor:(UIColor *)color
{
// This method is designed for use with template images, i.e. solid-coloured mask-like images.
return [selfimageTintedWithColor:colorfraction:0.0];// default to a fully tinted mask of the image.
}
- (UIImage *)imageTintedWithColor:(UIColor *)color fraction:(CGFloat)fraction
{
if (color) {
// Construct new image the same size as this one.
UIImage *image;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >=40000
if ([[[UIDevicecurrentDevice] systemVersion]floatValue] >= 4.0) {
UIGraphicsBeginImageContextWithOptions([selfsize], NO, 0.0);// 0.0 for scale means "scale for device's main screen".
}
#else
if ([[[UIDevice currentDevice] systemVersion] floatValue] <4.0) {
UIGraphicsBeginImageContext([self size]);
}
#endif
CGRect rect =CGRectZero;
rect.size = [selfsize];
// Composite tint color at its own opacity.
[colorset];
UIRectFill(rect);
// Mask tint color-swatch to this image's opaque mask.
// We want behaviour like NSCompositeDestinationIn on Mac OS X.
[selfdrawInRect:rect blendMode:kCGBlendModeDestinationInalpha:1.0];
// Finally, composite this image over the tinted mask at desired opacity.
if (fraction >0.0) {
// We want behaviour like NSCompositeSourceOver on Mac OS X.
[selfdrawInRect:rect blendMode:kCGBlendModeSourceAtopalpha:fraction];
}
image =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
returnself;
}
- UIImage 混合给定的颜色
- UIImage UIImageRenderingModeAlwaysTemplate改变image的颜色
- 混合 颜色
- 更改UIImage颜色
- UIImage渲染颜色
- UIImage修改图片颜色
- 背景颜色转为UIImage
- UIimage更改TintColor颜色
- UIImage 颜色渲染imageWithRenderingMode
- iOS中改变UIImage的颜色和大小的方法
- 关于Mat转UIImage之后颜色不对的解决方法
- UIImage 的根据文字或者环境而改变颜色
- 混合颜色的色值计算公式
- 颜色是如何混合出来的
- python实现从一组颜色中找出与给定颜色最接近颜色的方法
- ios 利用颜色生成UIImage
- 由颜色初始化UIImage对象
- IOS 颜色转换成UIImage
- ACS712中文资料_描述(电流传感器)
- static_cast dynamic_cast reinterpret_cast const_cast 的区别和使用方法
- VC项目文件说明
- js键盘
- boolean type is tinyint(1) in MySQL
- UIImage 混合给定的颜色
- 实现输入【汉字】自动识别出对应的【拼音】
- 改掉不良习惯,优化程序性能
- Jakarta Commons —— Configuration
- 黑马程序员之ADO.NET学习笔记:执行Insert操作
- 使用DSPBIOS的CCS工程设置(独家!)
- Android学习<LinearLayout, FrameLayout, RelativeLayout>
- 腾讯马拉松之海岛小Q
- Ubuntu系统 安装JDK1.7,Eclipse,Oracle10g