Jump to content
  • Advertisement

Archived

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

cnstrnd

StretchDIBits returns weird artifacts [example screens]

This topic is 5380 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

	BITMAPINFOHEADER bmiHeader;
	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
Advertisement
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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!