Help with understanding bitmap locking
Essentially I want to lock the bitmap and get the alpha component of each pixel.
I have the following code:
//lock the bitmap
region = al_lock_bitmap
for(int y = 0; y < m_bitmapDimensions.y; ++y)
for(int x = 0; x < m_bitmapDimensions.x; ++x)
But after that I'm stuck. I'm not sure how to get the 32 bit integer representing the color components, and then I'm unsure how the logical shifts work to extract the alpha in an endian independent way.
A simpler solution:
Both solution are endian independent (not that you will still find a lot of big endian hardware).
uint32_t *p = lock->data;
for each pixel: a = p[x] >> 24
at end of row: p += lock->pitch;
Thread #608076. Printed from Allegro.cc
Thank you to both of you