I'm trying to draw on an image using CGContextRef
with the following piece of code:
UIGraphicsBeginImageContextWithOptions(size, false, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
// After getting the context i pass it to a C++ backend by an appropriate wrapper and do some drawing operations.
Then I try to get the image from context with the following piece of code:
CGImageRef image = [UIGraphicsGetImageFromCurrentImageContext() CGImage];
But this returns an image with size (0,0).
I tried to get the image with:
CGImageRef image = CGBitmapContextCreateImage(context);
This returns a blank image with the original size multiplied by 3 for both width and height.
Any suggestions?