StretchDIBits returns weird artifacts [example screens]

Started by
0 comments, last by cnstrnd 20 years, 3 months ago
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
Advertisement
You may be interested :

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

This topic is closed to new replies.

Advertisement