• Advertisement


This topic is now archived and is closed to further replies.

StretchDIBits returns weird artifacts [example screens]

This topic is 5200 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Before: After: The init code is pretty straight forward:
	// Create the bitmap and its device context

	ZeroMemory( &bmiHeader, sizeof(BITMAPINFOHEADER) );
	bmiHeader.biSize        = sizeof(BITMAPINFOHEADER);
	bmiHeader.biWidth       = _dwBitmapSize.X;
	bmiHeader.biHeight      = _dwBitmapSize.Y;
	bmiHeader.biPlanes      = 1;
	bmiHeader.biBitCount    = 32;
	bmiHeader.biCompression = BI_RGB;

	_hDC = CreateCompatibleDC( NULL );

	_hBitmap = CreateDIBSection( _hDC, (BITMAPINFO*) &bmiHeader,
		DIB_RGB_COLORS, (void**) &_pBitmapBits, NULL, 0 );

	_hOldBitmap = (HBITMAP) SelectObject( _hDC, _hBitmap );
So is the strech call:
// pbmi and pSource are parameters

	// Stretch source to fit target

	StretchDIBits( _hDC,
		0, 0, _dwBitmapSize.X, _dwBitmapSize.Y,
		0, 0, pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight,
		pSource, pbmi, DIB_RGB_COLORS, SRCCOPY );
I am loosing my mind on this. Why does the output looks like a 8bits palettized crap since it is in 32bits ?! Thanks

Share this post

Link to post
Share on other sites
You may be interested :

Always use SetStretchBltMode with COLORONCOLOR (w9x) or HALTONE (better quality with wNT or above)

Share this post

Link to post
Share on other sites

  • Advertisement