【发布时间】:2010-05-07 17:06:51
【问题描述】:
如何获得从相机获取的图像的闪光效果? 在我从相机获取图像(它显示在 UIImageView 中)之后,在将其保存为文件之前,我想通过按下 Flash 按钮来减轻(在某些情况下)图像。使用Core Graphics可以吗??
【问题讨论】:
标签: objective-c iphone uiimageview core-graphics
如何获得从相机获取的图像的闪光效果? 在我从相机获取图像(它显示在 UIImageView 中)之后,在将其保存为文件之前,我想通过按下 Flash 按钮来减轻(在某些情况下)图像。使用Core Graphics可以吗??
【问题讨论】:
标签: objective-c iphone uiimageview core-graphics
看看my answer to this question。那个问题是关于使图像更暗,但您可以使用完全相同的代码并通过覆盖部分透明的白色来使图像更亮:
//draw a 50% white overlay
CGContextSetGrayFillColor(cx, 1.0, 0.5);
CGContextFillRect(cx, imageRect);
【讨论】:
CGContextSetBlendMode()。有希望的选择:kCGBlendModeLighten, kCGBlendModeColorDodge, kCGBlendModeColorBurn, kCGBlendModeSoftLight, kCGBlendModeHardLight, kCGBlendModeSaturation, kCGBlendModeLuminosity