Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
803 views
in Technique[技术] by (71.8m points)

iphone - CGContext transparency problem

I have an UIView which 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...