iPhoneでコアイメージを使用しようとしています。クォーツを使用して色を合成してuiviewを描画することはできますが、各コンポーネントをに分割したいと思いますCALayer
(UIviewはより多くのリソースを消費します)。
そのため、背景のビットマップをフィルタリングするために使用する白いマスクがあり、別のブレンディングモードを試してみたいと思います。残念ながら、レイヤーは色を「追加」しているだけです。
これが私のコードです:
@implementation WhiteLayerHelper
- (void)drawLayer:(CALayer *)theLayer
inContext:(CGContextRef)myContext
{
// draw a white overlay, with special blending and alpha values, so that the saturation can be animated
CGContextSetBlendMode(myContext,kCGBlendModeSaturation);
CGContextSetRGBFillColor(myContext,1.0,1.0,1.0,0.9);
CGContextFillRect(myContext,[UIScreen mainScreen].bounds);
}
@end
これがメインビューdrawrect
コードで、CALayerを使用しています。
- (void)drawRect:(CGRect)rect {
//get the drawing context
CGContextRef myContext = UIGraphicsGetCurrentContext();
// draw the background
[self fillContext:myContext withBounds:m_overlayRect withImage:m_currentImage];
[whiteLayer renderInContext:myContext];
}
何か問題がありますか?