Bonjour
j'utilise la fonction ci-dessous (copiee sur ce forum) pour redimensionner des bitmaps
sauf que dans le cas de la reduction, l'image est de mauvaise qualité (apparition de points, ligne...)
comment ameliorer la qualité ?
merci
HBITMAP ResizeBmp(HBITMAP hBmpSrc, SIZE newSize)
{
// taille actuelle
BITMAP bmpInfo;
GetObject(hBmpSrc, sizeof(BITMAP), &bmpInfo);
SIZE oldSize;
oldSize.cx = bmpInfo.bmWidth;
oldSize.cy = bmpInfo.bmHeight;
// selection source ds un DC
HDC hdc = GetDC(NULL);
HDC hDCSrc = CreateCompatibleDC(hdc);
HBITMAP hOldBmpSrc = (HBITMAP)SelectObject(hDCSrc, hBmpSrc);
// création bitmap dest et sélection ds un DC
HDC hDCDst = CreateCompatibleDC(hdc);
HBITMAP hBmpDst = CreateCompatibleBitmap(hdc, newSize.cx, newSize.cy);
HBITMAP hOldBmpDst = (HBITMAP)SelectObject(hDCDst, hBmpDst);
// resize
StretchBlt(hDCDst, 0, 0, newSize.cx, newSize.cy, hDCSrc, 0, 0, oldSize.cx, oldSize.cy, SRCCOPY);
// libération ressources
SelectObject(hDCSrc, hOldBmpSrc);
SelectObject(hDCDst, hOldBmpDst);
DeleteDC(hDCSrc);
DeleteDC(hDCDst);
ReleaseDC(NULL, hdc);
return hBmpDst;
}