【问题标题】:Create Direct2D1 bitmap and draw it to Direct2D1 RenderTarget创建 Direct2D1 位图并将其绘制到 Direct2D1 RenderTarget
【发布时间】:2013-11-06 14:45:17
【问题描述】:

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

  1. 创建一个 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();
    
  2. 将此位图保存到变量中。

    RastImage = new SharpDX.Direct2D1.Bitmap(renderT, new Size2(targetWidth, targetHeight), props);
    
  3. 将此位图绘制到 Direct2D RenderTarget 中。

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

但这并没有做任何事情。有人可以告诉我我做错了什么吗?它甚至可以在没有 WIC 的情况下工作吗?欢迎任何帮助。我搜索了很多,但从未真正找到没有 WIC 的示例。

【问题讨论】:

    标签: c# bitmap direct2d sharpdx


    【解决方案1】:

    我知道了,太容易看到了。

    RastImage = rendertT.Bitmap
    

    【讨论】:

      猜你喜欢
      • 2014-01-18
      • 2015-06-17
      • 1970-01-01
      • 2016-11-08
      • 2013-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多