C# 创建Direct2D1位图并将其绘制到Direct2D1 RenderTarget

C# 创建Direct2D1位图并将其绘制到Direct2D1 RenderTarget,c#,bitmap,direct2d,sharpdx,C#,Bitmap,Direct2d,Sharpdx,我想在不使用WIC的情况下执行以下操作: 创建Direct2D1位图并在其中绘制一些内容 BitmapProperties props = new BitmapProperties(new SharpDX.Direct2D1.PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied)); var renderT = new SharpDX.Direct2D1.BitmapRenderTarget(m_d2dRenderTargetIma

我想在不使用WIC的情况下执行以下操作:

  • 创建Direct2D1位图并在其中绘制一些内容

    BitmapProperties props = new BitmapProperties(new SharpDX.Direct2D1.PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied));
    var renderT = new SharpDX.Direct2D1.BitmapRenderTarget(m_d2dRenderTargetImage, CompatibleRenderTargetOptions.None, new SharpDX.Direct2D1.PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied));
    
    renderT.BeginDraw();
    renderT.Clear(SharpDX.Color.Yellow);
    renderT.EndDraw();
    
  • 将此位图保存到变量

    RastImage = new SharpDX.Direct2D1.Bitmap(renderT, new Size2(targetWidth, targetHeight), props);
    
  • 将此位图绘制到Direct2D渲染目标中

    m_d2dRenderTarget = new RenderTarget(m_d2dFactory, surface, rtp);
    

  • 但这没有任何作用。有人能告诉我我做错了什么吗?没有WIC它还能工作吗?欢迎任何帮助。我搜索了很多,但没有找到一个没有WIC的例子。

    我找到了,它太容易看了

    RastImage = rendertT.Bitmap
    

    我明白了,它太容易看了

    RastImage = rendertT.Bitmap