private void CreateBannerImage() { if (bannerBitmap != null) { bannerBitmap.Dispose(); } ushort[] DecodedImageData = DecodeBNRImage(ImageData); //C4.DecodeC4(ImageData, 96, 32); uint[] PixelData = new uint[96 * 32]; for (int i = 0; i < DecodedImageData.Length; i++) { PixelData[i] = RGB5A3.ToARGB8(DecodedImageData[i]); } byte[] BitmapSourceData = new byte[4 * 96 * 32]; for (int i = 0; i < PixelData.Length; i++) { int idx = i * 4; BitmapSourceData[idx + 3] = (byte)((PixelData[i] >> 24) & 0xFF); BitmapSourceData[idx + 2] = (byte)((PixelData[i] >> 16) & 0xFF); BitmapSourceData[idx + 1] = (byte)((PixelData[i] >> 8) & 0xFF); BitmapSourceData[idx + 0] = (byte)((PixelData[i] >> 0) & 0xFF); } bannerBitmap = BitmapUtilities.CreateBitmap(BitmapSourceData, 96, 32); bannerImage = bannerBitmap.ToBitmapSource(); }