Re: SetBitmapBits fails - why?
- From: Martin Leese <please@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 24 Aug 2005 11:52:53 -0600
Kevin wrote:
In this code snippet....
void TForm1::DisplayFrame(void) {
FindMinMax();
int i;
// copy the raw data to the bitmap while applying contrast adjustment for(i = 0; i < rows * cols; i++) { pBitmapPixels[i] = Contrast(pRawPixels[i], PixMin, PixMax) * 0x010101; }
SetBitmapBits(pbitmap, rows * cols * 4, pBitmapPixels);
Form2->Canvas->Draw(0, 0, pbitmap);
}
occasionally the function SetBitmapBits(...) fails, it returns zero. Anybody know why?
No, but why are you not checking the return value? All return values should always be checked. When it fails just do it again.
Also, the 4 in "rows * cols * 4" should really be replaced with something like sizeof(*pbitmap).
-- Regards, Martin Leese E-mail: please@xxxxxxxxxxxxxxxxxxxxxxxxxx Web: http://members.tripod.com/martin_leese/ .
- References:
- SetBitmapBits fails - why?
- From: Kevin
- SetBitmapBits fails - why?
- Prev by Date: Re: detecting motion blur
- Next by Date: help needed on foreground image extraction
- Previous by thread: SetBitmapBits fails - why?
- Next by thread: Re: SetBitmapBits fails - why?
- Index(es):
Relevant Pages
|
|