0

I am writing Metro application for image sharing (kind of). I have separate project for downloading and handling communication to/from server (running on separate thread). I am now wondering what classes should I use for storing image data. I remeber good old days when there was Image class just for this purpose. But today I can seem to find anything like it. There are classes like BitmapSource and DrawingImage, but those are UI classes and can not/should not be used in non-UI threads. What would you suggest me for storing image data and easily transferin it back to UI thread, so I can use it as ImageSource (preferably). EDIT: I would like to keep image data in memory, if possible (not save to galery/remove on exit)

EDIT: So far I am using IRandomAccessStream, but I dont like this solution, because you can read only once from it (then reset must be performed). Further more - i am not sure how it behaves when multiple BitmapImage(s) have it set as source..

0xDEAD BEEF
  • 2,074
  • 7
  • 31
  • 46
  • I think you're mistaken about those classes not being usable from worker threads. See http://stackoverflow.com/a/2394157/103167 – Ben Voigt Sep 10 '12 at 14:20
  • I dont think so. In Metro app I do not have access to System.Windows.Media. Instead BitmapImage is originates from Windows.UI.Xaml.Media.Imaging and even has Dispatcher property (which means that it is certainly UI class) – 0xDEAD BEEF Sep 10 '12 at 14:47

1 Answers1

1

See http://winrtxamltoolkit.codeplex.com/ - the WriteableBitmap may be the ticket. Haven't played with it, but the overview seems in the ball park.

Jeff Brand
  • 5,623
  • 1
  • 23
  • 22