Reputation: 68770
I am changing the Hue of images in FinishedLaunching () as part of my use of the Appearance settings. When I attempt to get the CIContext, the app is toren down without any crash information.
Here's the code:
var hueAdjust = new CIHueAdjust() {
Image = CIImage.FromCGImage(originalImage.CGImage),
Angle = hue * (float)Math.PI / 180f // angles to radians
};
var output = hueAdjust.OutputImage;
UIImage retVal = null;
UIGraphics.BeginImageContextWithOptions(originalImage.Size, false, 0);
using (var c = UIGraphics.GetCurrentContext ())
{
//****This next line causes the crash*******
var context = CIContext.FromContext(c);
var cgimage = context.CreateCGImage(output, output.Extent);
retVal = UIImage.FromImage(cgimage);
}
UIGraphics.EndImageContext();
return retVal;
I have tested setting this at various times of the app lifecycle, but it appears to always instantly get toren down.
Upvotes: 1
Views: 269
Reputation: 43553
Thanks for filling the bug report. The crash was due to an endless recursion in FromContext. However this won't solve your original problem since the API that was exposed does not exists in iOS (it's OSX specific).
Upvotes: 1
Reputation: 666
Don't know if I understand what you're trying to do, but here is some code to change the hue of an image: https://stackoverflow.com/a/11762982/1560797
I guess the method you use is a bug in Monotouch. I've tried it in a demo application myself, and it's generating a crash report on my device. (I'm not really familiar in reading the crash logs, so don't know exactly what's happening) Please report it at xamarin
Upvotes: 0