I'm trying to load an image and show it on my render target device.
But when I'm trying to convert it with Redertarget->ConvertWicBitmap(), I get the same error code everytime:
0x88982f80
which is WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT, if believe the Wincodec error definitions file
All my pixel settings are the same as for the rendering target and as for image that I'm trying to load.
So what am i'm doing wrong?
Here the code for my render target:
props = D2D1::RenderTargetProperties(
D2D1_RENDER_TARGET_TYPE_DEFAULT,
D2D1::PixelFormat(
//DXGI_FORMAT_B8G8R8A8_UNORM
DXGI_FORMAT_B8G8R8A8_UNORM,
D2D1_ALPHA_MODE_IGNORE),
100,
100,
D2D1_RENDER_TARGET_USAGE_NONE,
D2D1_FEATURE_LEVEL_DEFAULT
);
hr = pD2DFactory->CreateDCRenderTarget(&props, &DCRT);
hr = pFactory->CreateDecoderFromFilename(
of.lpstrFile,
NULL,
GENERIC_READ,
WICDecodeMetadataCacheOnDemand,
&pDecoder);
ID2D1Bitmap * d2dBitmap;
That's how i do convert the image:
{
WICPixelFormatGUID wPixelFormat;
pFrame->GetPixelFormat(&wPixelFormat);
HRESULT hr = formatConverter->Initialize(
//32bppPBGR
//DXGI_FORMAT_B8G8R8A8_UNORM
/*static_cast<IWICBitmapSource*>*/
(pFrame), // Input bitmap to convert
wPixelFormat,
/*GUID_WICPixelFormat32bppBGRA,*/ // Destination pixel format
WICBitmapDitherTypeNone, // Specified dither pattern
NULL, // Specify a particular palette
0.f, // Alpha threshold
WICBitmapPaletteTypeCustom // Palette translation type
);
}
And a place where it crashes:
hr = DCRT->CreateBitmapFromWicBitmap(static_cast<IWICBitmapSource*>(pFrame), &d2dBitmap);
But when I'm trying to convert it with Redertarget->ConvertWicBitmap(), I get the same error code everytime:
0x88982f80
which is WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT, if believe the Wincodec error definitions file
All my pixel settings are the same as for the rendering target and as for image that I'm trying to load.
So what am i'm doing wrong?
Here the code for my render target:
props = D2D1::RenderTargetProperties(
D2D1_RENDER_TARGET_TYPE_DEFAULT,
D2D1::PixelFormat(
//DXGI_FORMAT_B8G8R8A8_UNORM
DXGI_FORMAT_B8G8R8A8_UNORM,
D2D1_ALPHA_MODE_IGNORE),
100,
100,
D2D1_RENDER_TARGET_USAGE_NONE,
D2D1_FEATURE_LEVEL_DEFAULT
);
hr = pD2DFactory->CreateDCRenderTarget(&props, &DCRT);
hr = pFactory->CreateDecoderFromFilename(
of.lpstrFile,
NULL,
GENERIC_READ,
WICDecodeMetadataCacheOnDemand,
&pDecoder);
ID2D1Bitmap * d2dBitmap;
That's how i do convert the image:
{
WICPixelFormatGUID wPixelFormat;
pFrame->GetPixelFormat(&wPixelFormat);
HRESULT hr = formatConverter->Initialize(
//32bppPBGR
//DXGI_FORMAT_B8G8R8A8_UNORM
/*static_cast<IWICBitmapSource*>*/
(pFrame), // Input bitmap to convert
wPixelFormat,
/*GUID_WICPixelFormat32bppBGRA,*/ // Destination pixel format
WICBitmapDitherTypeNone, // Specified dither pattern
NULL, // Specify a particular palette
0.f, // Alpha threshold
WICBitmapPaletteTypeCustom // Palette translation type
);
}
And a place where it crashes:
hr = DCRT->CreateBitmapFromWicBitmap(static_cast<IWICBitmapSource*>(pFrame), &d2dBitmap);