我正在使用以下代码创建对象:
CompositionDrawingSurface uiElementBitmapSurface;
using (var canvasBitmap = CanvasBitmap.CreateFromBytes(
canvasDevice, pixels,
bitmap.PixelWidth,
bitmap.PixelHeight,
DirectXPixelFormat.B8G8R8A8UIntNormalized,
dpi)
)
{
var areaToRender = new Rect(100, 100, Control.ActualWidth, Control.ActualHeight);
Windows.UI.Composition.CompositionDrawingSurface surface = compositionDevice.CreateDrawingSurface(
new Size(areaToRender.Width, areaToRender.Height),
DirectXPixelFormat.B8G8R8A8UIntNormalized, DirectXAlphaMode.Premultiplied);
using (var session = CanvasComposition.CreateDrawingSession(uiElementBitmapSurface))
{
session.DrawImage(canvasBitmap, 0, 0, areaToRender);
}
}
请帮助将 uiElementBitmapSurface 对象转换为文件。