![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | hi, how to read bits from CImage class I use the getbits like this ,but when I read half of the image ,the error occur, could you tell me why this happen , and do I need to lock the memory of CImage.GetBits() before I use it, thanks w = image.GetWidth(); h = image.GetHeight(); int nClrCount = image.GetBPP()/8; BYTE * pImageData = (BYTE *)image.GetBits(); ///??? do I need to lock it ? and how to lock it? int Pitch = image.GetPitch(); if( nClrCount == 3) { for( int y = 0; y<h ; y++) { for( int x = 0 ;x<w; x++) { WORD hue,luminance,saturation; BYTE bRed,bGreen,bBlue; BYTE * p = pImageData + (y*w+x)*3; //////?????right? /// the runtime error happened here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! bRed = *p; bGreen = *(p+1); bBlue = * (p+2); COLORREF color = RGB(bRed, bGreen, bBlue); ColorRGBToHLS(color,&hue,&luminance,&saturation); if( luminance > 240) { cout<<"ERROR: luminance>240"<<endl; throw exception(); } if( Pitch < 0 ) { PgmM[h-y-1][x] = luminance /240.0; }else{ PgmM[y][x] = luminance / 240.0; } } } } |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| When a class is both an inherited class of another, and alsoimplements an interface method | .NET General | |||
| Need help in 32 bits to 64 bits switching... | General Discussion | |||
| Vista 32 bits to Vista 64 bits without loosing apps. | Vista installation & setup | |||
| Internet Explorer 7 (32-bits) keeps on freezing wile the 64-bits works OK in Vista 64 | Vista General | |||
| Why does x86 mean 64 bits while x32 means 32 bits? | Vista General | |||