I took this photo on Tuesday morning atop Rockefeller Center. It was extremely cold because of the 20 something temperature and wind 70 floors up.
Archive for December, 2005On my latest project I found a need to use Bitmap images in my .NET Compact Framework application. Using Visual Studio 2005 (Beta 2) and the Windows Mobile 5 SDK the application is currently stable on an HP iPAQ running WM5. There are a few things that annoy me about developing on this platform, though, because the Compact Framework 2.0 is still buggy and the API is not well documented nor easy to find on the MSDN site. I wanted to create a data file that could contain metadata and images so that I didn’t have a mess of extra files hanging around on the PDA. Using XML I want to tag profiles so that meaningful and easy to read data along with an embedded picture can be saved. For understanding purposes the meaningful data would be an email address and the image would be a bitmap. Saving is easy and can be done using the following code:
In the above code I transform the bitmap into a byte array (byte[]) using the MemoryStream class. The length of the byte array is stored to the XML file and then the entire byte array is written. Again, this is the easy part. The reverse — turning the byte array into a bitmap image — is not necessarily difficult but it took a while to find.
|


Entries (RSS)