I'm on Xamarin, iOS, and am messing with UIImage and CGImage. The docs don't quite state what is going on with how exactly a UIImage is created, when you pass in a CGImage. It doesn't state if a copy is made of the CGImage, or if it merely uses the CGImage ptr.
So I'm curious about this:
IntPtr p1;
IntPtr p2;
using (var image = tempContext.CreateCGImage(ciImage, ciImage.Extent))
{
m_uiImage = new UIImage(image);
CGImage cgi = m_uiImage.CGImage;
p1 = m_uiImage.CGImage.GetHandle();
p2 = image.GetHandle();
}
IntPtr p3 = m_uiImage.CGImage.GetHandle();
I don't know Xamarin/C# that well, but I think Dispose() is called on 'image' inside the using clause. if UIImage was in fact created from simply setting a pointer from image, then after the using statement exits, you'd think m_uiImage's CGImage would be disposed already? However, all three p1, p2, and p3, are still exactly the same after the p3 = call. Why? what is GetHandle() returning? I thought it was a pointer to the native object.