MFC中,CImage通过StretchBlt实现镜像翻转功能

// nFlipMode:0 水平翻转,1或其他 垂直翻转
void SetImageFlipped(CImage* image, int nFlipMode)
{
	if (image == NULL)
		return;
	CImageDC fzdc(*image);
	if (nFlipMode == 0)
	{
		image->StretchBlt(fzdc, 0, 0, image->GetWidth(), image->GetHeight(), image->GetWidth(), 0, -image->GetWidth(), image->GetHeight(), SRCCOPY);
	}
	else
	{
		image->StretchBlt(fzdc, 0, 0, image->GetWidth(), image->GetHeight(), 0, image->GetHeight(), image->GetWidth(), -image->GetHeight(), SRCCOPY);
	}
}

你可能感兴趣的:(mfc,c++)