CGContext transparency problem
I have an UIView w开发者_JS百科hich has white background color set. I have set the blending mode of the CGContext of the UIView as 'kCGBlendModeCopy'. Then, 1. Draw an UIImage in that CGContext 2. Draw a path with alpha as 0 in that context.
The transparent area covered by the path appears in black whereas my expected output was that it should be UIView's background color (i.e. white).
Does anyone knows what is the problem here?
Thanks in advance, Regards, Deepa
There is no problem here and hence no solution. Since we are drawing on the UIView's context with transparency, we can see the screen that is in black color. The drawing hierarchy is like this: 1. Black screen 2. On this transparent window is kept. Through this window we can see the screen 3. A view that is partially transparent is kept on this window. Through this view we can see window(Window is transparent and hence we can see screen) (View is partially transparent because I am drawing part of the View with transparent path)
Hope this helps you Naren
Maybe this article can help you..
http://losingfight.com/blog/2007/08/18/how-to-implement-a-basic-bitmap-brush/
I understood the problem after putting some more effort:
CGContext is not a separate drawing layer of UIView. UIView is a cocoa wrapper for CGContext drawing. Since I am drawing the path with transparency, the screen behind the UIView is visible.
精彩评论