GetPixelPacked Advanced function
Returns the color value of the specified pixel in a packed 32-bit integer. No checking is done wether the pixel actually lies inside the pixel so make sure that you don't try to read a pixel out of the bounds of the bitmap, which would lead to a crash. Examples Bitmap myBmp( ... );
// Get the color of the pixel x = 7, y = 5 in the bitmap // int color = myBmp.GetPixelPacked( 7, 5 ); // That would lead to a crash if the size of the bitmap would be less than 8x6 // // The safe way would be: // int color; int x = 7, y = 8; if( x >= 0 && x < myBmp.Width() && y >= 0 && y < myBmp.Height() ) { color = myBmp.GetPixelPacked( 7, 5 ); } Other functions of the class Bitmap
Questions about GetPixelPacked? Click here. |