Archived

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

cnstrnd

StretchDIBits returns weird artifacts [example screens]

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