次のメソッドを C# から MonoTouch 準拠のコードに変換する必要があります。
private WritableBitMap CreateBitMapWPF(RGBPaletteRecord rgbPalette, double dpi)
{
WritableBitMap bitmapImage = null;
try
{
bitmapImage = new WritableBitMap(TileRecord.PixelWidth, TileRecord.PixelHight, dpi, dpi, PixelFormats.Rgb24, BitmapPalettes.Halftone256);
// int nStride = (bitmapImage.PixelWidth * bitmapImage.Format.BitsPerPixel + 7) / 8;
int nStride = (bitmapImage.PixelWidth * bitmapImage.Format.BitsPerPixel / 8);
System.Windows.Int32Rect rect = new System.Windows.Int32Rect(0, 0, TileRecord.PixelWidth, TileRecord.PixelHight);
byte[] data = GetBytes(rgbPalette);
bitmapImage.WritePixels(rect, data, nStride, 0);
}
catch (Exception ex)
{
}
//// temp write to file to test
//using (FileStream stream5 = new FileStream(@"C:\test.bmp", FileMode.Create))
//{
// BitmapEncoder encoder5 = new BmpBitmapEncoder();
// encoder5.Frames.Add(BitmapFrame.Create(bitmapImage));
// encoder5.Save(stream5);
// stream5.Close();
//}
//
return bitmapImage;
}
誰かに実際の変換を依頼しているわけではありませんが、このコードを変換する際の最善の方法は何でしょうか? MonoTouch ライブラリを使用するための変換に集中する必要がありますか? 標準システム ライブラリ? アドバイスをいただければ幸いです。
どうもありがとう、
タイシン
編集; 基本的に、この変換の目的は、ビットマップ イメージを処理する一連の関数を実行するこれらの C# クラスを用意することです。iPhone アプリケーションでこれらのファイルを使用する必要があるため、MonoTouch を使用しています。