MFC - Blurry / Pixelized BMP with StretchDIBits -
i using stretchdibits function , during display of bitmap, can see displayed in 2 different ways such below :

the thing doing updating bmp buffer whenever new data.
please find below associated code used display bitmap.
if (pbmpbuffer) { lpbitmapinfo pbmpinfo; pbmpinfo = (lpbitmapinfo) new byte[sizeof(bitmapinfoheader) + 256 * sizeof(rgbquad)]; pbmpinfo->bmiheader.bisize = sizeof(bitmapinfoheader); pbmpinfo->bmiheader.biwidth = m_izsize; pbmpinfo->bmiheader.biheight = m_ixsize; pbmpinfo->bmiheader.biplanes = 1; pbmpinfo->bmiheader.bibitcount = 32; pbmpinfo->bmiheader.bicompression = bi_rgb; pbmpinfo->bmiheader.bisizeimage = m_ixsize * m_izsize; pbmpinfo->bmiheader.bixpelspermeter = 0; pbmpinfo->bmiheader.biypelspermeter = 0; pbmpinfo->bmiheader.biclrused = 0; pbmpinfo->bmiheader.biclrimportant = 0; setstretchbltmode(pdc->m_hdc, stretch_halftone); stretchdibits(pdc->m_hdc, rectbmp.left, rectbmp.top, rectbmp.width(), rectbmp.height(), 0, 0, m_izsize, m_ixsize, pbmpbuffer, pbmpinfo, dib_rgb_colors, srccopy); delete[] pbmpinfo; } i have bitmap "blurry" look. in advance.
you use gdi+ instead of gdi , select bicubic interpolation algorithm used when images scaled or rotated. see gdiplus::graphics::setinterpolationmode
notice gdi+ going slower gdi.. option using opengl example...
Comments
Post a Comment