不幸的是,没有办法将 a 转换IWICBitmap为 a HBITMAP,或从 a 获取 1 IWICBitmapSource。但是,HBITMAP如果格式与预期兼容,您可以轻松地从像素缓冲区创建CreateBitmap。
假设一个 32 位 RGBA 位图:
IWICBitmapSource *bitmap_source = some_func();
UINT width = 0, height = 0;
bitmap_source->GetSize(&width, &height);
std::vector<BYTE> buffer(width * height * 4);
bitmap_source->CopyPixels(0, width * 4, buffer.size(), buffer.data());
HBITMAP bitmap = CreateBitmap(width, height, 1, 32, buffer.data());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3226 次 |
| 最近记录: |