2013-03-15 67 views
0

我有一个WICBitmap,其中包含我的MFC程序中的图像。有什么办法将这个位图绘制到设备上下文中吗?将WICBitmap绘制到窗口?

void DrawBitmap(IWICBitmapSource source, HDC targetDC, int X, int Y, int cx, int cy) 
{ 
    //source: The Bitmap to draw 
    //TargetDC: The HDC to draw onto (e.g. a printer or screen DC) 
    //X,Y: The location on the DC to draw the bitmap 

} 

回答

1

有MSDN上的样本数量,显示如何显示使用WIC位图,例如,GDI,GDI +,Direct2D的等

See the link here

+0

您可以链接到任何样品MSDN上这个节目使用GDI或GDI +显示WIC位图?或者,更好的是,发布代码? (你给的链接似乎陈旧 - 没有代码) – 2017-04-05 03:31:18

+0

@IanBoyd是的,抱歉,虽然该链接工作正常,但MSDN已经删除了这些示例!还有其他可用的 - 快速谷歌[找到这个博客](http://www.nuonsoft.com/blog/2011/10/17/introduction-to-wic-how-to-use-wic-to-load -an-image-and-draw-it-with-gdi/comment-page-1 /),其中展示了如何使用GDI呈现WIC位图。虽然我*可以*复制/粘贴作者的代码,但我不确定这是否完全符合道德标准,即使有合适的归属。也许这个链接有帮助? – 2017-04-05 05:32:05