Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 Feb 2013
Offline Last Active Feb 07 2013 06:37 AM

Topics I've Started

Loading Bitmaps from file

06 February 2013 - 01:53 PM

Hello everyone,


I'm trying to load a bitmap following the msdn examples but seems that I'm doing something wrong when call the CreateDecoderFromFileName method.


ID2D1Bitmap *myBitmap = NULL;
hr = LoadBitmapFromFile(pRT, pWICFactory, L".\\biglokeseal_paint.png", 0, 0, &myBitmap);

HRESULT LoadBitmapFromFile(ID2D1RenderTarget *pRenderTarget, IWICImagingFactory *pIWICFactory, PCWSTR uri, UINT destinationWidth, UINT destinationHeight, ID2D1Bitmap **ppBitmap)
    IWICBitmapDecoder *pDecoder = NULL;
    IWICBitmapFrameDecode *pSource = NULL;
    IWICStream *pStream = NULL;
    IWICFormatConverter *pConverter = NULL;
    IWICBitmapScaler *pScaler = NULL;

    HRSRC imageResHandle = NULL;
    HGLOBAL imageResDataHandle = NULL;
    void *pImageFile = NULL;
    DWORD imageFileSize = 0;

    HRESULT hr = pIWICFactory->CreateDecoderFromFilename(uri, NULL, GENERIC_READ, WICDecodeMetadataCacheOnLoad, &pDecoder);



Maybe the uri parameter it's wrong? I put the image file on resource files tree, I have to copy that somewhere else (on the project directory)?


*I'm using VisualStudio


I attached you the full project code here: http://pastebin.com/FiwRMNXr


Sorry for my english (i'm from spain) and Thanks!