我使用的图像处理API基本上写使用内置的调整大小功能的摄像重新缩放功能。

我需要喂养定制UBitmap类,它的构造与图像*指针与所述调整大小功能,所以这里的重缩放功能原:

int Rescale(const UBitmap* src, UBitmap* dst, UINT w, UINT h)

我的函数分配堆的DST指针(调用者需要释放它仅)。

什么我迄今所做的:

// Get the IImage ptr from the source

HRESULT hr;
CoInitializeEx(NULL, COINIT_MULTITHREADED);

IImage* img_in = src->GetIImage();

if (img_in)
{
    IImagingFactory* pImgf = NULL;
    hr = CoCreateInstance(CLSID_ImagingFactory, 0, CLSCTX_ALL,
            IID_IImagingFactory, void**)&pImgf);

    assert(SUCCEEDED(hr));
        IBitmapImage* pIResBmp = NULL;
        hr = pImgf->CreateBitmapFromImage(img_in,w,h, PixelFormatDontCare, 
                 InterpolationHintBilinear, &pIResBmp);
    assert(SUCCEEDED(hr));

    IImage* pImgOut = NULL;  // How to obtain IImage pointer from pIResBmp?

    bmpOut = new UBitmap(dst);
    pImgf->Release();
}   

CoUninitialize();

所以,我已经成功地重新调整与pImg-> CreateBitmapFromImage通话的形象,但我不知道如何获得IIMAGE *喂UBitmap构造。

预先感谢。

有帮助吗?

解决方案

要获得IIMAGE *对象简单地使用IImagingFactory :: CreateImageFromFile。 请参见 http://msdn.microsoft.com/en-us/library/aa918650的.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top