I just need to know hot to create a CGLayer that has an image drawn to it. I am not completely understanding the documentation entirely. Thanks
I just need to know hot to create a CGLayer that has an image
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A while ago I posted a blog post on a similar topic, available here:
Drawing UIImages right side up using CoreGraphics
In that post, I show how to draw a UIImage so that’s it’s grayscale. Part of that includes creating a new layer with a gray colorspace (so it draws in shades of gray), and then extracting the
CGContextReffrom theCGLayer, pushing it to the context stack, drawing theUIImage, and then popping the context stack. TheUIImagedraws onto the topmostCGContextRef, which will be the context that corresponds to yourCGLayer.There are probably other ways to do this, but this is how I’ve done it in the past, and it’s always worked great for me.