Reputation: 1555
I'm currently in the process of converting some standard C# files so they work in a MonoTouch iPhone application, however I have hit a wall with this method:
private void WriteTestFile(CGBitmapContext bitmapImage, string fileName)
{
try
{
using (FileStream stream5 = new FileStream(fileName, FileMode.Create))
{
BitmapEncoder encoder5 = new BmpBitmapEncoder();
encoder5.Frames.Add(BitmapFrame.Create(bitmapImage));
encoder5.Save(stream5);
stream5.Close();
}
}
catch (UnauthorizedAccessException)
{
// Do nothing
}
}
I can't seem to find any equivalent to the BitmapEncoder class and I have no idea how to approach converting this part of the code, can anyone suggest a route to take?
Note: The original code used a WritableBitMap in pace of the CGBitmapContext.
Upvotes: 1
Views: 301
Reputation: 35477
I know nothing about MonoTouch nor iPhone.
However it looks like the function is just trying to save the bitmap image as BMP file. There must be an function in CGBitmapContext to Save to a file or some other class than can save a bitmap.
EDIT After further search, it looks like you should convert CGBitmapContext to a UIImage and then save it; seet How do I save an UIImage as BMP?
Upvotes: 1