Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting Standard C# to MonoTouch compliant code
    text
    copied!<p>I need to convert the following method from C# to MonoTouch compliant code:</p> <pre><code>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; } </code></pre> <p>I'm not asking for someone to do the actual conversion, but I'm wondering what the best approach to take would be when converting this code? Should I focus on converting to use the MonoTouch libraries? Standard System libraries? Any advice would be much appreciated.</p> <p>Thanks a lot,</p> <p>Tysin</p> <p><strong>EDIT;</strong> Basically the purpose of this conversion is that I have these C# classes that perform a set of functions to do with bitmapped images, I'm using MonoTouch as I need to use these files in an iPhone application.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload