本文整理汇总了C++中IWICImagingFactory::CreateBitmapFromHBITMAP方法的典型用法代码示例。如果您正苦于以下问题:C++ IWICImagingFactory::CreateBitmapFromHBITMAP方法的具体用法?C++ IWICImagingFactory::CreateBitmapFromHBITMAP怎么用?C++ IWICImagingFactory::CreateBitmapFromHBITMAP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWICImagingFactory
的用法示例。
在下文中一共展示了IWICImagingFactory::CreateBitmapFromHBITMAP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DecodeImageFromThumbCache
HRESULT CMainWindow::DecodeImageFromThumbCache(
IShellItem *pShellItem,
ID2D1Bitmap **ppBitmap
)
{
const UINT THUMB_SIZE = 256;
// Read the bitmap from the thumbnail cache
IThumbnailCache *pThumbCache;
HRESULT hr = CoCreateInstance(
CLSID_LocalThumbnailCache,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pThumbCache)
);
if (SUCCEEDED(hr))
{
ISharedBitmap *pBitmap;
hr = pThumbCache->GetThumbnail(
pShellItem,
THUMB_SIZE,
WTS_SCALETOREQUESTEDSIZE,
&pBitmap,
NULL,
NULL
);
if (SUCCEEDED(hr))
{
HBITMAP hBitmap;
hr = pBitmap->GetSharedBitmap(
&hBitmap
);
if (SUCCEEDED(hr))
{
// Create a WIC bitmap from the shared bitmap
IWICImagingFactory *pFactory;
hr = CoCreateInstance(
CLSID_WICImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pFactory)
);
if (SUCCEEDED(hr))
{
IWICBitmap *pWICBitmap;
hr = pFactory->CreateBitmapFromHBITMAP(
hBitmap,
NULL,
WICBitmapIgnoreAlpha,
&pWICBitmap
);
if (SUCCEEDED(hr))
{
// Create a D2D bitmap from the WIC bitmap
hr = m_pRenderTarget->CreateBitmapFromWicBitmap(
pWICBitmap,
NULL,
ppBitmap
);
pWICBitmap->Release();
}
pFactory->Release();
}
}
pBitmap->Release();
}
pThumbCache->Release();
}
return hr;
}