drupal hit counter
Jerry Huang | Translation between WP and Win8 Metro series: loading byte array into BitmapImage

Jerry Huang apps and developing apps

Translation between WP and Win8 Metro series: loading byte array into BitmapImage

1. November 2012 14:07 by Jerry in C#, Win8 Development, Windows Phone Development

WP

[code language=C#]
byte[] frameBuffer;
BitmapImage.SetSource(new MemoryStream(frameBuffer, 0, frameBuffer.Length));
[/code]

Win8

[code language=C#]
 var ms = new Windows.Storage.Streams.InMemoryRandomAccessStream();
                        ms.AsStreamForWrite().Write(frameBuffer, 0, frameBuffer.Length);
                        ms.Seek(0);
                        BitmapImage.SetSource(ms);
[/code]

it looks to me that Win8 just making thing complicated:(