Jump to content
  • Advertisement
Sign in to follow this  
pCebrian

Loading Bitmaps from file

This topic is 2015 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Edited by pCebrian

Share this post


Link to post
Share on other sites
Advertisement

Okay, I saw that the pointer to WIC Factory that I pass to the function is null.

 

Doesn't should that initialize the pointer?

 

        IWICImagingFactory *pWICFactory = NULL;
	if(SUCCEEDED(hr))
	{
		hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pWICFactory));
	}

 

What else I have to do?

 

Thanks!

Edited by pCebrian

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!