#include "Win32WicImage.h"

#include "Image.h"
#include "Win32WicInterface.h"

#include <wincodec.h>

Win32WicImage::Win32WicImage(Image* image)
	: PlatformImage(image)
{
	mWicInterface = std::make_unique<Win32WicInterface>();
}

Win32WicImage::~Win32WicImage()
{

}

IWICBitmap* Win32WicImage::getBitmap()
{
	if (!mWicImage)
	{
		const auto width = mImage->getWidth();
		const auto height = mImage->getHeight();
		auto hr = mWicInterface->getFactory()->CreateBitmap(width, height, GUID_WICPixelFormat32bppBGR, WICBitmapCacheOnLoad, &mWicImage);
	}
	return mWicImage.Get();
}