counting pixel of one color ??

Started by
0 comments, last by Scarface5013 22 years, 2 months ago
i want to count pixel of one color in a texture. but my code don''t work the value''s in pixel aren''t colors and i don''t know how to go to the next pixel. int CSpriteTexture::CountFoundSprites( void ) { HRESULT Failure; int counter = 0; unsigned int pixel; D3DSURFACE_DESC texDesc; // Höhe und Breite der Texture holen pTexture->GetLevelDesc( 0, &texDesc ); int width = texDesc.Width; int height = texDesc.Height; Failure = pTexture->LockRect( 0, &pLockedRect, NULL, D3DLOCK_READONLY ); for ( int i = 0; i < ( width * height ); i++ ) { memcpy( &pixel, ( BYTE* )pLockedRect.pBits, BYTESPERPIXEL ); if ( pixel == BOARDERCOLOR ) counter++; } Failure = pTexture->UnlockRect( 0 ); return counter; }
Advertisement
solved the prob myself

This topic is closed to new replies.

Advertisement