我正在使用 SharpDX 在 Metro 上进行图像处理。现在我成功获取了 WICBitmap 中的数据,并将其复制到 WriteableBitmap 以在 Image Control 中显示图像。但是现在的问题是,我需要把WriteableBitmap中的数据(不是文件,图像数据是瞬间生成的)放到D2D Bitmap中,所以我写了代码:</p>
DataStream originalDataStream = new DataStream(Height * Width * 4, true, true);
originalWriteableBitmap.PixelBuffer.AsStream().CopyTo(originalDataStream);
WICStream oriWICStream = new WICStream(wicFactory, originalDataStream);
SharpDX.WIC.BitmapDecoder bitmapDecoder = new SharpDX.WIC.BitmapDecoder(wicFactory, oriWICStream, DecodeOptions.CacheOnLoad);
当我运行代码时,最后一行出现错误:HRESULT: [0x88982F50], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The component can not be found。
谁知道如何解决这个问题?谢谢!!!
PS:你可以在这里下载我的测试项目:http: //sharpdx.org/forum/5-api-usage/297-wic-d2d1-using-sharpdx-in-metro-to-do-image-processing#297