I've got a problem with the CGBitmapcontext. I get en error while creating the CGBitmapContext with the message "invalid Handle".
Here is my code:
var previewContext = new CGBitmapContext(null, (int)ExportedImage.Size.Width, (int)ExportedImage.Size.Height, 8, (int)ExportedImage.Size.Height * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedFirst);
Thank you;
That is because you are passing null to the first parameter. The CGBitmapContext is for drawing directly into a memory buffer. The first parameter in all the overloads of the constructor is (Apple docs):
In MonoTouch, we get two overloads that accept a byte[] for convenience. So you should use it like this:
This can also happen if the
width
orheight
parameters passed into the method have a value of 0.