Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Loading Bitmaps from file


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 pCebrian   Members   -  Reputation: 102

Like
0Likes
Like

Posted 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!


Edited by pCebrian, 06 February 2013 - 02:05 PM.


Sponsor:

#2 pCebrian   Members   -  Reputation: 102

Like
0Likes
Like

Posted 07 February 2013 - 04:11 AM

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, 07 February 2013 - 04:14 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS