Unhandled exception when filling up bmiColors property in BITMAPINFO
-
The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.
for (i = 0; i < horzres\*vertres; i++) { bInfo.bmiColors\[i\].rgbRed = GetRValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbGreen = GetGValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbBlue = GetBValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbReserved = 0; }
Thanks very much in advance!
-
The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.
for (i = 0; i < horzres\*vertres; i++) { bInfo.bmiColors\[i\].rgbRed = GetRValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbGreen = GetGValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbBlue = GetBValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbReserved = 0; }
Thanks very much in advance!
If you're trying to fill a bitmap with data, they are word aligned internally, and you need to skip the padding at the ned of each row. My GDI+ image processing articles show how - the principle is the same in C++/GDI because the internal structure is the same. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
-
The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.
for (i = 0; i < horzres\*vertres; i++) { bInfo.bmiColors\[i\].rgbRed = GetRValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbGreen = GetGValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbBlue = GetBValue(pCol\[i\]); bInfo.bmiColors\[i\].rgbReserved = 0; }
Thanks very much in advance!
bmiColors is the palette, not the image. -c
Garbage collection, making life better - for weenies!
Image Processing - just like mom used to make.