J'utilise l'API Imaging pour écrire essentiellement une fonction de redimensionnement à l'aide de la fonction de redimensionnement intégrée Imaging.IImage * from IBitmapImage *
J'ai besoin pour nourrir une classe UBitmap personnalisée qu'il est construit avec une image * pointeur avec la fonction redimensionnée, voici donc la fonction Redimensionner proto:
int Rescale(const UBitmap* src, UBitmap* dst, UINT w, UINT h)
Ma fonction alloue tas pour le pointeur de la dst (l'appelant ne besoin de le libérer seulement).
Ce que je l'ai fait jusqu'à présent:
// 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();
J'ai TRANSFORMÉ avec succès l'image avec le pImg-> Appel CreateBitmapFromImage, mais je ne sais pas comment obtenir IImage * pour nourrir la UBitmap constructeur.
Merci d'avance.